<commit_before>#!/bin/bash
#================================================================================
#
# Create symlinks of dotfiles
#
#================================================================================

#================================================================================
# Setup

# list of files/folders to symlink in homedir
folders="bash git R screen woof zsh"

# list of folders to symlink in homedir (with different src and tgt names)
declare -A move_folders
move_folders[bin]=bin
move_folders[mypython]=mypython
move_folders[oh-my-zsh/custom]=.oh-my-zsh/custom
move_folders[rsync_excludes]=rsync_excludes
move_folders[crontab_files]=crontab_files

#================================================================================
# Configure directories
DOTDIR=~/dotfiles       # dotfiles directory
OLDDIR=~/dotfiles_old   # old dotfiles backup directory

# create dotfiles_old in homedir
echo "Creating a clean $OLDDIR for backup of any existing dotfiles in ~"
mv $OLDDIR $OLDDIR.bkp
mkdir -p $OLDDIR
echo "...done"

# change to the dotfiles directory
echo "Changing to the $DOTDIR directory"
cd $DOTDIR
echo "...done"

#================================================================================
# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks 
for folder in $folders; do

    # get all the files in the directory
    files=$DOTDIR/$folder/*

    # loop on the files
    for file in $files; do

	# remove leading path name up to the last /
	fname=${file##*/} 

	# backup old copy of the file
    	echo "Moving .$fname from ~ to $OLDDIR"
	mv ~/.$fname $OLDDIR/

	# create symlink
    	echo "Creating symlink to .$fname in home directory."
	ln -s $file ~/.$fname
    done
done

#================================================================================
# We have to be a bit careful with emacs
echo "Moving .emacs from ~ to $OLDDIR"
mv ~/.emacs $OLDDIR
echo "Creating symlink to .emacs in home directory."
ln -s $DOTDIR/emacs/emacs ~/.emacs
echo "Making sure .emacs.d exists"
mkdir -p .emacs.d
echo "Creating symlink to emacs23  in .emacs.d directory."
ln -s $DOTDIR/emacs/emacs.d/emacs23 ~/.emacs.d/
echo "Creating symlink to personal in .emacs.d directory."
ln -s $DOTDIR/emacs/emacs.d/personal ~/.emacs.d/


#================================================================================
# These aren't really dotfiles but I want them version
# controlled. Copy them straight to my home without the dot stuff
for folder in "${!move_folders[@]}"; do
    src=$folder
    tgt=${move_folders[$folder]}

    # backup old copy of the file
    echo "Moving $tgt from ~ to $OLDDIR"
    mv ~/$tgt $OLDDIR/

    # create symlink
    echo "Creating symlink from $DOTDIR/$src to ~/$tgt."
    ln -s $DOTDIR/$src ~/$tgt
    
done

#================================================================================
# Clean backup dotfiles directory
rm -rf $OLDDIR.bkp
<commit_msg>Changed the install script so we don't have those upgrade errors for oh-my-zsh.<commit_after>#!/bin/bash
#================================================================================
#
# Create symlinks of dotfiles
#
#================================================================================

#================================================================================
# Setup

# list of files/folders to symlink in homedir
folders="bash git R screen woof zsh"

# list of folders to symlink in homedir (with different src and tgt names)
declare -A move_folders
move_folders[bin]=bin
move_folders[mypython]=mypython
move_folders[rsync_excludes]=rsync_excludes
move_folders[crontab_files]=crontab_files

#================================================================================
# Configure directories
DOTDIR=~/dotfiles       # dotfiles directory
OLDDIR=~/dotfiles_old   # old dotfiles backup directory

# create dotfiles_old in homedir
echo "Creating a clean $OLDDIR for backup of any existing dotfiles in ~"
mv $OLDDIR $OLDDIR.bkp
mkdir -p $OLDDIR
echo "...done"

# change to the dotfiles directory
echo "Changing to the $DOTDIR directory"
cd $DOTDIR
echo "...done"

#================================================================================
# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks 
for folder in $folders; do

    # get all the files in the directory
    files=$DOTDIR/$folder/*

    # loop on the files
    for file in $files; do

	# remove leading path name up to the last /
	fname=${file##*/} 

	# backup old copy of the file
    	echo "Moving .$fname from ~ to $OLDDIR"
	mv ~/.$fname $OLDDIR/

	# create symlink
    	echo "Creating symlink to .$fname in home directory."
	ln -s $file ~/.$fname
    done
done

#================================================================================
# We have to be a bit careful with emacs
echo "Moving .emacs from ~ to $OLDDIR"
mv ~/.emacs $OLDDIR
echo "Creating symlink to .emacs in home directory."
ln -s $DOTDIR/emacs/emacs ~/.emacs
echo "Making sure .emacs.d exists"
mkdir -p .emacs.d
echo "Creating symlink to emacs23  in .emacs.d directory."
ln -s $DOTDIR/emacs/emacs.d/emacs23 ~/.emacs.d/
echo "Creating symlink to personal in .emacs.d directory."
ln -s $DOTDIR/emacs/emacs.d/personal ~/.emacs.d/


#================================================================================
# These aren't really dotfiles but I want them version
# controlled. Copy them straight to my home without the dot stuff
for folder in "${!move_folders[@]}"; do
    src=$folder
    tgt=${move_folders[$folder]}

    # backup old copy of the file
    echo "Moving $tgt from ~ to $OLDDIR"
    mv ~/$tgt $OLDDIR/

    # create symlink
    echo "Creating symlink from $DOTDIR/$src to ~/$tgt."
    ln -s $DOTDIR/$src ~/$tgt
    
done

#================================================================================
# Oh-my-zsh custom files
echo "Creating symlinks for the oh-my-zsh custom files"
tgtdir=~/.oh-my-zsh/custom
mkdir -p $tgtdir
for file in $DOTDIR/oh-my-zsh/custom/*; do
    ln -s $file $tgtdir/$(basename $file)
done

#================================================================================
# Clean backup dotfiles directory
rm -rf $OLDDIR.bkp

{'fraction_non_alphanumeric': 0.3017144688351226, 'fraction_numerical': 0.0012818458580355712, 'mean_word_length': 4.790352504638219, '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': '2514874', 'n_tokens_mistral': 1858, 'n_tokens_neox': 1780, 'n_words': 613}