<commit_before>#!/usr/bin/env bash
set -x

create_directories() {
  mkdir -p ~/dev/go
}

ssh_configuration() {
  if [[ ! -f ~/.ssh/id_rsa ]]; then
    read -p "An email address is needed for your SSH key. What is it? " email
    ssh-keygen -t rsa -C "$email"
    cat ~/.ssh/id_rsa.pub
    echo "Please visit https://github.com/settings/ssh to add this key to your account."
    if ! [[ `which pbcopy &>/dev/null` ]]; then
      pbcopy < ~/.ssh/id_rsa.pub
      echo "Your public key is on your clipboard."
    fi

    if ! [[ `which open &>/dev/null` ]]; then
      open "https://github.com/settings/ssh"
    fi
  fi
}

homebrew_source_install() {
  if [[ `which brew &>/dev/null` ]]; then
    ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
  fi
}

apt_update() {
  sudo apt-get update
}

homebrew_update() {
  brew update
}

git_apt_install() {
  if [[ `which git &>/dev/null` ]]; then
    sudo apt-get install git-core
  fi
}

git_homebrew_install() {
  if [[ `which git &>/dev/null` ]]; then
    brew install git
  fi
}

git_source_install() {
  if [[ `which git &>/dev/null` ]]; then
    cd ~
    mkdir -p usr
    curl https://github.com/git/git/archive/v1.8.5.3.tar.gz > git.tar.gz
    tar -zxf git.tar.gz
    cd ~/git-1.8.5.3
    make prefix=$ABSOLUTE_HOME/usr all
    make prefix=$ABSOLUTE_HOME/usr install
    cd ~
    rm -rf git-1.8.5.3
  fi
}

clone_dotfiles_repo() {
  if [[ -d "~/.config" ]]; then
    git clone --recursive git://github.com/christhomson/dotfiles.git ~/.config
  fi
}

set_machine_name() {
  if [ -z "$MACHINE_NAME" ]; then
    read -p "Please enter a name for this machine: " machine_name
    echo "export MACHINE_NAME=\"$machine_name\"" > ~/.config/zsh/machine.zsh
  fi
}

git_configuration() {
  name=`git config --global user.name`
  email=`git config --global user.email`

  if [ -z "$name" ]; then
    read -p "Git needs your full name. What is it? " name
    git config --global user.name "$name"
  fi

  if [ -z "$email" ]; then
    read -p "Git needs your public email address. What is it? " email
    git config --global user.email "$email"
  fi
}

ag_apt_install() {
  if [[ `which ag &>/dev/null` ]]; then
    sudo apt-get install silversearcher-ag
  fi
}

ag_homebrew_install() {
  if [[ `which ag &>/dev/null` ]]; then
    brew install the_silver_searcher
  fi
}

ag_source_install() {
  if [[ `which ag &>/dev/null` ]]; then
    cd ~
    mkdir -p usr
    git clone git://github.com/ggreer/the_silver_searcher.git
    cd the_silver_searcher
    ./build.sh --prefix=$ABSOLUTE_HOME/usr
    make install
    cd ~
    rm -rf the_silver_searcher
  fi
}

link_dotfiles() {
  # TODO - check if same
  ln -s ~/.config/git/config ~/.gitconfig
  ln -s ~/.config/ssh/config ~/.ssh/config
  ln -s ~/.config/vim/vimrc ~/.vimrc
  ln -s ~/.config/vim/gvimrc ~/.gvimrc
  ln -s ~/.config/zsh/zshrc ~/.zshrc

  mkdir -p ~/.subversion
  ln -s ~/.config/svn/config ~/.subversion/config
}

vundle_git_install() {
  mkdir -p ~/.vim/bundle

  if [[ ! -d "~/.vim/bundle/vundle" ]]; then
    git clone git://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
  fi
  vim +BundleInstall +qall
  vim +BundleClean +qall
}

chruby_homebrew_install() {
  brew install chruby
}

ruby-install_homebrew_install() {
  brew install ruby-install
}

gems_install() {
  if [[ `gem list -i awesome_print` == "false" ]]; then
    gem install awesome_print
  fi

  if [[ `gem list -i git-smart` == "false" ]]; then
    gem install git-smart
  fi

  if [[ `gem list -i what_methods` == "false" ]]; then
    gem install what_methods
  fi
}

cmatcher_install() {
  cd ~/.vim/bundle/ctrlp-cmatcher/
  ./install.sh
  cd -
}

fix_zsh_config_for_vim() {
  if [[ -f /etc/zshenv ]]; then
    sudo mv /etc/zshenv /etc/zshrc
  fi
}

