Skip to content

Instantly share code, notes, and snippets.

Stuart Saunders stuartsaunders

Block or report user

Report or block stuartsaunders

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am stuartsaunders on github.
  • I am stuartsaunders ( on keybase.
  • I have a public key ASBvdtGxPLybp-OhfanqKse9sYQ7WWrrMbkwxEGId27Ynwo

To claim this, I am signing this object:

stuartsaunders / connection_fix.rb
Created Sep 29, 2011 — forked from defunkt/connection_fix.rb
MySQL server has gone away fix
View connection_fix.rb
# 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:
stuartsaunders / copy-s3-bucket.rb
Created Jun 3, 2011 — forked from zefer/copy-s3-bucket.rb
Copy contents of an S3 bucket to a another bucket using an EC2 instance and a simple Ruby script. Useful for transferring large amounts of data and will work across geographic regions.
View copy-s3-bucket.rb
require 'rubygems'
require 'right_aws'
aws_access_key_id = 'your-access-key'
aws_secret_access_key = 'your-secret-key'
target_bucket = 'your-source-bucket'
destination_bucket = 'your-destination-bucket'
s3 =, aws_secret_access_key)
View mail.rb
#!/usr/bin/env ruby
# CIJoe mail notification script.
# Some things in here are shamelessly ripped from
# Call this from your hooks (build-worked, build-failed) with something like:
# ~/ci/scripts/mail.rb ~/ci/PROJECT/ CIJOE_URL BRANCH
# Requirements
stuartsaunders / .gitignore
Created Dec 30, 2010
Global Git ignore file
View .gitignore
git config --global core.excludesfile ~/.gitignore
stuartsaunders / .irbrc
Created Dec 28, 2010
awesome_print 0.3.x workaround for ActiveRecord objects in Rails 2.3.x
View .irbrc
require 'rubygems'
require 'irb/completion'
require 'yaml'
module ActiveRecord; end
stuartsaunders / gist:755501
Created Dec 26, 2010
Uninstall inactive Macports
View gist:755501
sudo port uninstall inactive
stuartsaunders / vim-ruby-debugger
Created Dec 26, 2010
Macports vim and vim-ruby-debugger
View vim-ruby-debugger
# x11 variant will install clientserver variant
sudo port upgrade vim +ruby +x11
stuartsaunders / drb_command_line.rb
Created Dec 20, 2010
OS X 10.6.5 + Spork 0.8.4 + RSpec 1.3.1 = DRb.start_service('druby://localhost:0') SocketError
View drb_command_line.rb
require "drb/drb"
module Spec
module Runner
# Facade to run specs by connecting to a DRB server
class DrbCommandLine
def self.port(options)
(options.drb_port || ENV["RSPEC_DRB"] || 8989).to_i
View NBench
BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)
TEST : Iterations/sec. : Old Index : New Index
: : Pentium 90* : AMD K6/233*
NUMERIC SORT : 220.22 : 5.65 : 1.85
STRING SORT : 9.968 : 4.45 : 0.69
BITFIELD : 8.0907e+07 : 13.88 : 2.90
You can’t perform that action at this time.