Skip to content

Instantly share code, notes, and snippets.

Avatar

Bob Lannon boblannon

View GitHub Profile
View omnihash.py
def omnihash(obj):
""" recursively hash unhashable objects """
if isinstance(obj, set):
return hash(frozenset(omnihash(e) for e in obj))
elif isinstance(obj, (tuple, list)):
return hash(tuple(omnihash(e) for e in obj))
elif isinstance(obj, dict):
return hash(frozenset((k, omnihash(v)) for k, v in obj.items()))
else:
return hash(obj)
View jenks2.py
import json
from pprint import pprint as pp
def jenks_matrices_init(data, n_classes):
#fill the matrices with data+1 arrays of n_classes 0s
lower_class_limits = []
variance_combinations = []
for i in xrange(0, len(data)+1):
temp1 = []
temp2 = []
@boblannon
boblannon / sfcom_55289_pres-iframe.html
Created Oct 22, 2013
HTML code to embed the 'Contribution Share by Major Political Party' map from "Political influence by county: A new way to look at campaign finance data" http://sunlightfoundation.com/blog/?p=55289
View sfcom_55289_pres-iframe.html
<iframe src="http://assets.sunlightfoundation.com.s3.amazonaws.com/blog/azavea_maps/pres.html" height="703" width="650"></iframe>
@boblannon
boblannon / sfcom_55289_indep-iframe.html
Created Oct 22, 2013
HTML code to embed the 'Third-party presidential giving' map from "Political influence by county: A new way to look at campaign finance data" http://sunlightfoundation.com/blog/?p=55289
View sfcom_55289_indep-iframe.html
<iframe src="http://assets.sunlightfoundation.com.s3.amazonaws.com/blog/azavea_maps/indep.html" height="653" width="650"></iframe>
@boblannon
boblannon / sfcom_55289_pop-iframe.html
Created Oct 22, 2013
HTML code to embed the 'Contributions Per Capita in Each County' map from "Political influence by county: A new way to look at campaign finance data" http://sunlightfoundation.com/blog/?p=55289
View sfcom_55289_pop-iframe.html
<iframe src="http://assets.sunlightfoundation.com.s3.amazonaws.com/blog/azavea_maps/pop.html" height="703" width="650"></iframe>
@boblannon
boblannon / sfcom_55289_total-iframe.html
Created Oct 22, 2013
HTML code to embed the 'Total Contributions From Individuals Over Time' map from "Political influence by county: A new way to look at campaign finance data" http://sunlightfoundation.com/blog/?p=55289
View sfcom_55289_total-iframe.html
<div style="overflow: hidden;"><iframe src="http://assets.sunlightfoundation.com.s3.amazonaws.com/blog/azavea_maps/total.html" height="703" width="650"></iframe></div>
View iterm_tab_title.sh
function tabtitle(){
REPO_NAME=`git rev-parse --show-toplevel 2> /dev/null | awk -F'/' '{print $NF}'`;
if [ -z "$REPO_NAME" ]
then
echo ""
else
echo "[$REPO_NAME] "
fi
}
if [ $ITERM_SESSION_ID ]; then
View PyniniIOTest-fail.txt
$ pytest -v -k PyniniIOTest
======================================================================= test session starts ========================================================================
platform darwin -- Python 2.7.14, pytest-3.5.0, py-1.5.3, pluggy-0.6.0 -- /Users/bob/analyze/geocoding_307_vocab-graph/env/bin/python2.7
cachedir: .pytest_cache
rootdir: /Users/bob/analyze/geocoding_307_vocab-graph/Pynini, inifile:
collected 158 items / 154 deselected
pynini_test.py::PyniniIOTest::testFileIO FAILED [ 25%]
pynini_test.py::PyniniIOTest::testGarbageReadRaisesFstIOError PASSED [ 50%]
pynini_test.py::PyniniIOTest::testPickleIO FAILED [ 75%]
@boblannon
boblannon / alliteration_bot.ipynb
Last active Apr 12, 2018
alliterative_android.ipynb
View alliteration_bot.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.