Skip to content

Instantly share code, notes, and snippets.

View r10r's full-sized avatar

Ruben Jenster r10r

  • Drachenfels GmbH
  • Pforzheim
View GitHub Profile
@r10r
r10r / asymmetric.go
Last active August 27, 2015 19:52 — forked from cryptix/LICENSE
example of using JWT for http authentication in go
package main
// using asymmetric crypto/RSA keys
import (
"crypto/rsa"
"fmt"
"io/ioutil"
"log"
"net/http"

Release notes for version v0.1

  • feature1: Feature 1 was released.
  • feature3: feature3 released
@r10r
r10r / disk_space_warning.sh
Created June 12, 2015 09:58
E-Mail alert when disk usage exceeds a configured limit.
#!/bin/bash
LIMIT=95
EMAIL=root
HEAD="$(df -h | head -n1)"
df -h | tail -n+2 | while read part
do
USED=`echo $part | awk '{ print $5 }' | cut -d'%' -f1`
if [ $USED -gt $LIMIT ]; then
@r10r
r10r / negroni-gzip-test.go
Last active August 29, 2015 14:13
On the fly GZIP encoding for static files with negroni GZIP handler.
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/phyber/negroni-gzip/gzip"
"net/http"
)
func MyMiddleware(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
@r10r
r10r / marshal.go
Last active August 29, 2015 14:11
Implement MarshalJSON for type alias.
package main
import (
"encoding/json"
"fmt"
)
type Metadata struct {
UUID string
Name string
@r10r
r10r / app-env.ini
Created November 7, 2014 16:29
uwsgi/nginx simple CGI example
[uwsgi]
plugins = cgi
socket = /tmp/uwsgi.sock
cgi = /cgi-bin=/tmp/cgi
cgi-allowed-ext = .sh
function WSTestCtrl($scope, ws) {
$scope.method = 'ping'
$scope.params = '[]'
$scope.reply = 'None yet.'
$scope.reply_class = 'info'
$scope.go = function(){
ws.call($scope.method, JSON.parse($scope.params)).then(function(d){
$scope.reply = JSON.stringify(d)
@r10r
r10r / gist:10102776
Created April 8, 2014 08:55
start dnsmasq with logging to cmdline on osx
/usr/local/opt/dnsmasq/sbin/dnsmasq --keep-in-foreground -q -C /usr/local/etc/dnsmasq.conf --log-facility=-
@r10r
r10r / .gitconfig
Created March 6, 2014 16:20
nice git log format
[alias]
tree = log --graph --decorate --pretty=format:'%C(yellow)%h %Creset%cd %C(cyan)%cn%Cgreen%d %Creset%s' --date=relative
@r10r
r10r / Makefile
Last active July 31, 2016 21:39
Generic Makefile honoring 'Why recursive make is harmful' http://aegis.sourceforge.net/auug97.pdf
-include Settings.mk
# [ project ]
# ===========
default: all
# [ settings ]
# ============
BASE_DIR := $(realpath $(PWD))