<commit_before>#!/usr/bin/env bash

# ubuntu.sh

# The path to this repo.
ROOT=$PWD

# Temporary directory.
TMP=$ROOT/tmp

# The global ruby version to install via rbenv.
RUBY_VERSION=2.2.2

# The go version to install.
GO_VERSION=1.4.2

# Ask for the administrator password upfront.
sudo -v

# Create tmp directory if missing.
if [ ! -d "$TMP" ]; then
  mkdir $TMP
fi

# Create required directories.
mkdir -p ~/code/go ~/bin

# Add PPA sources.
sudo add-apt-repository -y ppa:webupd8team/java
sudo add-apt-repository -y ppa:xorg-edgers/ppa
if [ ! -e "/etc/apt/trusted.gpg.d/apt.postgresql.org.gpg" ]; then sudo sh $ROOT/bootstrap/ubuntu/apt.postgresql.org.sh; fi
if [ ! -e "/etc/apt/trusted.gpg.d/debian.datastax.com.gpg" ]; then sudo sh $ROOT/bootstrap/ubuntu/debian.datastax.com.sh; fi
sudo dpkg -i $ROOT/bootstrap/ubuntu/erlang-solutions_1.0_all.deb

# Add Spotify repository
# See https://www.spotify.com/us/download/linux/
if [ ! -e "/etc/apt/sources.list.d/spotify.list" ]; then
  sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys <KEY>
  echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
fi

# Thoughtbot rcm repo.
sudo add-apt-repository ppa:martin-frost/thoughtbot-rcm

# Update list of available packages.
sudo apt-get update

# Configure gfx card drivers.
sudo apt-get -y install nvidia-346

# Set a fast key repeat rate.
gsettings set org.gnome.settings-daemon.peripherals.keyboard repeat-interval 15
gsettings set org.gnome.settings-daemon.peripherals.keyboard delay 250

# Set the desktop background.
gsettings set org.gnome.desktop.background picture-uri "file://$ROOT/images/wallpaper-gray-planks.jpg"

# Disable blinking cursor in text fields.
gsettings set org.gnome.desktop.interface cursor-blink false

# Install rcm.
sudo apt-get -y install rcm

# Install Steam.
sudo apt-get -y install steam

# IM/chat
sudo apt-get -y install pidgin

# Spotify
sudo apt-get -y install spotify-client

# Install developer stuff.
sudo apt-get -y install libreadline-dev git mercurial vim zsh ruby ruby-dev rbenv rake libssl-dev build-essential cmake python-dev libncurses5-dev oracle-java7-installer oracle-java8-installer irssi tmux postgresql-9.4 postgresql-contrib-9.4 postgresql-server-dev-9.4 autotools-dev automake libtool redis-server nodejs npm erlang erlang-dev elixir nginx ctags

# Install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash

# Install Heroku toolbelt
# See https://toolbelt.heroku.com/debian
wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh

# TODO: Install BitTorrent Sync and set up 1Password folder shim.
# Install 1Password Anywhere nginx support
# mkdir -p ~/vhosts/1Password
# ln -s ~/BitTorrent-Sync/1Password/1Password.agilekeychain/1Password.html ~/vhosts/1Password/index.html
# ln -s ~/BitTorrent-Sync/1Password/1Password.agilekeychain/data ~/vhosts/1Password/data
# sudo ln -s ~/code/dotfiles/nginx/sites-available/1Password /etc/nginx/sites-enabled
# TODO: copy favicon.ico
# Browse to in chrome: http://localhost:8081/
# Menu -> More Tools -> Add to desktop