provision_mac_os_x() {
  export CFLAGS=-Qunused-arguments
  export CPPFLAGS=-Qunused-arguments
  defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool FALSE<commit_msg>Revert "Disable history gestures in Chrome"<commit_after>#!/usr/bin/env bash
set -x

create_directories() {
  mkdir -p ~/dev/go
}

ssh_configuration() {
  if [[ ! -f ~/.ssh/id_rsa ]]; then
    read -p "An email address is needed for your SSH key. What is it? " email
    ssh-keygen -t rsa -C "$email"
    cat ~/.ssh/id_rsa.pub
    echo "Please visit https://github.com/settings/ssh to add this key to your account."
    if ! [[ `which pbcopy &>/dev/null` ]]; then
      pbcopy < ~/.ssh/id_rsa.pub
      echo "Your public key is on your clipboard."
    fi

    if ! [[ `which open &>/dev/null` ]]; then
      open "https://github.com/settings/ssh"
    fi
  fi
}

homebrew_source_install() {
  if [[ `which brew &>/dev/null` ]]; then
    ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
  fi
}

apt_update() {
  sudo apt-get update
}

homebrew_update() {
  brew update
}

git_apt_install() {
  if [[ `which git &>/dev/null` ]]; then
    sudo apt-get install git-core
  fi
}

git_homebrew_install() {
  if [[ `which git &>/dev/null` ]]; then
    brew install git
  fi
}

git_source_install() {
  if [[ `which git &>/dev/null` ]]; then
    cd ~
    mkdir -p usr
    curl https://github.com/git/git/archive/v1.8.5.3.tar.gz > git.tar.gz
    tar -zxf git.tar.gz
    cd ~/git-1.8.5.3
    make prefix=$ABSOLUTE_HOME/usr all
    make prefix=$ABSOLUTE_HOME/usr install
    cd ~
    rm -rf git-1.8.5.3
  fi
}

clone_dotfiles_repo() {
  if [[ -d "~/.config" ]]; then
    git clone --recursive git://github.com/christhomson/dotfiles.git ~/.config
  fi
}

set_machine_name() {
  if [ -z "$MACHINE_NAME" ]; then
    read -p "Please enter a name for this machine: " machine_name
    echo "export MACHINE_NAME=\"$machine_name\"" > ~/.config/zsh/machine.zsh
  fi
}

git_configuration() {
  name=`git config --global user.name`
  email=`git config --global user.email`

  if [ -z "$name" ]; then
    read -p "Git needs your full name. What is it? " name
    git config --global user.name "$name"
  fi

  if [ -z "$email" ]; then
    read -p "Git needs your public email address. What is it? " email
    git config --global user.email "$email"
  fi
}

ag_apt_install() {
  if [[ `which ag &>/dev/null` ]]; then
    sudo apt-get install silversearcher-ag
  fi
}

ag_homebrew_install() {
  if [[ `which ag &>/dev/null` ]]; then
    brew install the_silver_searcher
  fi
}

ag_source_install() {
  if [[ `which ag &>/dev/null` ]]; then
    cd ~
    mkdir -p usr
    git clone git://github.com/ggreer/the_silver_searcher.git
    cd the_silver_searcher
    ./build.sh --prefix=$ABSOLUTE_HOME/usr
    make install
    cd ~
    rm -rf the_silver_searcher
  fi
}

link_dotfiles() {
  # TODO - check if same
  ln -s ~/.config/git/config ~/.gitconfig
  ln -s ~/.config/ssh/config ~/.ssh/config
  ln -s ~/.config/vim/vimrc ~/.vimrc
  ln -s ~/.config/vim/gvimrc ~/.gvimrc
  ln -s ~/.config/zsh/zshrc ~/.zshrc

  mkdir -p ~/.subversion
  ln -s ~/.config/svn/config ~/.subversion/config
}

vundle_git_install() {
  mkdir -p ~/.vim/bundle

  if [[ ! -d "~/.vim/bundle/vundle" ]]; then
    git clone git://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
  fi
  vim +BundleInstall +qall
  vim +BundleClean +qall
}

chruby_homebrew_install() {
  brew install chruby
}

ruby-install_homebrew_install() {
  brew install ruby-install
}

gems_install() {
  if [[ `gem list -i awesome_print` == "false" ]]; then
    gem install awesome_print
  fi

  if [[ `gem list -i git-smart` == "false" ]]; then
    gem install git-smart
  fi

  if [[ `gem list -i what_methods` == "false" ]]; then
    gem install what_methods
  fi
}

cmatcher_install() {
  cd ~/.vim/bundle/ctrlp-cmatcher/
  ./install.sh
  cd -
}

fix_zsh_config_for_vim() {
  if [[ -f /etc/zshenv ]]; then
    sudo mv /etc/zshenv /etc/zshrc
  fi
}

provision_mac_os_x() {
  export CFLAGS=-Qunused-arguments
  export CPPFLAGS=-Qunused-arguments
{'fraction_non_alphanumeric': 0.15297124600638978, 'fraction_numerical': 0.0030670926517571886, 'mean_word_length': 2.6655737704918034, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '3249988', 'n_tokens_mistral': 3089, 'n_tokens_neox': 2973, 'n_words': 772}