Skip to content

Instantly share code, notes, and snippets.

@terrycojones
terrycojones / c
Created March 18, 2011 03:01
A shell function for changing directories
#
# c - bash directory changing functions that maintain a
# most-recently used stack.
#
# Run with -help as an argument to see invocation options, or find the
# d_usage function below.
#
# To use these functions, store this in a file someplace and
# then execute
#
anonymous
anonymous / simplegeo-context-neighborhoods-by-city.py
Created July 5, 2011 22:54
Find all neighborhoods in a given city, by address
>>> import simplegeo
>>> from itertools import ifilter
>>> client = simplegeo.context.Client('your-key','your-secret')
>>> location = client.get_context_by_address("41 Decatur St, San Francisco, CA")
# Find the bounding box of your current city
>>> sf = next(ifilter(lambda feature: feature['classifiers'][0]['category'] == 'Administrative', location['features']), None)
>>> hoods = client.get_features_from_bbox(sf['bounds'], features__category='Neighborhood')
@mynameisfiber
mynameisfiber / quick_kmin_hash.py
Last active December 14, 2015 01:19
This is a quick kmaxhash implemintation to test out the usefulness of this datastructure for calculating jaccard metrics. It is quick because I wrote it quickly :)
#!/usr/bin/env python2.7
#
# This is a quick kmaxhash implemintation to test out the usefulness of this
# datastructure for calculating jaccard metrics. It is quick because I wrote
# it quickly :)
# micha gorelick, [email protected]
#
import mmh3
import heapq
@mynameisfiber
mynameisfiber / neighborhoods.json
Created August 13, 2014 15:16
Centroids for neighborhoods in Manhattan
[
{
"name": "Lower East Side",
"center": [
-73.9836180698,
40.7155233255
]
},
{
"name": "Marble Hill",