Skip to content

Instantly share code, notes, and snippets.

@ljos
ljos / cocoa_keypress_monitor.py
Last active January 6, 2024 07:36
Showing how to listen to all keypresses in OS X through the Cocoa API using Python and PyObjC
#!/usr/bin/env python
#
# cocoa_keypress_monitor.py
# Copyright © 2016 Bjarte Johansen <Bjarte.Johansen@gmail.com>
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# “Software”), to deal in the Software without restriction, including
@ljos
ljos / README.md
Created December 2, 2011 22:23
Using Timeplot to create a graph to show sparql results.

A small project using timeplot, joseki and xslt to create graphs over time. The rdfs used in the searches here are ones created in a xslt you can find as another gist. The code is meant to run on as a part of a joseki sparql endpoint. At least that is where we sent the queries.

Code released under GPLv3.

@ljos
ljos / transfor-ssb-data.xsl
Created December 2, 2011 22:20
Transforms xml-keys documents from SSB to RDF/XML (in a horrible way). / Transformerer SSB dokumenter til RDF/XML (på en forferdelig måte). Code released under GPLv3 / Koden er sluppet under GPLv3.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<!ENTITY ssbont "http://localhost/ssbont.owl#" >
<!ENTITY dbpedia "http://dbpedia.org/resource/">
]>
<xsl:stylesheet
@ljos
ljos / README.md
Created November 21, 2011 11:53
Overloading Timeplot.DefaultEventSource.loadXML to be able to take in SPARQL results and converting with an xslt document instead of the normal XML.

There are better ways of doing this, but because I don't understand javascript or Timeplot and had to finish fast I did it like this.

I overload the loadXML function of DefaultEventSource to take inn a SPARQL result XML document with the url to an xsl_url. It converts the sparql result with xslt to the format that Timeplot reads.

I didn't need to read XML as well.

You can use the following xslt to transform sparql results.. or write your own.

Code released under GPLv3