Skip to content

Instantly share code, notes, and snippets.

View edsu's full-sized avatar

Ed Summers edsu

View GitHub Profile
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
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)
@edsu
edsu / properties
Created January 6, 2009 04:22
bibo.py
#!/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/')
#@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)
#!/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)
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
#!/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 March 10, 2009 04:36
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:
http://n2.talis.com/wiki/RDF_JSON_Specification
"""
json = {}
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";
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