Skip to content

Instantly share code, notes, and snippets.

@bps
bps / comm
Created February 9, 2010 16:00
screenrc for IRC and mail that uses newer screen features.
# Get HOL screen from http://git.savannah.gnu.org/gitweb/?p=screen.git
# 4.1.0 has vertical splitting and support for layouts, but has been cooking
# since at least early 2007. See
# http://lists.gnu.org/archive/html/screen-users/2007-02/msg00000.html for
# documentation on the new features, as they're not in the man page yet.
# Build it with "cd src && autoreconf -iv && ./configure --prefix=whatever &&
# make install"
# Communication layout, use a 160x50ish term
source ${HOME}/.screenrc
@bps
bps / pre-commit
Created February 1, 2010 16:28
A git pre-commit hook to stop you from committing scratch code.
#!/bin/sh
# A hook to abort a commit if your diff adds XXX or FIXME.
# Set this config variable if you want to allow it anyway.
allowfixmes=$(git config hooks.allowfixmes)
disallow_list="XXX FIXME"
if [ "$allowfixmes" != "true" ]
then
for disallow in $disallow_list
@bps
bps / time_delta
Created October 6, 2009 21:04
I often want to see a delta between two dates.
#!/usr/bin/env ruby
require 'date'
raise 'Give two parseable arguments' unless ARGV.length == 2
d1 = DateTime.parse(ARGV[0])
d2 = DateTime.parse(ARGV[1])
if d1 < d2
d1, d2 = d2, d1
end
@bps
bps / gist:198337
Created September 30, 2009 18:42
A vim function that will load a per-git-project vimrc.
vim ()
{
local vimrc="vimrc" # Name you want to use for your vimrc in .git/
local v="$(which vim)" # Or whatever vim you want
local g="$(__gitdir)" # This comes from the git bash completion script
if [ -z "${g-}" ]; then
"${v}" "$@"
else
local vrc="${g}/${vimrc}"
@bps
bps / gist:101311
Created April 24, 2009 19:48
Problems with my new 2 week old Unibody MacBook Pro
Unibody MacBook Pro acceptance
- Hard freezes
- No cursor movement
- Audio short loop (like stuck record)
- Only happens (so far) with 4GB RAM
- Ran for 3-4 days with stock 2GB RAM
- Ran for 10 days with 4GB RAM
- Crash on day 2
- Crashes on days 6, 7, 8, 10
- Running since 4/22 evening on 3GB RAM, no freeze yet
@bps
bps / Rakefile
Created March 12, 2009 15:51
Rakefile to build plain-text applescripts and install them in ~/Library/Scripts/, maintaining proper hierarchy.
require 'ftools'
require 'rake/clean'
DESTDIR = File.join(ENV['HOME'], 'Library', 'Scripts')
SRC = FileList['**/*.applescript']
SCPTSDIR = 'build'
SCPTS = SRC.collect { |s| File.join(SCPTSDIR, s.sub(/\.applescript$/, '.scpt')) }
CLEAN.include(SCPTS)
CLEAN.include(SCPTSDIR)