Skip to content

Instantly share code, notes, and snippets.

Ed Summers edsu

Block or report user

Report or block edsu

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
View gist:34332
import rdflib
FOAF = rdflib.Namespace('http://xmlns.com/foaf/0.1/')
g = rdflib.ConjunctiveGraph()
g.parse('http://inkdroid.org/ehs')
for t in g.triples((None, FOAF['jabberID'], None)):
print t
View gist:34334
import rdflib
FOAF = rdflib.Namespace('http://xmlns.com/foaf/0.1/')
g = rdflib.ConjunctiveGraph()
g.parse('http://inkdroid.org/ehs')
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()
g.parse('http://purl.org/ontology/bibo/')
View views.py
#@cache_page(86400)
def page_pdf(request, lccn, date, edition, sequence):
title = get_object_or_404(models.Title, lccn=lccn)
_year, _month, _day = date.split("-")
try:
_date = datetime.date(int(_year), int(_month), int(_day))
except ValueError, e:
raise Http404
try:
issue = title.issues.get(date_issued=_date, edition=edition)
View dcmi-mods-download.py
#!/usr/bin/env python
import os
for i in range(1,29):
u = "http://dcmi-rda.s3.amazonaws.com/locdata/part%02i-marcxml.tar.gz" % 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
edsu / rdf_json.py
Created Mar 10, 2009
convert an rdflib graph to json using talis flavored json
View rdf_json.py
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:
http://n2.talis.com/wiki/RDF_JSON_Specification
"""
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;
this.box = new Box(0, 0, dimensions.width, dimensions.height);
- this.source = pagePath + "/image_" + + this.box.width + "x" + this.box.height + "_from_" + fullBox.x + "," + fullBox.y + "_to_" + fullBox.getX2() + "," + fullBox.getY2() + ".jpg";
View gist:95276
ed@hammer:~$ curl -i http://realtech.burningbird.net/web/browsers/browser-more-script
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=/; domain=.realtech.burningbird.net
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.