<commit_before>dotfiles_timestamp=`date +"%Y%m%d%H%M%S"`

function dotfiles_backup() {
  TARGET=$1

  # remove symlinks in advance, lest ln nest directory symlinks
  if [ -h ${TARGET} ]; then
    rm ${TARGET}
  fi

  # if the file/folder still exists, back it up
  if [ -e ${TARGET} ]; then
    BAK=${TARGET}.${dotfiles_timestamp}
    echo "backing up ${TARGET} to ${BAK}"
    mv ${TARGET} ${BAK}
  fi
}

function dotfiles_backup_and_link() {
  SOURCE=$1
  TARGET=$2

  dotfiles_backup ${TARGET}
  echo "linking ${SOURCE} to ${TARGET}"
  ln -sf ${SOURCE} ${TARGET}
}

function dotfiles_install_submodules() {
  pushd ${DOTFILES}
  git submodule update --recursive --init
  popd
}

function dotfiles_install_conf_files() {
  for dotfile in $(find ${DOTFILES}/conf -maxdepth 1 -type f); do
    SOURCE=${dotfile}
    TARGET=${HOME}/.`basename ${dotfile}`
<commit_msg>dotfiles_backup_and_link symlinks to relative dotfiles paths<commit_after>dotfiles_timestamp=`date +"%Y%m%d%H%M%S"`

function dotfiles_backup() {
  TARGET=$1

  # remove symlinks in advance, lest ln nest directory symlinks
  if [ -h ${TARGET} ]; then
    rm ${TARGET}
  fi

  # if the file/folder still exists, back it up
  if [ -e ${TARGET} ]; then
    BAK=${TARGET}.${dotfiles_timestamp}
    echo "backing up ${TARGET} to ${BAK}"
    mv ${TARGET} ${BAK}
  fi
}

function dotfiles_backup_and_link() {
  ABSOLUTE_SOURCE=$1
  TARGET=$2

  DOTFILES_BASEDIR=`basename ${DOTFILES}`
  RELATIVE_SOURCE=`echo ${ABSOLUTE_SOURCE} | sed -e "s|^${DOTFILES}/|${DOTFILES_BASEDIR}/|"`

  dotfiles_backup ${TARGET}
  echo "linking ${ABSOLUTE_SOURCE} to ${TARGET} as ${RELATIVE_SOURCE}"
  ln -sf ${RELATIVE_SOURCE} ${TARGET}
}

function dotfiles_install_submodules() {
  pushd ${DOTFILES}
  git submodule update --recursive --init
  popd
}

function dotfiles_install_conf_files() {
  for dotfile in $(find ${DOTFILES}/conf -maxdepth 1 -type f); do
    SOURCE=${dotfile}
    TARGET=${HOME}/.`basename ${dotfile}`

{'fraction_non_alphanumeric': 0.14846938775510204, 'fraction_numerical': 0.004081632653061225, 'mean_word_length': 4.271505376344086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4718316', 'n_tokens_mistral': 725, 'n_tokens_neox': 697, 'n_words': 182}