Skip to content

Instantly share code, notes, and snippets.

View tdierks's full-sized avatar

Tim Dierks tdierks

  • Gowanus Watershed, Brooklyn, NY, USA
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from operator import mul, add, sub, truediv
from itertools import product, permutations
ops = [
[ mul, "{a} x {b}" ],
[ add, "{a} + {b}" ],
[ sub, "{a} - {b}" ],
[ lambda a, b: sub(b, a), "{b} - {a}" ],
[ truediv, "{a} / {b}" ],
[ lambda a, b: truediv(b, a), "{b} / {a}" ],
@tdierks
tdierks / modem-speed.py
Created November 28, 2017 18:23
A python script to emulate the bandwidth of a modem at certain speed.
#!/usr/bin/python -u
# Use: modem-speed.py [baud, default 1200]
import sys
from time import sleep
baud = len(sys.argv) > 1 and int(sys.argv[1]) or 1200
cps = baud/10.0 # 10 baud per octet at 8n1
while True:
# coding: utf-8
# In[76]:
from collections import defaultdict
merge_cities = {
'NYC': ['EWR', 'JFK', 'LGA'],
}