Skip to content

Instantly share code, notes, and snippets.

View graysky's full-sized avatar

Mike Champion graysky

View GitHub Profile
@graysky
graysky / stats.rb
Created September 15, 2009 20:24 — forked from mojombo/stats.rb
# Run the given block +num+ times and then print out the mean, median, min,
# max, and stddev of the run. For example:
#
# irb> stats(10) { sleep(rand / 100) }
# mean: 5.99ms
# median: 6.76ms
# min: 1.49ms
# max: 9.28ms
# stddev: 2.54ms
def stats(num)
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names

HOWTO: iPhone AT&T Tethering

In 10 steps:

  • Update iTunes to 8.2 via Software Update
  • Update your iPhone to the 3.0 release (out today - June 17th)
  • Download this dmg and mount it: tethering file
  • Enable hidden carrier testing option (in Terminal.app): defaults write com.apple.iTunes carrier-testing -bool TRUE
  • Start up iTunes
Deploying a Rails App with EC2 + S3 + Ubuntu
============================================
Create EC2 Instance
-------------------
create new instance ami-bf5eb9d6 [http://alestic.com/](http://alestic.com/)
create new elastic ip
attach elastic ip to instance
point dns to elastic ip
require 'sinatra'
class DatabaseStreamer
def initialize(blob)
@blob = blob
end
def each
while chunk = @blob.read(4096)
yield chunk
end
#!/bin/sh
git remote prune origin
branch_list=$(git branch -r | grep -v HEAD | grep -v master | sed s:origin/::)
until [ -z "$1" ]
do
branch_list=$(echo "$branch_list" | grep -v $1)
shift
Dan Pickett, http://en.oreilly.com/rails2009/profile/46469
@graysky
graysky / git-track
Created November 25, 2008 20:41 — forked from sstephenson/git-track
Auto-track a git branch
#!/bin/sh
# Sets up auto-tracking of a remote branch with same base name.
# Can set up "git track" so it feels built-in:
# git config --global --add alias.track '!git-track'
#
branch=$(git branch 2>/dev/null | grep ^\*)
[ x$1 != x ] && tracking=$1 || tracking=${branch/* /}
git config branch.$tracking.remote origin