Skip to content

Instantly share code, notes, and snippets.

View white-gecko's full-sized avatar

Natanael Arndt white-gecko

View GitHub Profile
@white-gecko
white-gecko / ontowiki
Last active May 26, 2016 21:42
NGINX configuration for OntoWiki
server {
listen [::]:80 default_server ipv6only=off;
root /var/www/localhost/;
error_log /tmp/localhost-error.log;
# optionally also index.html index.htm
index index.php;
@white-gecko
white-gecko / comment-example.ttl
Created September 19, 2012 13:05
An example model for comment Activities and replies
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix sioc: <http://rdfs.org/sioc/ns#>.
@prefix aair: <http://xmlns.notu.be/aair#> .
@prefix atom: <http://www.w3.org/2005/Atom/> .
@white-gecko
white-gecko / ink_create_images
Created October 18, 2012 21:57 — forked from DDRBoxman/ink_create_images
Script to create / scale Android resources from vectors
#!/bin/bash
#Requires Inkscape to be installed.
#This script scales and creates images at the correct dpi level for Android.
#It gets placed in a folder called res/drawable/_source_images/ in your
#Android project along with all your svg files.
#When creating svg files set the image size to the size that you want your hdpi images to be.
#To use simply run the create_images script from its folder and it will generate images for all the svg files.
@white-gecko
white-gecko / kmp_match.php
Created October 20, 2012 22:58
Knuth-Morris-Pratt-Algorithm
<?php
/**
* This is an implementation of the Knuth-Morris-Pratt-Algorithm as in
* Thomas H. Cormen et. al.: "Algorithmen - Eine Einführung"
* (German version by Paul Molitor) 3. Auflage, page 1017
*
* My changes:
* - Indexes starting with 0
* - overlapping matches are recognized
*/
@white-gecko
white-gecko / README
Created November 5, 2012 20:18
The init script to start php-fastcgi to use it with nginx
To use nginx with fastcgi you need following packages:
apt-get install nginx php5-cli php5-cgi spawn-fcgi psmisc
Create a symlink link /etc/init.d/php-fastcgi pointing to ./etc_init.d_php-fastcgi
and a link /usr/bin/php-fastcgi pointing to ./usr_bin_php-fastcgi
Note: Both files need to be executable (chmod +x <file>)
To enable the init script run
sudo update-rc.d php-fastcgi defaults
@white-gecko
white-gecko / statusled
Created November 11, 2012 01:10
Initscript to switch LED1 on Olinuxino A13 on and off
#!/bin/bash
#
# Initscript to switch LED1 on Olinuxino A13 on and off
#
### BEGIN INIT INFO
# Provides: statusled
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@white-gecko
white-gecko / pingme.php
Created November 27, 2012 23:22
Small script to test Semantic Pingback
<?php
if (isset($_POST['comment'])) {
$to = 'http://example.com/resource#b';
$comment = $_POST['comment'];
$pingbackService = 'http://example.com/pingservice';
if (isset($_POST['from']) && !empty($_POST['from'])) {
$source = $_POST['from'];
} else {
$source = 'http://example.com/from-resource#a';
}
@white-gecko
white-gecko / xodx
Last active October 13, 2015 15:48
NGINX configuration for Xodx
# This file belongs into /etc/nginx/sites-available and a link to it in /etc/nginx/sites-enabled
# if it doesn't work maybe remove the default configuration from /etc/nginx/sites-enabled
#
# make sure to adjust the root path "root /path/to/xodx/;" below
server {
# Make site accessible from http://localhost/
#server_name localhost;
listen [::]:80 default_server; # listen for ipv6 and ipv4
#listen 80 default_server; # if the ipv6 line doesn't work
@white-gecko
white-gecko / qname.sty
Last active May 3, 2021 15:56
This is a LaTeX package which provides support for prefixes in qnames. It depends on the url- and the hyperref-package
% This package provides support for prefixes in qnames
%
% Defined commands:
% \setprefix{foaf}{http://xmlns.com/foaf/0.1/}
% Define a prefix namespace
% \getprefix{foaf}
% Get a defined prefix namespace
% \prefix{foaf}
% Just output the prefix linked to the namespace
% \qname{foaf:Person} has to contain a colon
@white-gecko
white-gecko / AcceptHeader.java
Last active August 29, 2015 13:56
This is a substitution for Jena's Model.read() method which seams to take for ever in some cases.
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
public class AcceptHeader {
private HashMap<String, Float> datatypes;
public AcceptHeader() {
datatypes = new HashMap<String, Float>();
}