Skip to content

Instantly share code, notes, and snippets.

Emil Hernvall EmilHernvall

Block or report user

Report or block EmilHernvall

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Test1-disassembled
Compiled from "Test1.java"
public class Test1 {
public Test1();
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String[]);
Code:
View premier_league_import.py
import json
import pymysql
import pymysql.cursors
import os
import csv
from datetime import datetime
with open("data/premier-league/schema.json") as fh:
schema = json.loads(fh.read())
fields = schema["fields"]
View ex1.py
# -*- coding: utf-8 -*-
def columns_to_county(foo):
county = {}
county["id"] = int(foo[0])
county["name"] = foo[1]
county["lon"] = float(foo[3])
county["lat"] = float(foo[4])
return county
View keybase.md

Keybase proof

I hereby claim:

  • I am emilhernvall on github.
  • I am aderyn (https://keybase.io/aderyn) on keybase.
  • I have a public key whose fingerprint is 8684 23E6 23E7 9338 7711 E0E1 5537 3432 E97B 576A

To claim this, I am signing this object:

View proof.md

Keybase proof

I hereby claim:

  • I am EmilHernvall on github.
  • I am aderyn (https://keybase.io/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:

@EmilHernvall
EmilHernvall / proxy.py
Last active Mar 8, 2018
Transparent proxy for rewriting web pages to include The Hoff
View proxy.py
"""
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 ! 192.168.0.20 -p tcp --dport 80 -j DNAT --to 192.168.0.20:8080
iptables -t nat -A POSTROUTING -o br0 -s 192.168.0.0/24 -d 192.168.0.20 -j SNAT --to 192.168.0.1
iptables -A FORWARD -s 192.168.0.0/24 -d 192.168.0.20 -i br0 -o br0 -p tcp --dport 8080 -j ACCEPT
Substitute 192.168.0.20 for the computer running the proxy.
"""
@EmilHernvall
EmilHernvall / route53_dyndns.py
Created Apr 10, 2013
Script for dynamically updating a route53 record when your external ip changes.
View route53_dyndns.py
#!/usr/bin/python
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:
@EmilHernvall
EmilHernvall / data2sound.py
Created Sep 29, 2011
Encode data as sound, and retrieve it using a FFT
View data2sound.py
class GlobalFormat(object):
def __init__(self):
self.id = 0x46464952 # RIFF
self.size = 0
self.type = 0x45564157 # WAVE
def as_bin(self):
return struct.pack("III", self.id, self.size, self.type)
@EmilHernvall
EmilHernvall / sudoku.c
Created Jun 24, 2011
sudoku solver written in c
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_ {
You can’t perform that action at this time.