Skip to content

Instantly share code, notes, and snippets.

View sweenzor's full-sized avatar

Matt Sweeney sweenzor

View GitHub Profile
@sweenzor
sweenzor / gist:2933958
Created June 15, 2012 00:52
Kill all celery tasks (redis)
# nuke the queue
redis-cli FLUSHALL
# nuke anything currently running
pkill -9 celeryd
@sweenzor
sweenzor / cmds
Created June 15, 2012 18:42
SSH Config for Github
# add the key
ssh-add ~/.ssh/me_rsa
@sweenzor
sweenzor / generate_geojson.py
Created July 9, 2012 02:33 — forked from ZJONSSON/index.html
D3 + Leaflet
#!/usr/bin/env python
import random
f = open('us-states.json', 'w')
f.write("""{"type":"FeatureCollection","features":[\n""")
lat = 35.0
lng = -87.3
@sweenzor
sweenzor / getunique.py
Created August 28, 2012 05:56
Filter lists in python
#!/usr/bin/env python
from itertools import imap, groupby
from operator import itemgetter
def _unique_justseen(iterable, key=None):
"""List unique elements, preserving order.
Remember only the element just seen."""
@sweenzor
sweenzor / unique_dict_filtering.py
Created September 26, 2012 03:34
Remove non-unique items from a dictionary, defining uniqueness only between a subset of keys
#!/usr/bin/env python
from itertools import imap, groupby
from operator import itemgetter
def unique_justseen(iterable, key=None):
"""List unique elements, preserving order.
Remember only the element just seen."""
@sweenzor
sweenzor / gist:5051147
Last active December 14, 2015 07:29
POST json file to endpoint using curl
curl -i -H "Accept: application/json" -H "Content-type: application/json" --data @test.json http://localhost:5033/match
@sweenzor
sweenzor / epochtime.py
Created March 28, 2013 19:09
Get the epoch time, (seconds since jan 1 1970) from a python datetime
import datetime
import time
# some datetime object
dt = datetime.datetime.now()
# get the seconds since epoch for that datetime
print time.mktime(dt.timetuple())
@sweenzor
sweenzor / bless_keypress.py
Last active December 16, 2015 00:59
Experimenting with curses
import blessings
term = blessings.Terminal()
def keypress():
with term.cbreak():
inp = term.inkey()
if inp.code == term.KEY_ENTER:
print 'hit enter'
@sweenzor
sweenzor / basic-leaflet.md
Last active October 22, 2016 04:39 — forked from sweenzor/generate_geojson.py
Most basic leaflet.js map posible

most basic of leaflet maps

basically the most basic of leaflet maps posible

basically

@sweenzor
sweenzor / test.geojson
Created June 15, 2013 00:08
Testing out geojson support
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.