Skip to content

Instantly share code, notes, and snippets.

View nils-werner's full-sized avatar

Nils Werner nils-werner

View GitHub Profile
@nils-werner
nils-werner / GitLab7.8.4
Last active August 29, 2015 14:19
GitLab webhook request
{'connection': 'close',
'content-length': '1598',
'content-type': 'application/json',
'host': 'mymac.employer.server.de:8000'}
{
"before": "781f005120f77fbc69d1077d57b3b10ee792f232",
"after": "0bba8ee1bc7d3f5849b530ef6a4bdef1e97f8ecb",
"ref": "refs/heads/master",
@nils-werner
nils-werner / webhook-test.py
Created April 13, 2015 10:39
Print POST data from requests
#!/usr/bin/python
import time
import BaseHTTPServer
from pprint import pprint
HOST_NAME = '0.0.0.0'
PORT_NUMBER = 8000
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
@nils-werner
nils-werner / montecarlopi.py
Created March 29, 2015 21:36
Calculating PI using NumPy and the montecarlo method
from __future__ import division
import numpy
n = 1000000
# 2D data spread uniformly across a square of A=1
data = numpy.random.uniform(-0.5, 0.5, size=(n, 2))
# Count points that are within distance 0.5 from center
inside = len(
numpy.argwhere(
# Maintainer: speps <speps at aur dot archlinux dot org>
pkgname=rtmidi
pkgver=2.1.0
pkgrel=1
pkgdesc="A set of C++ classes that provides a common API for realtime MIDI input/output."
arch=(i686 x86_64)
url="http://www.music.mcgill.ca/~gary/rtmidi/"
license=('MIT')
depends=('alsa-lib')
@nils-werner
nils-werner / sections.php
Last active August 29, 2015 13:57
Kirby snippet sections
<?php
/*
* Snippet Templates
*
* A plugin to inject sections into snippets
*
* Sample Usage:
*
* In your snippet:
@nils-werner
nils-werner / gist:7135162
Last active December 26, 2015 10:09
Speaker TikZ
\def\speaker{%
(11mm,2mm) -- +(0mm,-4mm)
(13mm,4mm) -- +(0mm,-8mm)
(15mm,6mm) -- +(0mm,-12mm)
(0mm,0mm) -- +(0mm,-3mm) -- +(4mm,-3mm) -- +(9mm,-7mm) -- +(9mm,7mm) -- +(4mm,3mm) -- +(0mm,3mm) -- +(0mm,0mm)
}
#!/bin/sh
SUBLIME="subl"
# We need to remove the stupid "file://" that Evince puts in front of the file name
# Notice the wild quoting: we need to interpolate $SUBLIME
# In the end, EDITORCMD should be of the form:
#
# f=%f; sublime-text "${f#file://}:%l"
#
# Contributor: Christian Thurau <christian DOT thurau AT iais DOT fraunhofer DOT de>
pkgname='python2-pymf'
pkgver=0.1.9
pkgrel=1
pkgdesc="Python Matrix Factorization (PyMF) is a module for several constrained/unconstrained matrix factorization (and related) methods"
url="http://code.google.com/p/pymf/"
arch=('any')
license=('GPL3')
depends=('python2' 'python2-cvxopt')
source=(https://pypi.python.org/packages/source/P/PyMF/PyMF-$pkgver.tar.gz pymf-$pkgver.patch)
@nils-werner
nils-werner / Makefile
Created October 16, 2013 19:03
LaTeX build system
MAKEFLAGS += -j1
LATEXFLAGS += -interaction=batchmode
TEXPATH += .:./lib//:
.PHONY: document beispiel desktop preview images clean cleanall
document: thesis.pdf cover.pdf back.pdf
cover: cover.pdf
@nils-werner
nils-werner / Audio.py
Created July 12, 2013 22:11
IPython Notebook Audio Viewer
from IPython.core.display import DisplayObject
import StringIO
import base64
import struct
import sys
class Audio(DisplayObject):
def __init__(self, data=None, rate=None, url=None, filename=None, autoplay=False):
if(data is not None):
buffer = StringIO.StringIO()