Skip to content

Instantly share code, notes, and snippets.

View ldodds's full-sized avatar
🤓

Leigh Dodds ldodds

🤓
View GitHub Profile
require 'rubygems'
require 'open-uri'
require 'json'
SEARCH = "(collection:prelinger+OR+mediatype:prelinger)+AND+-mediatype:collection"
ALL_FIELDS = "&fl[]=avg_rating&fl[]=call_number&fl[]=collection&fl[]=contributor&fl[]=coverage&fl[]=creator&fl[]=date&fl[]=description&fl[]=downloads&fl[]=foldoutcount&fl[]=format&fl[]=headerImage&fl[]=identifier&fl[]=imagecount&fl[]=language&fl[]=licenseurl&fl[]=mediatype&fl[]=month&fl[]=num_reviews&fl[]=oai_updatedate&fl[]=publicdate&fl[]=publisher&fl[]=rights&fl[]=scanningcentre&fl[]=source&fl[]=subject&fl[]=title&fl[]=type&fl[]=volume&fl[]=week&fl[]=year"
ID_FIELD_ONLY = "&fl[]=identifier"
def mkdirs()
@ldodds
ldodds / gist:991384
Created May 25, 2011 17:08
This is a test
test
@ldodds
ldodds / gist:1231779
Created September 21, 2011 10:45
Annotation query
SELECT * WHERE {
?annotation a a:Annotation;
a:body ?body;
a:annotates <http://www.gac.culture.gov.uk/images/standard/17686.jpg>;
arthack:top ?top;
arthack:left ?left;
arthack:height ?height;
arthack:width ?width.
@ldodds
ldodds / demo.py
Created October 26, 2011 15:37
Searching a dataset in Kasabi
import pytassium
import time
dataset = pytassium.Dataset('nasa','put-your-api-key-here')
# --------------------------
# Use the lookup API
# --------------------------
response, data = dataset.lookup('http://data.kasabi.com/dataset/nasa/person/eugeneandrewcernan')
if response.status in range(200,300):
# data now contains an rdflib.Graph
@ldodds
ldodds / bulk_load.rb
Created March 30, 2012 12:42
Example of Bulk load Ntriples into Kasabi using kasabi.rb
# Bulk load N-Triples into Kasabi
#
# Simple script to iterate through a large n-triples file and load it into Kasabi
#
# Be sure to set two environment variables: KASABI_DATASET and KASABI_API_KEY
#
# Script accepts a single command-line parameter which is the location of the file to upload
require 'rubygems'
require 'kasabi'
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rel: <http://www.perceive.net/schemas/relationship/> .
<http://example.org/#green-goblin>
rel:enemyOf <http://example.org/#spiderman> ;
a foaf:Person ;
foaf:name "Green Goblin" .
@ldodds
ldodds / touche.ttl
Created March 30, 2012 16:25
Touche Turtle in Turtle
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rel: <http://www.perceive.net/schemas/relationship/> .
@prefix ex: <http://example.org/ns#>
<http://example.org/#touche-turtle>
rel:friendOf <http://example.org/#dum-dum> ;
a ex:Turtle ;
foaf:name "Touche Turtle" .
<http://example.org/#dum-dum>
@ldodds
ldodds / monitor.rb
Created July 30, 2012 19:25
Amazon Wishlist Monitor
#libnotify-bin
require 'rubygems'
require 'json'
require 'hpricot'
require 'yaml'
require 'open-uri'
#Check for config
if !File.exist?(ENV["HOME"] + "/.wishlist-monitor/config.yaml")
puts "Configuration file is missing"
@ldodds
ldodds / schema.rdf
Created September 28, 2012 13:52
Artisanal Integer Schema
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#">
<rdfs:Class rdf:about="http://artisanalintegers.com/schema.rdf#Integer">
<rdfs:label xml:lang="en">An Artisanal Integer</rdfs:label>
<rdfs:comment>Represents an Artisanal Integer</rdfs:comment>
</rdfs:Class>
@ldodds
ldodds / gist:3958906
Created October 26, 2012 13:46
List of Board Game suggestions for Geek Family
Have:
Ticket to Ride Europe
Talisman
Carcassonne
Suggestions:
Agricola
Bang!