Skip to content

Instantly share code, notes, and snippets.

View nhooey's full-sized avatar

Neil Hooey nhooey

  • Toronto, Ontario, Canada
View GitHub Profile
# Summary:
# Distances between a single beacon and two different gateways are sometimes identical.
# This makes no sense, since the beacon is slightly different distances from the gateway.
#
# This occurs when I subscribe to `/presence/stream/{GATEWAY_UNIQUE_ID}` for each gateway.
# It recurs as frequently as every 20 seconds, and infrequently as every 2 minutes, but it
# is easily reproducible.
#
# I suspect there is a bug in the Kontakt's server side of the API.
#
@nhooey
nhooey / profile.log
Created February 3, 2014 17:14
GitGutter profile
FUNCTION sign#find_current_signs()
Called 72 times
Total time: 0.073710
Self time: 0.073710
count total (s) self (s)
72 0.000987 let gitgutter_signs = {} " <line_number>: {'id': <id>, 'name': <name>}
72 0.000401 let other_signs = []
72 0.000545 redir => signs
@nhooey
nhooey / profile.log
Created January 23, 2014 21:36
GitGutter slow tab profile
FUNCTION sign#find_current_signs()
Called 95 times
Total time: 0.057338
Self time: 0.057338
count total (s) self (s)
95 0.001016 let gitgutter_signs = {} " <line_number>: {'id': <id>, 'name': <name>}
95 0.000441 let other_signs = []
95 0.000631 redir => signs
import sys
# Using OAuth1Session
from requests_oauthlib import OAuth1Session
if len(sys.argv) != 3:
print "Usage: %s <CLIENT_KEY> <CLIENT_SECRET>" % sys.argv[0]
sys.exit(1)
client_key = sys.argv[1]
@nhooey
nhooey / gist:5178616
Created March 16, 2013 22:33
json4s serialization error: could not find implicit value for parameter formats: org.json4s.Formats [error] val theJson = org.json4s.native.Serialization.write(Map("key" -> "value"))
package com.shutterstock.searchservice
import org.scalatra.test.scalatest._
import scala.Predef._
import org.scalatest._
import org.json4s.native.JsonMethods._
import org.json4s.native.Serialization.write
import org.json4s.{ DefaultFormats, Formats, ParserUtil }
import org.json4s.JsonDSL._
@nhooey
nhooey / PayloadQParser.java
Created May 13, 2011 21:26
cannot find symbol
package com.thing;
import org.apache.solr.search.QParser;
import org.apache.solr.search.SolrQueryParser;
import org.apache.solr.search.QueryParsing;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.params.CommonParams;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.search.Query;
@nhooey
nhooey / gist:956061
Created May 4, 2011 21:17
Multiple documents sent to Solr with JSON
$ curl http://dev:8983/solr/update/json -H 'Content-type:application/json' -d '{ "add": {
> "doc": { "uid": "monkey_1" },
> "doc": { "uid": "monkey_2" }
> } }'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 multiple docs in same add command
java.io.IOException: multiple docs in same add command