Skip to content

Instantly share code, notes, and snippets.

View timshadel's full-sized avatar

Tim Shadel timshadel

View GitHub Profile
@timshadel
timshadel / search_svn_log.rb
Created January 23, 2009 22:57
SVN log filter: Search the last 1000 lines of `svn log` for anything that references me, except those commits that used the `svnmerge` tool.
@record = []
def record_match?
record_string = @record.join(" ")
record_string =~ /shadel/i && record_string !~ /svnmerge/
end
def print_record
puts @record.join
end
@timshadel
timshadel / .bashrc
Created January 28, 2009 22:37 — forked from tekkub/.bashrc
Use git-symbolic-ref instead of git-branch for showing current branch on the commandline
parse_git_branch() {
git symbolic-ref HEAD 2> /dev/null | cut -d/ -f3- | sed -e 's/\(.*\)/ (\1)/'
}
PS1="\w\$(parse_git_branch) $ "
@timshadel
timshadel / .bashrc
Created January 28, 2009 22:40 — forked from tekkub/.bashrc
Bold your current git branch on the command line (tested on Mac OS X)
TERM=xterm-color
# \[ starts a sequence of non-printable chars
# \] ends that sequence
# \e[1m turns text that follows Bold
# \e[m turns text that follows Normal
#
# \[\e[1m\] tells the shell not to count the non-printable bold command in it's wrapping calculations
# \[\e[m\] tells the shell not to count the non-printable normal command in it's wrapping calculations
#
# Unlike HTML <b></b> elements; this is more like <b>...<normal> It's important that the shell counts
@timshadel
timshadel / count.rb
Created February 16, 2009 15:50
Counts the number of files in each subdirectory of the given directory and then outputs the count in a Tufte-esque style histogram
# Counts the number of files in each subdirectory of the given directory
# and then outputs the count in a Tufte-esque style histogram, where the
# number before the | is the 10's column, and each number after the |
# represents one data point with that value. This lets you see the
# spread to get a sense of the distribution. Each 10's value has two
# rows: one for values 0-4, one for 5-9
#
# 0|
# 0|99
# 1|0001233333333344444444444
@timshadel
timshadel / .gitconfig
Created April 2, 2009 20:43
Simple way to access github through a proxy server
[core]
gitproxy="/Users/name/bin/gitproxy" for github.com
require 'socket'
require 'openssl'
# port can be anything. here it's ldaps
socket = TCPSocket.new("some.secure.server.com", 636)
ssl_context = OpenSSL::SSL::SSLContext.new()
unless ssl_context.verify_mode
warn "warning: peer certificate won't be verified this session."
ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
sslsocket = OpenSSL::SSL::SSLSocket.new(socket, ssl_context)
require 'restclient'
require 'pp'
require 'hpricot'
if ARGV.size == 0
puts "Usage: showheaders.rb <url> [headers]"
puts
puts " Headers are optional, but should come in as pairs of arguments."
puts " showheaders.rb <url> If-None-Match 4eb6dc"
exit 1
#!/usr/bin/env macruby
# From: http://www.stompy.org/2008/08/14/xcode-and-git-another-build-script/
# Expanded from here: http://www.furmanek.net/36/using-macruby-to-set-xcode-project-version-from-git/
# Xcode auto-versioning script for Subversion by Axel Andersson
# Updated for git by Marcus S. Zarra and Matt Long
# Converted to ruby by Abizern
# Converted to MacRuby by Gregory Furmanek
# Merged with MacRuby version by elliottcable
# Dirty handling, style and build-only version update by timshadel
@timshadel
timshadel / grails_app_time.txt
Created November 23, 2010 05:52
Why is grails so much slower than rails? (OK, it's the probably JVM startup time and Java toolset) Then why is it so exciting?
$ time grails create-app qotd
Welcome to Grails 1.3.4 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/local/Cellar/grails/1.3.4
Base Directory: /Users/tim/work/ssi/consulting/learn
Resolving dependencies...
Dependencies resolved in 1143ms.
Running script /usr/local/Cellar/grails/1.3.4/scripts/CreateApp_.groovy
Environment set to development
@timshadel
timshadel / 0-prep.txt
Created December 26, 2010 03:41
Grab my home brew branch on the mini
the-mini:~ $ cd /usr/local/
the-mini:local (master) $ git remote -v
the-mini:local (master) $ git pull https://github.com/timshadel/homebrew.git
remote: Counting objects: 8, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 3), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
From https://github.com/timshadel/homebrew
* branch HEAD -> FETCH_HEAD
First, rewinding head to replay your work on top of it...