Skip to content

Instantly share code, notes, and snippets.

James Thornton espeed

Block or report user

Report or block espeed

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@espeed
espeed / gist:8747309
Created Feb 1, 2014
clojure/pedestal war error in jetty container
View gist:8747309
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
@espeed
espeed / gist:10725793
Last active Aug 29, 2015
Bulbs-Rexster Unicode Lookup via Gremlin
View gist:10725793
# 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 / keybase.md
Created May 15, 2014
Keybase proof
View keybase.md

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 / nltk-trainer-sklearn.MultinomialNB.py
Created Jul 27, 2015
Python NLTK Trainer sklearn.MultinomialNB example
View nltk-trainer-sklearn.MultinomialNB.py
$ 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'
View nltk-trainer-ngram-classifier-example-timed.py
import timeit
import pickle
import nltk.data
from nltk.util import ngrams
t0 = timeit.default_timer()
View gist:1020196
From ce55883e1009c70108bd7503e89c896bb8838fe1 Mon Sep 17 00:00:00 2001
From: James Thornton <james@jamesthornton.com>
Date: Fri, 10 Jun 2011 21:44:19 -0500
Subject: [PATCH] Setting self.body to None breaks oauth2/init.py line 493.
Changed the body default from None to empty string.
---
flaskext/oauth.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
@espeed
espeed / redis.groovy
Created Aug 23, 2011
Talk to Redis while you walk Gremlin
View redis.groovy
// Talk to Redis while you walk Gremlin
// by James Thornton, http://jamesthornton.com
import redis.clients.jedis.*;
Jedis jedis = new Jedis("localhost");
g = TinkerGraphFactory.createTinkerGraph();
talk2redis = {
@espeed
espeed / neo4j_jython.py
Created Aug 23, 2011
Neo4j Jython Example
View neo4j_jython.py
# Neo4j Jython Example
# by James Thornton, http://jamesthornton.com
from org.neo4j.kernel import EmbeddedGraphDatabase
from org.neo4j.kernel import Config
from org.neo4j.graphdb import DynamicRelationshipType
class Database(object):
def __init__(self,path,config=None):
View gist:1170000
I have a recursive Python function that builds a tree, and I'm trying to translate it into Groovy.
Here's the Python version...
def get_tree(vertices):
results = []
if type(vertices) != list:
vertices = [vertices]
@espeed
espeed / gist:1170115
Created Aug 25, 2011
Rebuild a graph's vertices index form Gremlin
View gist:1170115
// Rebuild a graph's vertices index from Gremlin
gremlin> g = TinkerGraphFactory.createTinkerGraph()
gremlin> index = g.getIndex('vertices',Vertex)
gremlin> AutomaticIndexHelper.reIndexElements(g, index, g.getVertices())
You can’t perform that action at this time.