Skip to content

Instantly share code, notes, and snippets.

View JordanMilne's full-sized avatar

Jordan Milne JordanMilne

View GitHub Profile
baz
AGOOTTESTINGSTRING1
foo
aesKeyStringFOOBARBAZQUUXquuxy
aaaa
aesKeyStringFOOBAR
@JordanMilne
JordanMilne / cookie_jar_tests.json
Created September 14, 2015 18:01
Comparing the cookie parsing behaviours of various HTTP services
@JordanMilne
JordanMilne / go-1.3.3.txt
Last active September 13, 2015 22:00
URL parsing changes from Go 1.3.3 to 1.5.1
Original: http://example.com/foo/%2F/bar
Scheme: http
Hostname: example.com
Path: /foo///bar
Unparsed: http://example.com/foo///bar
Original: http%3A/%2Fexample.com/baz
Scheme:
Hostname:
Path: http://example.com/baz
>>> urlparse.urljoin("https://base.example.org/", "/foobar")
'https://base.example.org/foobar'
>>> urlparse.urljoin("https://base.example.org/", "//foobar")
'https://foobar'
flashpolicyd runs the policy server that tells flash it can access the port for our echo server.
term_echo_server just logs whatever it receives to the console.
both are python2 and flashpolicyd must run as root unless you have some other way of binding to low ports.
@JordanMilne
JordanMilne / gist:17e413fafb3673f9b64a
Last active August 29, 2015 14:26
urllib3's URL parser makes me sad :(
>>> def compare_parse(url):
... from urllib3.util.url import parse_url
... import urlparse
... print "urlparse:", repr(urlparse.urlparse(url))
... print "urllib3:", repr(parse_url(url))
...
>>> compare_parse("//foo:a@google.com/")
urlparse: ParseResult(scheme='', netloc='foo:a@google.com', path='/', params='', query='', fragment='')
urllib3: Url(scheme=None, auth=None, host=None, port=None, path='//foo:a@google.com/', query=None, fragment=None)
@JordanMilne
JordanMilne / find-broken.sh
Created November 4, 2014 21:20
Horrible scripts to make JD's output recompileable (for Spiral Knights, circa 2011. I'm not allowed regexes anymore.)
#!/bin/bash
#find possibly broken source files that will need to be manually fixed
( \
find ../code -type f -iname "*.java" -print0 | xargs --null grep -l '// Byte code:' && \
find ../code -type f -iname "*.java" -size 0 \
) | uniq
@JordanMilne
JordanMilne / gist:04c161a5b66a087619ed
Created October 28, 2014 18:05
Support HTTPS forcing in PRAW 2
import praw
from functools import wraps
def init_wrapper(func):
@wraps(func)
def func_wrapper(*args, **kwargs):
ret = func(*args, **kwargs)
if ret:
ret._site_url = ret._site_url.replace('http:', 'https:')
ret._short_domain = ret._site_url.replace('http:', 'https:')