Skip to content

Instantly share code, notes, and snippets.

View hannahherbig's full-sized avatar

Hannah Herbig hannahherbig

  • Brooklyn, NY
  • 11:57 (UTC -04:00)
View GitHub Profile
@hannahherbig
hannahherbig / tracker.rb
Created January 24, 2013 05:32
a dead simple torrent tracker in ruby
require 'bencode'
require 'sinatra'
torrents = {}
get '/announce' do
compact = (params[:compact] || '1') == '1'
no_peer_id = params[:no_peer_id] == '1'
event = params[:event] || 'empty'
numwant = (request[:numwant] || 50).to_i
So recently the Louvre was rid of some of its most prized possessions. This brilliant thief managed to break in, remove several paintings, escape, and load them into his van without setting off a single alarm. Fortunately, the criminal was caught a few miles down the road, with his vehicle unable to move.
When the police questioned him about how he could mastermind a brilliant heist, yet forget to put fuel in his van, the thief responded, "You see, I did not have the Monet to buy Degas to make the Van Gogh."
@hannahherbig
hannahherbig / gist:3335438
Created August 12, 2012 23:45
parsing an irc message into a struct
#include <stdio.h>
#include <string.h>
typedef struct {
char* origin;
char* command;
char* parv[15];
int parc;
} msg_t;
@hannahherbig
hannahherbig / gist:3164717
Created July 23, 2012 16:59
my autoexec.cfg for cs:s
cl_ragdoll_physics_enable 0
alias _voice_toggle _voice_on
alias _voice_on "alias _voice_toggle _voice_off; +voicerecord"
alias _voice_off "alias _voice_toggle _voice_on; -voicerecord"
alias _demo_pause_toggle _demo_pause_on
alias _demo_pause_on "alias _demo_pause_toggle _demo_pause_off; demo_pause"
alias _demo_pause_off "alias _demo_pause_toggle _demo_pause_on; demo_resume"
shot() {
for file in "/Users/andrew/Desktop/Screen Shot"*
do
hash=`shasum $file | awk '{ print $1 }'`
new="$hash.png"
mv $file "/Users/andrew/Dropbox/Public/files/$hash.png"
echo "$file => http://dl.dropbox.com/u/5489165/files/$hash.png"
done
}
@hannahherbig
hannahherbig / life.rb
Created April 20, 2012 05:49
conway's game of life
# conway's game of life
col = 50
row = 50
# set this up however you want, i like randomness.
env = col.times.map { row.times.map { 0 == rand(2) } }
loop do
puts "-" * col
%ul
%li dick1
%li dick2
source :rubygems
gem 'foreman'
gem 'stalker'
gem 'clockwork'
@hannahherbig
hannahherbig / parse.coffee
Created December 22, 2011 23:10
irc parser
module.exports = parse = (str) ->
origin = null
command = null
args = []
# pull out the origin if there is one
if str[0] is ':'
i = str.indexOf ' '
origin = str.slice 1, i
str = str.slice i + 1
irc = require 'irc'
twitter = require 'ntwitter'
bot = new irc.Client 'irc.mcintec.net', 'node',
channels: ['#twitter']
twit = new twitter
consumer_key: ''
consumer_secret: ''
access_token_key: ''