# Install cassandra.
# http://docs.datastax.com/en/cassandra/2.0/cassandra/install/installDeb_t.html
if ! hash cassandra 2>/dev/null; then
  sudo apt-get -y install dsc21=2.1.8-1 cassandra=2.1.8
  sudo service cassandra stop
  sudo rm -rf /var/lib/cassandra/data/system/*
  sudo service cassandra start
fi

# Ensure rbenv is using system ruby (important for compiling vim plugins).
rbenv global system

# Install ruby-build plugin for rbenv.
mkdir -p ~/.rbenv/plugins
if [ ! -d "$HOME/.rbenv/plugins/ruby-build" ]; then
  git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
fi
if [ ! -d "$HOME/.rbenv/plugins/rbenv-vars" ]; then
  git clone https://github.com/sstephenson/rbenv-vars.git ~/.rbenv/plugins/rbenv-vars
fi

# Install Go
GO_ARCHIVE=go$GO_VERSION.linux-amd64.tar.gz
if [ ! -d "/usr/local/go" ]; then
  rm $TMP/$GO_ARCHIVE
  wget -O $TMP/$GO_ARCHIVE https://storage.googleapis.com/golang/$GO_ARCHIVE
  sudo tar -C /usr/local -xzf $TMP/$GO_ARCHIVE
  # Add the go bin to the path so we can use it now.
  export PATH=/usr/local/go/bin:$PATH
fi<commit_msg>Don't install cassandra. Cassandra sucks.<commit_after>#!/usr/bin/env bash

# ubuntu.sh

# The path to this repo.
ROOT=$PWD

# Temporary directory.
TMP=$ROOT/tmp

# The global ruby version to install via rbenv.
RUBY_VERSION=2.2.2

# The go version to install.
GO_VERSION=1.4.2

# Ask for the administrator password upfront.
sudo -v

# Create tmp directory if missing.
if [ ! -d "$TMP" ]; then
  mkdir $TMP
fi

# Create required directories.
mkdir -p ~/code/go ~/bin

# Add PPA sources.
sudo add-apt-repository -y ppa:webupd8team/java
sudo add-apt-repository -y ppa:xorg-edgers/ppa
if [ ! -e "/etc/apt/trusted.gpg.d/apt.postgresql.org.gpg" ]; then sudo sh $ROOT/bootstrap/ubuntu/apt.postgresql.org.sh; fi
if [ ! -e "/etc/apt/trusted.gpg.d/debian.datastax.com.gpg" ]; then sudo sh $ROOT/bootstrap/ubuntu/debian.datastax.com.sh; fi
sudo dpkg -i $ROOT/bootstrap/ubuntu/erlang-solutions_1.0_all.deb

# Add Spotify repository
# See https://www.spotify.com/us/download/linux/
if [ ! -e "/etc/apt/sources.list.d/spotify.list" ]; then
  sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys <KEY>
  echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
fi

# Thoughtbot rcm repo.
sudo add-apt-repository ppa:martin-frost/thoughtbot-rcm

# Update list of available packages.
sudo apt-get update

# Configure gfx card drivers.
sudo apt-get -y install nvidia-346

# Set a fast key repeat rate.
gsettings set org.gnome.settings-daemon.peripherals.keyboard repeat-interval 15
gsettings set org.gnome.settings-daemon.peripherals.keyboard delay 250

# Set the desktop background.
gsettings set org.gnome.desktop.background picture-uri "file://$ROOT/images/wallpaper-gray-planks.jpg"

# Disable blinking cursor in text fields.
gsettings set org.gnome.desktop.interface cursor-blink false

# Install rcm.
sudo apt-get -y install rcm

# Install Steam.
sudo apt-get -y install steam

# IM/chat
sudo apt-get -y install pidgin

# Spotify
sudo apt-get -y install spotify-client

# Install developer stuff.
sudo apt-get -y install libreadline-dev git mercurial vim zsh ruby ruby-dev rbenv rake libssl-dev build-essential cmake python-dev libncurses5-dev oracle-java7-installer oracle-java8-installer irssi tmux postgresql-9.4 postgresql-contrib-9.4 postgresql-server-dev-9.4 autotools-dev automake libtool redis-server nodejs npm erlang erlang-dev elixir nginx ctags

# Install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash

# Install Heroku toolbelt
# See https://toolbelt.heroku.com/debian
wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh

# TODO: Install BitTorrent Sync and set up 1Password folder shim.
# Install 1Password Anywhere nginx support
# mkdir -p ~/vhosts/1Password
# ln -s ~/BitTorrent-Sync/1Password/1Password.agilekeychain/1Password.html ~/vhosts/1Password/index.html
# ln -s ~/BitTorrent-Sync/1Password/1Password.agilekeychain/data ~/vhosts/1Password/data
# sudo ln -s ~/code/dotfiles/nginx/sites-available/1Password /etc/nginx/sites-enabled
# TODO: copy favicon.ico
# Browse to in chrome: http://localhost:8081/
# Menu -> More Tools -> Add to desktop

# Don't install cassandra. Cassandra sucks.
# http://docs.datastax.com/en/cassandra/2.0/cassandra/install/installDeb_t.html
# if ! hash cassandra 2>/dev/null; then
#   sudo apt-get -y install dsc21=2.1.8-1 cassandra=2.1.8
#   sudo service cassandra stop
#   sudo rm -rf /var/lib/cassandra/data/system/*
#   sudo service cassandra start
# fi

# Ensure rbenv is using system ruby (important for compiling vim plugins).
rbenv global system

# Install ruby-build plugin for rbenv.
mkdir -p ~/.rbenv/plugins
if [ ! -d "$HOME/.rbenv/plugins/ruby-build" ]; then
  git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
fi
if [ ! -d "$HOME/.rbenv/plugins/rbenv-vars" ]; then
  git clone https://github.com/sstephenson/rbenv-vars.git ~/.rbenv/plugins/rbenv-vars
fi

# Install Go
GO_ARCHIVE=go$GO_VERSION.linux-amd64.tar.gz
if [ ! -d "/usr/local/go" ]; then
  rm $TMP/$GO_ARCHIVE
  wget -O $TMP/$GO_ARCHIVE https://storage.googleapis.com/golang/$GO_ARCHIVE
  sudo tar -C /usr/local -xzf $TMP/$GO_ARCHIVE
  # Add the go bin to the path so we can use it now.
  export PATH=/usr/local/go/bin:$PATH
fi
{'fraction_non_alphanumeric': 0.12336822298012466, 'fraction_numerical': 0.014347877219804775, 'mean_word_length': 3.818130311614731, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 14, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5960677', 'n_tokens_mistral': 3262, 'n_tokens_neox': 3038, 'n_words': 798}