Skip to content

Instantly share code, notes, and snippets.

View niclashoyer's full-sized avatar

Niclas Hoyer niclashoyer

View GitHub Profile
@niclashoyer
niclashoyer / colour-light.vim
Last active August 29, 2015 13:56
light colorscheme for vim
" Vim color file colour light
" generated by VimTax http://www.vimtax.com
set background=light
hi clear
if exists("syntax_on")
syntax reset
endif
set t_Co=256
let colors_name = "colour-light"
@niclashoyer
niclashoyer / cpconfig.sh
Last active January 19, 2018 00:06
Replace environment variables in configuration files with optional default using perl regular expressions.
#!/bin/bash
#
# Replaces ${var:def} expressions in text files with environment variables with
# an optional default.
#
# Assuming VAR1 contains the value "foo" nad VAR2 is undefined, the following
# expressions will evaluate as given on the right side:
#
# ${VAR1} ~> foo
# ${VAR2:bar} ~> bar
@niclashoyer
niclashoyer / hipache-docker
Last active December 28, 2015 06:19
Shell script to start a docker container and add it to hipache
#!/bin/bash
# The MIT License (MIT)
#
# Copyright (c) <year> <copyright holders>
#
# 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 without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@niclashoyer
niclashoyer / 00-fedora-studio.md
Last active August 8, 2016 08:01
Fedora 19 Studio Setup

Fedora Studio Setup

@niclashoyer
niclashoyer / gist:7012182
Created October 16, 2013 18:07
Get all postboxes around Kiel, Germany
http://overpass.osm.rambler.ru/cgi/interpreter?data=[out:json];node[name%3DKiel]%3Bnode%28around%3A10000%29[amenity%3Dpost_box]%3Bout%3B
@niclashoyer
niclashoyer / dexdis.coffee
Last active January 17, 2018 20:13
Quick hack for a redis like interface for IndexedDB
errs =
transaction: 'Operation not allowed during transaction'
wrongtype: 'Operation against a key holding the wrong kind of value'
notransaction: 'Operation not allowed without transaction'
notsupported: 'Operation not supported'
toomuchop: 'Operation with too much operands'
# calculate hamming weight (for BITCOUNT command)
# see http://jsperf.com/hamming-weight/4
hamming = (x) ->
@niclashoyer
niclashoyer / ldpcontainer.coffee
Created August 28, 2013 21:46
minimal in-memory nodejs ldp container implementation (incomplete)
# npm install connect
connect = require 'connect'
accept = [
'text/turtle',
'application/rdf+xml',
'application/rdf+json'
]
@niclashoyer
niclashoyer / _echoimap.md
Last active December 20, 2015 21:19
IMAP mail retriever written in CoffeeScript to forward mail to another process.

echoimap

Create a settings file ~/.echoimap.json with the following content:

{
	"imap": {
		"host": "imap.example.com",
		"user": "imapuser",
 "password": "imappassword",
@niclashoyer
niclashoyer / colour-light.xml
Last active December 19, 2015 17:29
colour-light style for gedit
<?xml version="1.0" encoding="UTF-8"?>
<!-- save to ~/.local/share/gtksourceview-3.0/styles/ -->
<!--
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
@niclashoyer
niclashoyer / docker-cleanup.sh
Created June 6, 2013 20:27
Remove all Docker Containers
#!/bin/bash
containers=`sudo find /var/lib/docker/graph/ -maxdepth 1 -type d -printf "%f "`
docker rmi $containers