Skip to content

Instantly share code, notes, and snippets.


Ed Summers edsu

View GitHub Profile
View gist:34332
import rdflib
FOAF = rdflib.Namespace('')
g = rdflib.ConjunctiveGraph()
for t in g.triples((None, FOAF['jabberID'], None)):
print t
View gist:34334
import rdflib
FOAF = rdflib.Namespace('')
g = rdflib.ConjunctiveGraph()
for person, jabber_id in g.subject_objects(FOAF['jabberID']):
print "%s has jabber ID %s" % (person, jabber_id)
View properties
#!/usr/bin/env python
# awful hack to print out bibo classes, and the properties that hang off of
# them directly
import rdflib
g = rdflib.ConjunctiveGraph()
def page_pdf(request, lccn, date, edition, sequence):
title = get_object_or_404(models.Title, lccn=lccn)
_year, _month, _day = date.split("-")
_date =, int(_month), int(_day))
except ValueError, e:
raise Http404
issue = title.issues.get(date_issued=_date, edition=edition)
#!/usr/bin/env python
import os
for i in range(1,29):
u = "" % i
os.system("wget %s" % u)
View .htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^ehs$ ehs.rdf [R=303]
RewriteCond %{HTTP_ACCEPT} text/html [OR]
RewriteCond %{HTTP_ACCEPT} application/xml [OR]
RewriteCond %{HTTP_ACCEPT} text/xml [OR]
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
View gist:74007
#!/usr/bin/env python
# easy_install xlrd
import xlrd
book = xlrd.open_workbook('weekly.xls')
for sheet in book.sheets():
for rownum in range(sheet.nrows):
edsu /
Created Mar 10, 2009
convert an rdflib graph to json using talis flavored json
import simplejson
import rdflib
def json_for_graph(g):
Pass in a rdflib.Graph and get back a chunk of JSON using
the Talis JSON serialization for RDF:
json = {}
View titleviewer.js
esummers@terbium [/ndnp/chronam] $ svn diff chronam/static/javascript/tileviewer.js
Index: chronam/static/javascript/tileviewer.js
--- chronam/static/javascript/tileviewer.js (revision 6508)
+++ chronam/static/javascript/tileviewer.js (working copy)
@@ -805,7 +805,7 @@
this.img = null; = new Box(0, 0, dimensions.width, dimensions.height);
- this.source = pagePath + "/image_" + + + "x" + + "_from_" + fullBox.x + "," + fullBox.y + "_to_" + fullBox.getX2() + "," + fullBox.getY2() + ".jpg";
View gist:95276
ed@hammer:~$ curl -i
HTTP/1.1 404 Not Found
Date: Tue, 14 Apr 2009 16:32:49 GMT
Server: Apache
X-Powered-By: PHP/5.2.8
Set-Cookie: SESS481b63c69ea068f972035faf355a997d=4ae2286c21da584e4948eb819317cd58; expires=Thu, 07 May 2009 20:06:09 GMT; path=/;
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Tue, 14 Apr 2009 16:33:14 GMT
Cache-Control: store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
You can’t perform that action at this time.