Skip to content

Instantly share code, notes, and snippets.

View lbjay's full-sized avatar

Jay Luker lbjay

View GitHub Profile
jluker@adsx:~> 12:32:49 5001 $ free -g
total used free shared buffers cached
Mem: 141 1 140 0 0 0
-/+ buffers/cache: 0 141
Swap: 195 0 195
@lbjay
lbjay / bitset_facet_query.py
Created February 1, 2011 19:01
script for testing facet queries using a compressed bitset
import sys
import urllib2
from invenio import intbitset
from optparse import OptionParser
import simplejson
import mimetools
if __name__ == '__main__':
op = OptionParser()
157.23412 = (MATCH) boost(+body_syn:anagular +body_syn:diamater +body_syn:deredshifted,sum(product(float(cite_read_boost),const(5.0)),const(1.0))), product of:
45.160004 = (MATCH) sum of:
4.0087123 = (MATCH) weight(body_syn:anagular in 392299), product of:
0.4573753 = queryWeight(body_syn:anagular), product of:
2.3424382 = idf(docFreq=163755, maxDocs=626918)
0.19525607 = queryNorm
8.764602 = (MATCH) fieldWeight(body_syn:anagular in 392299), product of:
3.7416575 = tf(termFreq(body_syn:anagular)=14)
2.3424382 = idf(docFreq=163755, maxDocs=626918)
1.0 = fieldNorm(field=body_syn, doc=392299)
\documentclass[%
reprint,
%superscriptaddress,
%groupedaddress,
%unsortedaddress,
%runinaddress,
%frontmatterverbose,
%preprint,
showpacs,preprintnumbers,
nofootinbib,
@lbjay
lbjay / gist:970705
Created May 13, 2011 15:11
return items from a list 2-at-a-time as 2-item tuples
def group(iterator, count):
itr = iter(iterator)
while True:
yield tuple([itr.next() for i in range(count)])
@lbjay
lbjay / gitd alias
Created July 22, 2011 13:39
list branches based on modtime
Have you wished you could see your branches listed by how recently you
worked on them? I often do. I get lazy and end up with a lot of things
called 'test1...N' or sometimes when I'm working with other people, I
lose track of which branch is their version of a thing and which is my
version.
This handy shell alias (stick it in your ~/.bashrc) can help. Thanks Jan!
{{{
alias gitd='git for-each-ref --format="%(committerdate:short):
@lbjay
lbjay / gist:1113980
Created July 29, 2011 14:57
unittest_invenio.py output
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/lib64/python2.4/site.pyc matches /usr/lib64/python2.4/site.py
import site # precompiled from /usr/lib64/python2.4/site.pyc
# /usr/lib64/python2.4/os.pyc matches /usr/lib64/python2.4/os.py
import os # precompiled from /usr/lib64/python2.4/os.pyc
import posix # builtin
# /usr/lib64/python2.4/posixpath.pyc matches /usr/lib64/python2.4/posixpath.py
import posixpath # precompiled from /usr/lib64/python2.4/posixpath.pyc
INFO 2011-10-27T12:53:03 supybot horatio called by "anarchivist!~anarchivi@unaffiliated/anarchivist".
ERROR 2011-10-27T12:53:03 supybot Uncaught exception in ['horatio'].
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/supybot/callbacks.py", line 1180, in _callCommand
self.callCommand(command, irc, msg, *args, **kwargs)
File "/usr/lib/pymodules/python2.6/supybot/utils/python.py", line 86, in g
f(self, *args, **kwargs)
File "/usr/lib/pymodules/python2.6/supybot/callbacks.py", line 1166, in callCommand
method(irc, msg, *args, **kwargs)
File "/home/zoia/supybot/supybot-plugins/plugins/Translators/plugin.py", line 312, in horatio
@lbjay
lbjay / gist:1320843
Created October 27, 2011 20:56
fails
import junit.framework.TestCase;
public class TestSanity extends TestCase {
public void testMatch() {
assertTrue("FOOBAR".matches("FOO"));
}
}
import urllib2
from invenio import intbitset
import simplejson
import mimetools
def get_facets(bitset, solr_url):
facet_query_url = "%s/invenio_facets" % solr_url
# now use the bitset to fetch the facet data