Skip to content

Instantly share code, notes, and snippets.

View joernhees's full-sized avatar

Jörn Hees joernhees

View GitHub Profile
@joernhees
joernhees / prepare_changelog.sh
Created March 12, 2020 10:53
small script to prepare release notes / changelog from github milestones
#!/bin/bash
# adapted from https://gist.github.com/joelittlejohn/5937573
if [ "$#" -ne 2 ]; then
echo "Usage: ./generate-changelog.sh user/repo <username>"
exit 1
fi
# read -s -p "@$2 password: " PASS
@joernhees
joernhees / dbpedia.jsonl
Created November 19, 2016 22:04
DBpedia JSON Extractor
{"comment": "Kaiserslautern ([\u02ccka\u026az\u0250s\u02c8la\u028at\u0250n]) is a city in southwest Germany, located in the Bundesland (State) of Rhineland-Palatinate (Rheinland-Pfalz) at the edge of the Palatinate Forest (Pf\u00e4lzerwald). The historic centre dates to the 9th century. It is 459 kilometres (285 miles) from Paris, 117 km (73 miles) from Frankfurt am Main, and 159 km (99 miles) from Luxembourg.", "pic": "http://commons.wikimedia.org/wiki/Special:FilePath/Kaiserslautern-Stadtwappen.svg", "uri": "http://dbpedia.org/resource/Kaiserslautern", "label": "Kaiserslautern", "areaTotal": "1.3972e+08", "types": ["http://www.w3.org/2002/07/owl#Thing", "http://www.wikidata.org/entity/Q3957", "http://www.wikidata.org/entity/Q486972", "http://dbpedia.org/ontology/PopulatedPlace", "http://dbpedia.org/ontology/Settlement", "http://dbpedia.org/ontology/Town", "http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing", "http://schema.org/Place", "http://dbpedia.org/ontology/Place", "http://dbpedia.org/ontology/Locat
@joernhees
joernhees / rdflib_hashing.py
Created July 21, 2015 15:16
rdflib hashing test
from multiprocessing import Process, Manager, Lock
import random
def f(d):
from rdflib import URIRef
for i in random.sample(range(1000), 1000):
k = URIRef('foo'+str(i))
with l:
if k not in d:
@joernhees
joernhees / recallPrecision.py
Created October 28, 2014 14:28
plot recall precision diagrams with f-measure height lines
# -*- coding: utf-8 -*-
"""
Script to plot recall-precision values with f-measure equi-potential lines.
Created on Dec 16, 2009
@author: Jörn Hees
"""
import scipy as sc
@joernhees
joernhees / scipy_arpack_tests_fail.log
Created June 7, 2013 23:52
scipy arpack tests fail
$ ipython
Python 2.7.5 (default, Jun 8 2013, 00:27:06)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.2 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
'''
Created on 21.03.2013
@author: joern
'''
import sys, os
import json, csv
@joernhees
joernhees / gist:2955006
Created June 19, 2012 16:09
github howto reconfigure git repository if cloned original and forked later
# so let's say you cloned repo someone/project like this
git clone git://github.com/someone/project.git
# you use it and then later on discover a bug.
# to fix it you create a fork on github to which you can
# write and issue a pull request, but now your origin is
# someone/project instead of you/project .
# fix it like this:
git remote rename origin upstream
@joernhees
joernhees / sigCooccs.py
Created March 19, 2012 19:17
small script which calculates the significance of term co-occurrences in a document corpus
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
"""
Created on Mar 19, 2012
@author: Joern Hees
"""
import scipy
from scipy.stats import poisson
@joernhees
joernhees / sparqlwrapperResToRDFlib.py
Created November 5, 2010 17:59
converts a result's bindings to their corresponding rdflib terms, e.g. URIref, Literal, BNode
# -*- coding: utf-8 -*-
'''
Created on Oct 30, 2010
@author: joern
'''
import rdflib
def sparqlJSONresultBindingsToRDFlib(resBindings):
""" Converts a result's bindings as retrieved in res["results"]["bindings"]