Skip to content

Instantly share code, notes, and snippets.

Chris Klaiber chrisklaiber

  • Khan Academy
Block or report user

Report or block chrisklaiber

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
@chrisklaiber
chrisklaiber / SimpleHTTPServer6.py
Created Feb 15, 2018
Python SimpleHTTPServer over IPv6. Run as `python -m SimpleHTTPServer6 [PORT]`
View SimpleHTTPServer6.py
import BaseHTTPServer
import SimpleHTTPServer
import socket
class HTTPServer6(BaseHTTPServer.HTTPServer):
address_family = socket.AF_INET6
if __name__ == '__main__':
@chrisklaiber
chrisklaiber / namedmap.py
Last active Sep 16, 2016
namedmap and tuplemap: quacks like a dict, has the memory footprint of a tuple (eh, good enough)
View namedmap.py
"""A space-efficient frozen (write-once) mapping class.
A named map has two key properties:
1. The interface is like a dict.
2. Memory usage is like an object that defines __slots__.
Call namedmap.frozennamedmap() to define a subclass, passing the name
of the type and an iterable of key names.
@chrisklaiber
chrisklaiber / WebPageTest.org Analysis Scaffold.ipynb
Last active Aug 29, 2015
Analyzing Deferred JavaScript with WebPageTest.org
View WebPageTest.org Analysis Scaffold.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chrisklaiber
chrisklaiber / image_to_cs.py
Created Aug 30, 2012
Convert an image to drawing instructions
View image_to_cs.py
"""
Convert an image to drawing instructions.
Dependencies:
* PIL, the Python Imaging Library
This basically write color values for each pixel, with minor cleverness to
reduce output size:
You can’t perform that action at this time.