Skip to content

Instantly share code, notes, and snippets.

View hannahherbig's full-sized avatar

Hannah Herbig hannahherbig

View GitHub Profile
@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;
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 / 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
var events;
events = require('
Obj events
Key EventEmitter');
require 'bigdecimal'
max = min = count = start = last = bank = nil
$<.each_line do |line|
line.strip!
case line
when /^Starting with BANK of (.+) BTC$/
start = last = bank = BigDecimal.new($1)
count = 0
max = BigDecimal.new(-1) / 0
@hannahherbig
hannahherbig / index.js
Created May 15, 2014 18:20
requirebin sketch
var console = require('demo-console')
process.nextTick(function () {
console.log('hi')
})
@hannahherbig
hannahherbig / upload.sh
Created August 30, 2016 07:37
script to render, mux, and upload osu replay video thingies to yt
PATHNAME="songs/kokou"
TITLE='50 replays - Yousei Teikoku - Kokou no Sousei [Chaos]'
MAP="https://osu.ppy.sh/b/118068&m=0"
BASENAME="$(basename $PATHNAME)"
MP3=($PATHNAME/*.mp3)
python multi_image.py "$PATHNAME" && \
ffmpeg -framerate 60 -i "out/$BASENAME-%05d.png" -i "$MP3" -map 0:v:0 -map 1:a:0 -c copy "$BASENAME.avi" && \
youtube-upload "$BASENAME.avi" -t "$TITLE" -d "map: $MAP\nsoource: https://github.com/andrew12/osr-stuff"
@hannahherbig
hannahherbig / np.py
Created September 9, 2016 05:47
write currently playing song in osu to a file - this code sucks though so don't use it
import ctypes
import time
import re
RE_TITLE = re.compile(r'''^osu\![^\-]+\-\s+(.+)$''')
user32 = ctypes.windll.user32
EnumWindows = user32.EnumWindows
EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool,
ctypes.POINTER(ctypes.c_int),
10 rupees
stick
lw escape
wess to kak
bottle
80 rupees
buy shield
dot skip
sw
import requests
import time
class API:
def __init__(self, key):
self.key = key
def get(self, path, **args):
if path == 'replay':
time.sleep(6)