Skip to content

Instantly share code, notes, and snippets.

@espeed
espeed / onename-jamesthornton.txt
Created October 25, 2015 15:49
Verifying that +jamesthornton is my blockchain ID. https://onename.com/jamesthornton
Verifying that +jamesthornton is my blockchain ID. https://onename.com/jamesthornton
@espeed
espeed / Onename espeed
Created October 22, 2015 16:32
Verifying that +espeed is my blockchain ID. https://onename.com/espeed
Verifying that +espeed is my blockchain ID. https://onename.com/espeed
@espeed
espeed / output
Created September 30, 2015 02:13
NLTK Trainer NaiveBayes classifier example with most-informative features
python ./nltk-trainer/train_classifier.py ./data/googleNews --instances files --fraction 0.75 --min_score 2 --ngrams 1 2 3 --show-most-informative 10 --classifier NaiveBayes
loading ./data/googleNews
2 labels: ['neg', 'pos']
calculating word scores
using bag of words from known set feature extraction
1682507 words meet min_score and/or max_feats
37116 training feats, 12371 testing feats
training NaiveBayes classifier
accuracy: 0.582815
neg precision: 0.659028
import timeit
import pickle
import nltk.data
from nltk.util import ngrams
t0 = timeit.default_timer()
@espeed
espeed / nltk-trainer-sklearn.MultinomialNB.py
Created July 27, 2015 03:24
Python NLTK Trainer sklearn.MultinomialNB example
$ python
Python 2.7.10 (default, Jul 5 2015, 14:15:43)
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>> scipy.__version__
'0.14.1'
>>> import numpy
>>> numpy.__version__
'1.9.2'
@espeed
espeed / png-to-ico.sh
Created November 2, 2014 20:13
ImageMagick command to convert PNG file to transparent favicon.ico
convert app-icon.png
\( -clone 0 -resize 16x16 \)
\( -clone 0 -resize 32x32 \)
\( -clone 0 -resize 48x48 \)
\( -clone 0 -resize 64x64 \)
-delete 0 -alpha on -background transparent favicon.ico
@espeed
espeed / keybase.md
Created May 15, 2014 14:14
Keybase proof

Keybase proof

I hereby claim:

  • I am espeed on github.
  • I am espeed (https://keybase.io/espeed) on keybase.
  • I have a public key whose fingerprint is 757D F83C 81EA 39D3 7FF8 CFFD 5D24 8053 C813 A32C

To claim this, I am signing this object:

@espeed
espeed / fbme.py
Last active May 20, 2019 09:36
Facebook Graph API Example in Python
# Facebook Graph API Example in Python
# by James Thornton, http://jamesthornton.com
# Facebook API Docs
# https://developers.facebook.com/docs/graph-api/using-graph-api#reading
# Get Your Facebook Access Token Here...
# https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=me
# Before running this script...
@espeed
espeed / gist:10725793
Last active August 29, 2015 13:59
Bulbs-Rexster Unicode Lookup via Gremlin
# The vertex is created and indexed via a Gremlin script...
>>> name = 'Universit\u00e9 de Montr\u00e9al'
>>> g.university.create(name=name)
POST url: http://localhost:8182/graphs/emptygraph/tp/gremlin
POST body: {"params":{"keys":null,"index_name":"university","data":{"element_type":"university","name":"Universit\u00e9 de Montr\u00e9al"}},"script":"def createIndexedVertex = {\n vertex = g.addVertex()\n index = g.idx(index_name)\n for (entry in data.entrySet()) {\n if (entry.value == null) continue;\n vertex.setProperty(entry.key,entry.value)\n if (keys == null || keys.contains(entry.key))\n\tindex.put(entry.key,String.valueOf(entry.value),vertex)\n }\n return vertex\n }\n def transaction = { final Closure closure ->\n try {\n results = closure();\n g.commit();\n return results; \n } catch (e) {\n g.rollback();\n throw e;\n }\n }\n return transaction(createIndexedVertex);"}
<University: http://localhost:8182/graphs/emptygraph/vertices/0>
@espeed
espeed / gist:8747309
Created February 1, 2014 02:57
clojure/pedestal war error in jetty container
2014-01-31 20:43:25.513:INFO:oejs.Server:main: jetty-9.1.0.v20131115
2014-01-31 20:43:25.540:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/opt/packages/jetty-distribution-9.1.0.v20131115/webapps/] at interval 1
2014-01-31 20:43:30.345:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@56164f3a{/,file:/tmp/jetty-0.0.0.0-8080-root.war-_-any-3794872074681783862.dir/webapp/,AVAILABLE}{/root.war}
2014-01-31 20:43:30.369:INFO:oejs.ServerConnector:main: Started ServerConnector@af616b7{HTTP/1.1}{0.0.0.0:8080}
INFO io.pedestal.service.http - {:line 64, :msg "GET /"}
ERROR i.p.s.http.impl.servlet-interceptor - {:line 261, :msg "error-ring-response triggered", :context {:io.pedestal.service.impl.interceptor/stack (#io.pedestal.service.impl.interceptor.Interceptor{:name :io.pedestal.service.http.impl.servlet-interceptor/stylobate, :enter #<servlet_interceptor$enter_stylobate io.pedestal.service.http.impl.servlet_interceptor$enter_stylobate@43b23922>, :leave #<servlet_interceptor$leave_styloba