Skip to content

Instantly share code, notes, and snippets.

@bartimaeus
bartimaeus / setup-rvm.sh
Created June 29, 2012 20:53
Setup RVM on Ubuntu Server
#!/bin/bash
sudo su -i # switch to the root user (or run every command with sudo)
apt-get -y update
apt-get -y install curl git-core
# Ruby dependencies
apt-get -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion libyaml-0-2 libyaml-dev
# apt-get -y install libmysqlclient-dev # for mysql support
@bartimaeus
bartimaeus / install-ruby.sh
Created May 31, 2012 19:55 — forked from ryanb/chef_solo_bootstrap.sh
Install Ruby 1.9.3-p286 on Ubuntu 12.04 LTS
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libxml2-dev libxslt-dev libreadline6-dev libyaml-dev
# apt-get -y install libmysqlclient-dev # uncomment for mysql support
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p286.tar.gz
tar -xvzf ruby-1.9.3-p286.tar.gz
cd ruby-1.9.3-p286/
./configure --prefix=/usr/local
make
@bartimaeus
bartimaeus / 0-readme.md
Created February 29, 2012 19:31 — forked from burke/0-readme.md
ruby-1.9.3-p125 cumulative performance patch.

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.

@bartimaeus
bartimaeus / .gitconfig
Created September 28, 2011 21:25
Gitconfig defaults. Developed with Mike Smullin (github.com/mikesmullin)
[core]
editor = vim
excludesfile = ~/.gitignore_global
[user]
name = Eric Shelley
email = [email protected]
[color]
branch = auto
diff = auto
interactive = auto
@bartimaeus
bartimaeus / aws-manage
Created July 30, 2011 19:33
Script for Managing multiple AWS Accounts
#!/bin/sh
if [[ "cd ~/.aws | git branch | grep $1" = *$1 ]]; then
cd ~/.aws && git checkout $1 | cd -
echo "Ready to Manage $1!"
else
echo "$1 is not a valid ec2 branch"
fi
source ~/.bash_profile
@bartimaeus
bartimaeus / .bash_profile
Created July 30, 2011 14:05
Manage Multiple EC2 Accounts
# Custom bash scripts
export PATH=$PATH:~/bin
# AWS Settings
export AWS_HOME=~/.aws
export EC2_HOME=$AWS_HOME/cli_tools/ec2-api-tools
export AWS_AUTO_SCALING_HOME=$AWS_HOME/cli_tools/as-api-tools
export PATH=$PATH:$EC2_HOME/bin:$AWS_AUTO_SCALING_HOME/bin
export EC2_PRIVATE_KEY=$AWS_HOME/pk-ec2.pem
export EC2_CERT=$AWS_HOME/cert-ec2.pem
@bartimaeus
bartimaeus / .profile
Created March 31, 2011 21:22
Here's my .profile that I use on my macbook
#!/bin/sh
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
#showing git branches in bash prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
@bartimaeus
bartimaeus / .bashrc
Created February 28, 2011 20:21
Git branch display in console [~/.bashrc]
#!/bin/sh
# Show git status and branch
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1='\[\033[0m\]\w\[\033[1;33m\]$(parse_git_branch)\[\033[0m\]$ '
@bartimaeus
bartimaeus / company.rake
Created February 18, 2011 14:43
Part of my FatFreeCRM migration rake task. I've added custom fields and roles to this install of FatFreeCRM. The files used by this rake task are generated by another task that downloads them and converts then to csv files using the pipe "|" as the delimi
# Store rake tasks specific to [company]
namespace :[company] do
# Migrate [Company]'s data into the new CRM
namespace :migrate do
require 'progressbar'
desc "Run all [company] migration tasks"
task :all => [:config, :users, :comments, :accounts]
function parse_git_branch {
git_status="$(git status 2> /dev/null)"
pattern="^# On branch ([^${IFS}]*)"
if [[ ! ${git_status}} =~ "working directory clean" ]]; then
state="*"
fi
# add an else if or two here if you want to get more specific
if [[ ${git_status} =~ ${pattern} ]]; then
branch=${BASH_REMATCH[1]}