Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am EmilHernvall on github.
  • I am aderyn ( on keybase.
  • I have a public key whose fingerprint is 5B7E 106F 7A1F B3B2 8236 78E1 398A 0566 9E87 493F

To claim this, I am signing this object:

Install twisted (pip install twisted) and PIL (pip install PIL), and run the script.
On your gateway, run the following commands:
iptables -t nat -A PREROUTING -i br0 -s ! -p tcp --dport 80 -j DNAT --to
iptables -t nat -A POSTROUTING -o br0 -s -d -j SNAT --to
iptables -A FORWARD -s -d -i br0 -o br0 -p tcp --dport 8080 -j ACCEPT
Substitute for the computer running the proxy.
import boto.route53
import os
import sys
import urllib2
import time
def get_zone_id(r53, zone_name):
zone_result = r53.get_hosted_zone_by_name(zone_name)
if not zone_result:
View gist:2332678
import urllib2
import re
import base64
def searchForNext(str, unique):
d = 10
last = str[-d:]
print "searching for continuation of " + last
matches = []
for x in unique:
class GlobalFormat(object):
def __init__(self): = 0x46464952 # RIFF
self.size = 0
self.type = 0x45564157 # WAVE
def as_bin(self):
return struct.pack("III",, self.size, self.type)
View sudoku.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct grid_t_ {
unsigned int grid[81];
struct grid_t_ *next;
} grid_t;
typedef struct sub_t_ {
package net.quenchnetworks.panthera.feedimport.util;
import java.util.*;
import java.sql.*;
public class LoggingConnection implements Connection
public static class LogEntry
public String sql;
View diff.php
* Calculate differences between two dates with precise semantics. Based on PHPs DateTime::diff()
* implementation by Derick Rethans. Ported to PHP by Emil H, 2011-05-02. No rights reserved.
* See here for original code:
View vector.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vector.h"
void vector_init(vector *v)
v->data = NULL;
v->size = 0;
#, by, 2009-03-01
# decoder for .BIG-format files utilized by Red Alert 3 and C&C: Zero Hours
# among others. .big is a trivial archival format. quite frankly, this is
# probably the simplest compound file format imaginable.
# this script is written for microsoft windows. it can probably be easily
# adapted for other platforms, but i haven't tried.
# file structure: