Skip to content

Instantly share code, notes, and snippets.

View joshkraemer's full-sized avatar

Josh Kraemer joshkraemer

  • @lumerit
  • San Antonio, TX
View GitHub Profile
@joshkraemer
joshkraemer / keybase.md
Created February 22, 2018 21:11
Keybase Proof

Keybase proof

I hereby claim:

  • I am joshkraemer on github.
  • I am joshkraemer (https://keybase.io/joshkraemer) on keybase.
  • I have a public key ASCllDHLpiNl7sf_chuJShruHKSGXrghWfMQPMfTHuWfiQo

To claim this, I am signing this object:

@joshkraemer
joshkraemer / mime.types
Created October 31, 2011 20:04
Nginx Configuration Optimized for Unicorn Rails Apps
# /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;
@joshkraemer
joshkraemer / gist:2719249
Last active October 4, 2015 23:57
MySQL and MAMP Installation
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) - http://www.mamp.info/downloads/releases/MAMP_PRO.zip
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
joshkraemer / .bash_profile
Created February 22, 2012 18:19
AWS Local Machine Bash Configuration
# Load Amazon EC2 API tools
source ~/.ec2/setup_env.sh
@joshkraemer
joshkraemer / useful-terminal.sh
Created February 8, 2012 01:41
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/git@github.com:CollegePlus/git@github.com:collegeplus/g'
# 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
joshkraemer / unicorn
Created February 7, 2012 22:56
Unicorn init.d script
#!/bin/sh
### BEGIN INIT INFO
# 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
### END INIT INFO
@joshkraemer
joshkraemer / upgrade_pg.sh
Last active August 29, 2015 14:01 — forked from ibussieres/upgrade_pg.sh
Upgrade from Postgres 9.1 to 9.3 on Ubuntu 14.04
echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | 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"'