Skip to content

Instantly share code, notes, and snippets.

View jberkel's full-sized avatar

Jan Berkel jberkel

View GitHub Profile
@jberkel
jberkel / post-receive.rb
Created February 24, 2009 00:51
post-receive hook for marley
#!/usr/bin/env ruby
#based on /usr/share/doc/git-core/contrib/hooks/post-receive-email
require 'syslog'
MARLEY_DIR="/home/git/marley"
def log(msg)
Syslog.open
Syslog.debug(msg)
@jberkel
jberkel / mksession.vim
Created April 18, 2009 11:57
session handling for vim
" how to use this: vim -S mksession.vim file_to_edit
" based on scripts from http://vim.wikia.com/wiki/Go_away_and_come_back
function! SessionFile(name)
let b:sessions = "sessions"
if has("gui_running")
let b:sessions = b:sessions . "-gvim"
endif
let b:sessiondir = $HOME . "/.vim/" . b:sessions . getcwd()
return b:sessiondir . '/' . a:name
endfunction
@jberkel
jberkel / gist:98765
Created April 20, 2009 21:16
support for editors in irb
# .irbrc
# vim: set syntax=ruby :
require 'irb/completion'
require 'irb/ext/save-history'
require 'fileutils'
require 'pp'
require 'rubygems'
ARGV.concat [ "--readline",
"--prompt-mode",
@jberkel
jberkel / .screenrc
Created May 5, 2009 17:55
standard screenrc, with captions
# ------------------------------------------------------------------------------
# SCREEN SETTINGS
# ------------------------------------------------------------------------------
startup_message off
#defflow on # will force screen to process ^S/^Q
deflogin on
#autodetach off
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
export PS1="\[\e[1;36m\]\h:\w\[\e[0m\] \$(parse_git_branch) \$ "
@jberkel
jberkel / .bash_profile
Created May 6, 2009 02:10
git branch in prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
export PS1="\[\e[1;36m\]\h:\w\[\e[0m\] \$(parse_git_branch) \$ "
@jberkel
jberkel / gist:110971
Created May 13, 2009 11:06
growl muter
#!/usr/bin/env macruby
require 'hotcocoa'
include HotCocoa
NORMAL_OUTPUT_DEVICE = "Built-in Output"
DUMMY_OUTPUT_DEVICE = "Soundflower (2ch)"
def set_output_device(device)
`AudioSwitcher -t output -s '#{device}'`
require 'ffi'
module Exec
extend FFI::Library
attach_function :my_exec, :execl, [:string, :string, :varargs], :int
attach_function :fork, [], :int
end
vim1 = '/usr/bin/vim'
curl -s http://aserver.com/path/file.csv | ruby -rcsv -e 'puts CSV.parse($stdin.read).map { |a,b| "#{a}\t#{b}" }.join("\n")' | pbcopy
set mainfont {Monaco 12}
set textfont {Monaco 12}
set uifont {"Monaco Bold" 12}
set tabstop 8
set findmergefiles 0
set maxgraphpct 50
set maxwidth 16
set cmitmode patch
set wrapcomment none
set autoselect 1