Skip to content

Instantly share code, notes, and snippets.

View Lukasa's full-sized avatar

Cory Benfield Lukasa

View GitHub Profile
@Lukasa
Lukasa / test.py
Created August 15, 2016 10:41
Blue or Red?
from twisted.internet.protocol import Protocol
class PrinterProtocol(Protocol):
def connectionMade(self, transport):
self.transport = transport
self.response = b''
self.transport.write(
b'GET / HTTP/1.1\r\n'
b'Host: http2bin.org\r\n'
b'Connection: close\r\n'
@Lukasa
Lukasa / test.rst
Created March 23, 2016 10:37
RestructuredText Headings

First Level

Some text.

Second Level

Some text.

@Lukasa
Lukasa / notes.txt
Created March 9, 2016 13:28
Notes on draft-ietf-httpauth-extension-05
- Notes on draft-ietf-httpauth-extension-05
- Abstract
- “This document specifies a few extensions”
- The “a few” feels informal to me: consider removing.
- “fundamental features of HTTP-level authentication is not enough for complex”
- s/is not enough/are insufficient/
- “This makes these applications to implement"
- s/makes/forces/
- “user-agent clients”
- Are there non-user-agent clients? If not, remove “clients” and just use “user-agents”.
@Lukasa
Lukasa / README.md
Last active February 24, 2016 12:06
Validate certificates on Windows using Crypt32.dll

This file contains code for validating certificates using Window's Crypt32 API, rather than OpenSSL. It's intended to go hand-in-hand with my proposed changes to cryptography that will make these bindings accessible, and will later be productised in the certitude module.

@Lukasa
Lukasa / except.py
Created January 7, 2016 15:42
Raise works outside of except blocks
try:
[][-1]
except IndexError:
pass
raise
@Lukasa
Lukasa / onename.txt
Created October 24, 2015 08:24
OneName verification
Verifying that +lukasa is my blockchain ID. https://onename.com/lukasa
@Lukasa
Lukasa / error.txt
Created September 9, 2015 11:37
Hypothesis weird error
cory@corymbp:hyper-h2/ % tox -e py27 5d25507|twisted✓ [0m]
GLOB sdist-make: /Users/cory/Documents/Python/hyper-h2/setup.py
py27 inst-nodeps: /Users/cory/Documents/Python/hyper-h2/.tox/dist/h2-0.1.0.zip
py27 runtests: PYTHONHASHSEED='3864724170'
py27 runtests: commands[0] | py.test -n 4 --cov h2 /Users/cory/Documents/Python/hyper-h2/test/
============================= test session starts ==============================
platform darwin -- Python 2.7.10 -- py-1.4.30 -- pytest-2.7.2
rootdir: /Users/cory/Documents/Python/hyper-h2, inifile:
plugins: hypothesis-pytest, cov, xdist, xdist, xdist
gw0 [33] / gw1 [31] / gw2 [31] / gw3 [33]
@Lukasa
Lukasa / run.py
Created June 3, 2015 09:30
Generate images of GPG signatures
import getpass
import gnupg
from PIL import Image, ImageFont, ImageDraw
g = gnupg.GPG()
data = raw_input('Tweet: ')
passphrase = getpass.getpass('Passphrase: ')
@Lukasa
Lukasa / README.md
Created June 1, 2015 13:42
Basic Twisted HTTP/2 client.

Simple Twisted H2 Client

This gist contains a really stupid implementation of a Twisted HTTP/2 client. It opens a connection, uses ALPN/NPN to negotiate HTTP/2, and then sends a single HTTP/2 GET request to the /ip endpoint.

To execute this:

  1. Create a clean virtual environment.
  2. Install the requirements: pip install -r requirements.txt.
  3. Install the development version of Twisted that contains the nextProtocols code.
  4. Execute the code using python h2test.py.
@Lukasa
Lukasa / old_certs.pem
Created April 23, 2015 18:42
expired certificates
# Issuer: CN=Entrust.net Secure Server Certification Authority O=Entrust.net OU=www.entrust.net/CPS incorp. by ref. (limits liab.)/(c) 1999 Entrust.net Limited
# Subject: CN=Entrust.net Secure Server Certification Authority O=Entrust.net OU=www.entrust.net/CPS incorp. by ref. (limits liab.)/(c) 1999 Entrust.net Limited
# Label: "Entrust.net Secure Server CA"
# Serial: 927650371
# MD5 Fingerprint: df:f2:80:73:cc:f1:e6:61:73:fc:f5:42:e9:c5:7c:ee
# SHA1 Fingerprint: 99:a6:9b:e6:1a:fe:88:6b:4d:2b:82:00:7c:b8:54:fc:31:7e:15:39
# SHA256 Fingerprint: 62:f2:40:27:8c:56:4c:4d:d8:bf:7d:9d:4f:6f:36:6e:a8:94:d2:2f:5f:34:d9:89:a9:83:ac:ec:2f:ff:ed:50
# Issuer: CN=http://www.valicert.com/ O=ValiCert, Inc. OU=ValiCert Class 2 Policy Validation Authority
# Subject: CN=http://www.valicert.com/ O=ValiCert, Inc. OU=ValiCert Class 2 Policy Validation Authority