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 / docker-env
Created August 7, 2015 13:29
Docker environment management with $DOCKER_ENV
#!/bin/bash
list ()
{
echo "local"
echo "remote1"
}
env_remote1 ()
{
export DOCKER_HOST="remote1.org:2375"
@white-gecko
white-gecko / ddict.py
Created July 8, 2015 10:56
Python Default Dictionary of Dictionaries
#! /usr/bin/env python3
from collections import defaultdict
def ddict ():
return defaultdict(ddict)
def ddict2dict(d):
for k, v in d.items():
if isinstance(v, dict):
@white-gecko
white-gecko / gecko.zsh-theme
Last active August 29, 2015 14:09
My zsh theme (you have to place it in ~/.oh-my-zsh/themes/ and change ZSH_THEME to gecko in your .zshrc)
# this theme was build be taking some code and impressions from mortalscumbag, intheloop, crcandy and bureau
bureau_git_branch () {
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
echo "${ref#refs/heads/}"
}
bureau_git_status () {
_INDEX=$(command git status --porcelain -b 2> /dev/null)
@white-gecko
white-gecko / listingshack.sty
Created November 6, 2014 11:06
LaTeX package for a cooler listing appearance
% This package fixes some issues with listings
% - Set a nice font
% - Add Turtle as langugage
% - Imprive XML style
% - Fix dashs/hyphens
%
% (c) 2013 Natanael Arndt
% LPPL LaTeX Public Project License
%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
@white-gecko
white-gecko / purlproxy.php
Created March 11, 2014 11:02
Proxy script for rewritng purl redirected URIs to the correct URLs for OntoWiki
<?php
$request = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['REQUEST_URI']);
$purl = 'http://purl.org' . $request;
$proxyTarget = array(
'/voc/ex/' => 'http://example.org/site/schema/?r=',
);
@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>();
}
@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 / 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 / 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 / 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