Skip to content

Instantly share code, notes, and snippets.

View graysky's full-sized avatar

Mike Champion graysky

View GitHub Profile
# For future reference, to use SSH to tunnel a
# port to my local machine through a firewall to
# have "localhost:5000" work (i.e. for an admin page):
# - "5000" is the local port
# - machine to tunnel to ("localhost")
# - "9100" is the remote port
# - and then the remote machine.
#
ssh -L 5000:localhost:9100 example.org
#
# 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
// The situation: Need to dynamically load a Javascript file ("ad.js") from
// a 3rd party that displays an ad into a certain div.
// The ad javascript basically does this (in reality with an iframe):
// document.write("<b>Click on the ad!</b>");
//
// This is trivial to incorporate in static HTML, but I had a hell of a time
// getting it to work when the page was being constructed dynamically (from the
// results of fetching JSON using AJAX.) Things that I would have thought
// would work resulted in stomping on the *entire* page body with the results
// from the ad. (It appeared like the document.write in the ad JS was re-writing the
#!/bin/sh
# Append the current Lighthouse ticket number to the commit message automatically
# when you use <ticket_number>_* branch naming convention (ex. "777_lucky_branch").
# Inspired by: http://www.robbyonrails.com/articles/2009/02/16/git-commit-msg-for-lighthouse-tickets
#
# Drop into .git/hooks/commit-msg
# chmod +x .git/hooks/commit-msg
commit_message=$1
@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