Skip to content

Instantly share code, notes, and snippets.


Josh Kraemer joshkraemer

View GitHub Profile

Keybase proof

I hereby claim:

  • I am joshkraemer on github.
  • I am joshkraemer ( on keybase.
  • I have a public key ASCllDHLpiNl7sf_chuJShruHKSGXrghWfMQPMfTHuWfiQo

To claim this, I am signing this object:

joshkraemer /
Last active Aug 29, 2015 — forked from ibussieres/
Upgrade from Postgres 9.1 to 9.3 on Ubuntu 14.04
echo "deb trusty-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
sudo su - postgres -c "service postgresql stop"
sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"'
joshkraemer / gist:2719249
Last active Oct 4, 2015
MySQL and MAMP Installation
View gist:2719249
Here are the steps on how to get MySQL working with MAMP and Rails Projects:
Note: If you already have MAMP installed and you update the mysql2 gem, you'll need to run steps 4-6 to change the gem version that is linked to MAMP.
1.) Download and install MAMP (if it's not already installed) -
2.) Add these lines to your .bash_profile file. Be sure to remove any existing lines that reference MAMP.
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
export PATH="/Applications/MAMP/Library/bin:$PATH"
joshkraemer / .bash_profile
Created Feb 22, 2012
AWS Local Machine Bash Configuration
View .bash_profile
# Load Amazon EC2 API tools
source ~/.ec2/
joshkraemer /
Created Feb 8, 2012
Useful Terminal Commands
# Recursively find all files named config and replace a string using sed. The -i flag requires a blank suffix '' to work on Mac.
find . -name config -type f -print | xargs sed -i '' 's/'
# Recursively find all files with a certain file extension and replace a string using perl.
find . -name "*.fileext" -print | xargs perl -i -p -e 's/STRINGTOFIND/STRINGTOREPLACE/g'
# Display filesystem of mounted volumes
df -T | awk '{print $1,$2,$NF}' | grep "^/dev"
# Recursively force files lowercase with rename
joshkraemer / unicorn
Created Feb 7, 2012
Unicorn init.d script
View unicorn
# Provides: unicorn
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: unicorn initscript
# Description: unicorn
joshkraemer / mime.types
Created Oct 31, 2011
Nginx Configuration Optimized for Unicorn Rails Apps
View mime.types
# /etc/nginx/mime.types
# Global Nginx mime.types file
types {
text/html html htm shtml;
text/css css;
text/xml xml rss;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
You can’t perform that action at this time.