Skip to content

Instantly share code, notes, and snippets.

View wtolson's full-sized avatar

Trevor Olson wtolson

View GitHub Profile
@wtolson
wtolson / getmap.py
Created September 19, 2012 16:16
Quick script to find and download the non empty tiles for http://xkcd.com/1110/
import sys
import requests
def get_image(x, xdir, y, ydir):
name = '%s%s%s%s.png' % (x, xdir, y, ydir)
print 'Getting %s...' % name,
sys.stdout.flush()
url = 'http://imgs.xkcd.com/clickdrag/' + name
resp = requests.get(url)
@wtolson
wtolson / contact.js
Last active December 13, 2015 20:19
var trevor = {
"contact":
{
"email": "trevor@heytrevor.com",
"twitter": "@ZombieFeynman",
"google+": "heytrevor.com/+",
"github": "https://github.com/wtolson"
},
@wtolson
wtolson / pathlib - PEP 428.ipynb
Created March 21, 2014 00:44
Lightning talk: pathlib - PEP 428
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wtolson
wtolson / Nsq and Python.ipynb
Last active August 29, 2015 14:04
Nsq and Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wtolson
wtolson / Python Standard Library.ipynb
Last active August 29, 2015 14:10
10 overlooked Python Standard Library Modules
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import sys
from collections import Mapping, MutableMapping
from weakref import proxy
PY3 = sys.version_info[0] == 3
_dict_setitem = dict.__setitem__
_dict_getitem = dict.__getitem__
_dict_delitem = dict.__delitem__
@wtolson
wtolson / gnsq_setup.py
Created June 15, 2015 16:44
gnsq setup
import gnsq
class Worker(object):
def __init__(self, **config):
self.config = config
def handle_message(self, reader, message):
# Do something with config and message
pass

Keybase proof

I hereby claim:

To claim this, I am signing this object:

# -*- coding: utf-8 -*-
from __future__ import annotations
from collections import defaultdict
from collections.abc import Iterator, MutableMapping
from typing import Iterable, TypeGuard, TypeVar, overload
T = TypeVar("T")