Skip to content

Instantly share code, notes, and snippets.

@cmaitchison
cmaitchison / git-fetch-all.sh
Created June 15, 2012 00:23
git-fetch all repos beneath current directory
for repo in $(find . -name .git -type d)
do
echo $repo
GIT_DIR=$repo git fetch --all --quiet;
done
@cmaitchison
cmaitchison / chef_solo_bootstrap.sh
Created May 7, 2012 22:34
Ubuntu 12.04 Chef-Solo bootstrap
#!/bin/bash -xe
#THIS SCRIPT MUST BE RUN AS ROOT
#Set locale
echo "export LANGUAGE=en_AU.UTF-8" > /tmp/locale
echo "export LANG=en_AU.UTF-8" >> /tmp/locale
echo "export LC_ALL=en_AU.UTF-8" >> /tmp/locale
cat /etc/bash.bashrc >> /tmp/locale
cp /tmp/locale /etc/bash.bashrc
@cmaitchison
cmaitchison / seqeul.rake
Created May 13, 2011 12:42 — forked from tommeier/seqeul.rake
Close postgres open connections before running test suite
task 'db:test:prepare' => :close_postgres_connections
task :close_postgres_connections => :environment do
#Kill any other open connections on the test db
db_adapter = defined?(::ActiveRecord::Base) ? ActiveRecord::Base.connection : nil
db_adapter ||= defined?(::Sequel::Model) ? ::Sequel::Model.db : nil
if Rails.env.test? && db_adapter
db_config = Rails.configuration.database_configuration[Rails.env].symbolize_keys
begin