Skip to content

Instantly share code, notes, and snippets.

View cgueret's full-sized avatar
🤓
I may be slow to respond.

Christophe Gueret cgueret

🤓
I may be slow to respond.
View GitHub Profile
@cgueret
cgueret / gist:844021
Created February 25, 2011 16:18
Redstore test put (Python2)
from rdflib import ConjunctiveGraph, RDF, URIRef
import httplib
if __name__ == '__main__':
graph = ConjunctiveGraph()
graph.add((URIRef("http://google.com"), RDF.type, URIRef("http://google.com")))
headers = { 'Accept' : '*/*', 'Content-Type': 'application/rdf+xml' }
conn = httplib.HTTPConnection("127.0.0.1:8080")
conn.request("PUT", "/data/http://google.com", body=graph.serialize(), headers=headers)
#response = conn.getresponse()
@cgueret
cgueret / fetch_and_run_perfscript.sh
Created November 2, 2011 10:03
Running the performances measuring script
wget https://github.com/downloads/cgueret/SemanticXO/performances.tar.gz
tar xzf performances.tar.gz
cd performances
python performances_test.py > /dev/null
@cgueret
cgueret / journal_record.html
Created November 2, 2011 10:30
Example of a Journal entry in the triple store
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Raptor Graph Serialisation</title>
</head>
<body>
<table id="triples" border="1">
<tr>
@cgueret
cgueret / instapaper2chrome.py
Created August 4, 2012 19:34 — forked from jasjukaitis/instapaper2chrome.py
Converts an Instapaper CSV export file to a Google Chrome bookmark import file.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2011 Raphael Jasjukaitis <webmaster@raphaa.de>
import csv
import os
import sys
from optparse import OptionParser
@cgueret
cgueret / eu_shared_lang.rq
Last active December 14, 2015 14:09
Query to get a social network out of DBpedia
SELECT DISTINCT ?Source ?Target ?Label WHERE {
?country1 a <http://dbpedia.org/class/yago/EuropeanCountries>.
?country1 <http://dbpedia.org/ontology/officialLanguage> ?language.
?country2 a <http://dbpedia.org/class/yago/EuropeanCountries>.
?country2 <http://dbpedia.org/ontology/officialLanguage> ?language.
FILTER (?country1 != ?country2)
?country1 <http://www.w3.org/2000/01/rdf-schema#label> ?Source.
?country2 <http://www.w3.org/2000/01/rdf-schema#label> ?Target.
?language <http://www.w3.org/2000/01/rdf-schema#label> ?Label.
@cgueret
cgueret / README.md
Last active August 29, 2015 14:09
CEDAR queries

This gist contains several queries that can be used against the data published by the project "CEDAR"

@cgueret
cgueret / raspi.logo
Last active August 29, 2015 14:18 — forked from nagromc/raspi.logo
@cgueret
cgueret / content-neg-bug.py
Created June 3, 2015 08:50
Content negociation bug in Quilt
import requests
RESOURCE = "http://acropolis.org.uk/921df22045f949c5967a4d5e9dd0e653#id"
print "# No asking for anything"
r = requests.get(RESOURCE)
print 'Received {}'.format(r.headers['content-type'])
print r.text[:100]
print "\n# Asking for application/n-quads"
@cgueret
cgueret / looper.py
Created June 22, 2016 22:53
Look for loops in the trigger data
# encoding: utf-8
"""
Detects loops in the triggers
Heavily based on https://git.bbcarchdev.net/res/docker/blob/master/graphite/collect.py
"""
import logging
logging.basicConfig(level=logging.INFO)
import psycopg2
@cgueret
cgueret / composer.json
Last active June 24, 2016 11:15
PHP snippets
{
"name": "guerec01/snippets",
"require": {
"easyrdf/easyrdf": "^0.9.1"
},
"authors": [
{
"name": "Christophe Gueret",
"email": "christophe.gueret@bbc.co.uk"
}