Skip to content

Instantly share code, notes, and snippets.

View rapimo's full-sized avatar

Manuel Kniep rapimo

View GitHub Profile
@rapimo
rapimo / connection_fix.rb
Created January 23, 2012 08:47 — forked from mauricioszabo/connection_fix.rb
MySQL/Postgres server has gone away fix
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
@rapimo
rapimo / cleanup.sh
Created December 28, 2011 17:18 — forked from mdp/cleanup.sh
Git branch cleanup
# This must be run from master
git checkout master
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches
git branch --merged master | grep -v 'master$' | xargs git branch -d
# Show remote fully merged branches
echo "The following remote branches are fully merged and will be removed:"
git branch -r --merged master | sed 's/ *origin\///' | grep -v 'master$'