Skip to content

Instantly share code, notes, and snippets.

View schacon's full-sized avatar
:shipit:

Scott Chacon schacon

:shipit:
View GitHub Profile
@schacon
schacon / slide_w_notes.txt
Created September 13, 2011 23:00
ShowOff slide with notes
!SLIDE bullets incremental transition=fade
.notes something something something something something something something something something something something something something something something dark side
# Second Slide #
* something
* something else
* a third thing
* a fourth thing
--enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid
@schacon
schacon / output.txt
Created August 20, 2011 09:00
Annotating pushed commits with the pusher
$ git log --notes=pusher
commit c5ba11b523db159b319f568931501237c5e53ed2
Author: Scott Chacon <[email protected]>
Date: Sat Aug 20 10:59:02 2011 +0200
test
Notes (pusher):
master :: User Name [email protected] :: Sat Aug 20 10:59:02 +0200 2011
@schacon
schacon / rebase.rb
Created August 18, 2011 12:18
simple rebase
#! /usr/bin/env ruby
# take a branch and rebase the current one onto it
branch_target = branch_onto = ARGV[0]
raise 'no target' unless branch_target
branch_onto = ARGV[1] if ARGV[1]
# record where we are and what branch we're on
branch_current = `git symbolic-ref HEAD`.chomp
@schacon
schacon / plumbing.md
Created August 18, 2011 04:51
plumbing cheat sheet

the plumbing commands

  • rev-parse [something]

    • show the SHA of any weird git phrase
  • hash-object -w [file]

    • take any file or stdin and return a blob sha
  • ls-tree (-r) [sha]

  • show the entries of a git tree in the db

@schacon
schacon / temp_path.rb
Created July 20, 2011 21:19
helper for tests to create a temp directory
def temp_path
t = Tempfile.new('graph')
fpath = t.path
t.unlink
FileUtils.mkdir_p(fpath)
fpath
end
#! /usr/bin/env ruby
$LOAD_PATH.unshift '/Users/schacon/projects/git/rugged/lib'
require 'rugged'
require 'rubygems'
require 'pp'
dir, id = "/opt/linux.git"
@schacon
schacon / stopwatch.rb
Created June 22, 2011 15:59
simple ruby stopwatch
class Stopwatch
attr_writer :splits, :max, :start, :end, :total
def initialize(message)
@message = message
@splits = []
@max = 5
end
@schacon
schacon / auto-backup.rb
Created May 12, 2011 23:50
Example Scripts from Three Trees Talk
back_branch = 'refs/heads/backup'
`rm /tmp/backup_index`
ENV['GIT_INDEX_FILE'] = '/tmp/backup_index'
last_commit = `git rev-parse #{back_branch}`.strip
last_tree = `git rev-parse #{back_branch}^{tree}`.strip
`git add --all`
next_tree = `git write-tree`.strip