Skip to content

Instantly share code, notes, and snippets.

View nichtich's full-sized avatar
🦊
not a fox

Jakob Voß nichtich

🦊
not a fox
View GitHub Profile
// daiaAvailability.js
// -------------------
// Version: 1.0
// Author: Owen Stephens
// Last Edit: 15/03/2011
// Displays availability from DAIA compliant information
/*
* Constructor arguments:
@nichtich
nichtich / TestPlackApp.pm
Created June 14, 2011 08:08
Test PSGI applications with Plack::Test
use strict;
use warnings;
package TestPlackApp;
use Carp;
use parent 'Exporter';
use Plack::Builder;
use HTTP::Request;
use Test::More;
use Plack::Test;
@nichtich
nichtich / Redirect.pm
Created June 16, 2011 15:53
Quick draft of Plack::App::LocalRedirect
use strict;
use warnings;
package Plack::App::LocalRedirect;
use parent 'Plack::Component';
use Plack::Request;
use URI::Escape;
# use Plack::Util::Accessor qw(path);
sub call {
@nichtich
nichtich / truncocta.scad
Created August 17, 2011 00:14
Truncated octahedron as 3D-Model in OpenSCAD
/*
Truncated octahedron.
*/
module truncocta() {
// octahedron based on code by Willliam A Adams
octapoints = [
[+1, 0, 0], // + x axis
[-1, 0, 0], // - x axis
[0, +1, 0], // + y axis
@nichtich
nichtich / Exporter.pm
Created September 6, 2011 13:15
RDF::Trine::Exporter
package RDF::Trine::Exporter;
use strict;
use warnings;
sub serialize_iterator_to_file {
my ($self, $file, $iterator) = @_;
if ( $self->can('_iterator_to_file') ) {
$self->_iterator_to_file( $file, $iterator );
} elsif ( $self->can('_model_to_file') ) {
my $model = RDF::Trine::Model->temporary_model;
@nichtich
nichtich / LivingMyLife.ttl
Created November 1, 2011 21:33
Simplified Ontology for Bibliographic Resources (sobr)
@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix daia: <http://purl.org/ontology/daia/> .
@prefix dbo: <http://dbpedia.org/ontology/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix frbr: <http://purl.org/vocab/frbr/core#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix sobr: <http://example.org/sobr/> . # NO URI NAMESPACE YET
# Emma Goldman's biography
<http://www.librarything.com/work/70394>
@nichtich
nichtich / testumlauts.pl
Created November 7, 2011 09:31
Umlauts in RDF/Turtle URIs
#!/usr/bin/perl
use utf8;
use RDF::Dumper;
use RDF::Trine::Model;
use RDF::Trine::Serializer;
use RDF::Trine qw(iri);
my $m = RDF::Trine::Model->new;
my $p = RDF::Trine::Parser->new('turtle');
@nichtich
nichtich / beacon2nt.awk
Created December 6, 2011 16:38
Simple awk scripts to convert between BEACON format and N-Triples
# Simple awk script to convert BEACON format to N-Triples
# First published at https://gist.github.com/gists/1438869
# hereby put into public domain
BEGIN {
FS = "|"
link = "http://www.w3.org/2000/01/rdf-schema#seeAlso"
header = 1
}
{
if (header && $1 ~ /^(\xef\xbb\xbf)?[ \t]*#/) { # may contain UTF-8 BOM!
@nichtich
nichtich / databases.sql
Created December 16, 2011 21:56
Get data from Sony PRS-T1
-- Get highlighted parts
-- in /media/READER/Sony_Reader/database/books.db:
SELECT file_name, page, name FROM markups;
@nichtich
nichtich / gist:1560990
Created January 4, 2012 17:03
Expressing IPs and IP-Ranges as URIs
An IP uniquely identifies a resource, so it should be usable as URI. Unfortunately there is no URI namespace for IP and/or IP ranges.
IP:
(((([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5]))|((([\da-fA-F]{1,4})|(\:))\:){7}(([\da-fA-F]{1,4})|(\:))))
CIDR IP range (see http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing):
(((([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])\/(\d|[1-2]\d|3[0-2]))|((([\da-fA-F]{0,4})|(\:))\:){7}(([\da-fA-F]{0,4})|(\:)))\/([1-9]?\d|1[01]\d|12[0-8])))