Skip to content

Instantly share code, notes, and snippets.


Andrew Hay Kurtz ahk

  • Penumbra
  • Oakland, CA
View GitHub Profile
View gist:1224530
$ cabal-dev install --verbose
/usr/local/bin/cabal --numeric-version
/usr/local/bin/ghc-pkg --version
Using ghc-pkg 7.0.4
/usr/local/bin/cabal --version
/usr/local/bin/cabal --config-file=/Users/andrew/Code/misc/haskell/supercollider-test/cabal-dev/cabal.config install --verbose=2
Reading available packages...
Resolving dependencies...
cabal: There is no installed version of base
ahk / gist:972137
Created May 14, 2011
redirect traffic on port 80 to port 8080 with iptables
View gist:972137
# redirect traffic on port 80 to port 8080 with iptables
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
ahk / gist:953932
Created May 3, 2011
find and replace strings in glob
View gist:953932
# $@ and $* are the same without quotes, but with quotes
# $* is one quoted string containing all args, $@ is one quoted string
# for each arg. This handles spaces in filenames correctly.
echo "replace ${FINDSTR} with ${REPSTR} in" "$@"
for FN in "$@"
View gist:871143
1) An ActivityMailer class receiving notify_researchers With test deliveries#notify_response_author should be from
Failure/Error: ActivityMailer.deliver_reply(@comment, @participant).from.should == [""]
wrong number of arguments (0 for 1)
# /Users/revelation/.rvm/gems/ruby-1.8.7-p249@revelation-project-rails3/gems/actionmailer-3.0.5/lib/action_mailer/delivery_methods.rb:83:in `message'
# /Users/revelation/.rvm/gems/ruby-1.8.7-p249@revelation-project-rails3/gems/actionmailer-3.0.5/lib/action_mailer/delivery_methods.rb:83:in `wrap_delivery_behavior!'
# /Users/revelation/.rvm/gems/ruby-1.8.7-p249@revelation-project-rails3/gems/actionmailer-3.0.5/lib/action_mailer/base.rb:643:in `mail'
# ./app/models/activity_mailer.rb:72:in `reply'
# /Users/revelation/.rvm/gems/ruby-1.8.7-p249@revelation-project-rails3/gems/actionpack-3.0.5/lib/abstract_controller/base.rb:150:in `send_action'
# /Users/revelation/.rvm/gems/rub
View gist:871136
class ActivityMailer < ActionMailer::Base
def reply(comment, deliver_to_user)
@comment = comment
mail(:subject => I18n.t(:'activity_mailer.subject', :project_name =>, :activity_name => response.activity.short_name),
:from => "",
:to =>
def message(app_message)
View gist:834611
ln -s ~/.dotfiles/.profile ~/.profile
ln -s ~/.dotfiles/.bash_profile ~/.bash_profile
ln -s ~/.dotfiles/.bashrc ~/.bashrc
ln -s ~/.dotfiles/.ackrc ~/.ackrc
ln -s ~/.dotfiles/.gemrc ~/.gemrc
ln -s ~/.dotfiles/.gitconfig ~/.gitconfig
ln -s ~/.dotfiles/.gitshrc ~/.gitshrc
ln -s ~/.dotfiles/.irbrc ~/.irbrc
ln -s ~/.dotfiles/.rdebugrc ~/.rdebugrc
View gist:415474
#!/usr/bin/env ruby
# Simple executable wrapper for Surrender's server/client dispatching
this_file = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
bin_dir = File.dirname this_file
exec_file = File.join bin_dir, '..', 'surrender.rb'
args = ARGV.join ' '
exec "ruby #{exec_file} #{args}"
View gist:393757
class Grid < ActiveRecord::Base
has_many :rows
has_many :columns
has_many :cells, :through => :rows
accepts_nested_attributes_for :rows,
:allow_destroy => true,
:reject_if => lambda {|a| a[:description].blank? }
accepts_nested_attributes_for :columns,
:allow_destroy => true,
View gist:345406
require 'formula'
require 'hardware'
class Postgresql < Formula
depends_on 'readline'
depends_on 'libxml2' if MACOS_VERSION < 10.6 #system libxml is too old
View gist:336922
namespace :parallel do
def lib_path
File.join(File.dirname(__FILE__), '../../', 'vendor/gems/parallel_tests-0.3.2/')
def run_in_parallel(cmd, options)
count = (options[:count] ? options[:count].to_i : nil)
system "#{File.join(lib_path, 'bin', 'parallel_test')} --exec '#{cmd}' -n #{count}"