Skip to content

Instantly share code, notes, and snippets.

View oggy's full-sized avatar

George Ogata oggy

  • Rhino
  • New York, NY
View GitHub Profile
@oggy
oggy / parallel_process_barriers.rb
Created June 7, 2012 01:54
Parallel process barriers in Ruby
#
# Runs two blocks in parallel, yielding a barrier to each for
# synchronization. The barrier may be called multiple times in each
# block to establish multiple synchronization points.
#
# parallel do
# process do |barrier|
# ...
# barrier.call
# ...
@oggy
oggy / redis
Created April 19, 2011 20:16
Script to start redis using command line options, rather than a config file
#!/usr/bin/env ruby
#
# Run redis-server with settings taken from the command line.
#
# Source: https://gist.github.com/929513
#
require 'optparse'
require 'fileutils'
#!/bin/sh
######################################################################
#
# switch_bundler_environment OLD-BRANCH NEW-BRANCH
#
# Swap out the old branch's Bundler environment, and swaps in the new
# branch's. Arguments may be branch names or SHAs.
#
# For best results, add this to .git/hooks/post-checkout: