Skip to content

Instantly share code, notes, and snippets.


Jan Koppe JanKoppe

View GitHub Profile
variable "hcloud_token" {
provider "hcloud" {
token = "${var.hcloud_token}"
resource "hcloud_server" "kube-master" {
name = "kube-master"
image = "ubuntu-18.04"
JanKoppe /
Created Jul 30, 2018
remindme script
# Reminds you in xx minutes with notify-send, using at/atd
at now + "${MINUTES}" minutes << EOF
notify-send -c reminder -u critical 'Reminder from ${MINUTES} minutes ago' '${MESSAGE}'
JanKoppe /
Last active Jun 25, 2018
Exposing a lot of HTTP Ports behind a single nginx vhost for prometheus / django-prometheus

Running a Django app with gunicorn in a Docker container gets a bit tricky, when you try to expose Prometheus metrics (with e.g.

Every worker thread in gunicorn will be an entirely separate process, all RRD behind a single port. So, if you are running more than one worker thread (which you most likely do and should) you will need to let the workers each listen on a dedicated port, so your metrics will not get confused. You could try to add additional labels, but that still would come with a lot of problems. Running on a range of ports is supported quite well with korfuri/django-prometheus, as described here:

This will be a bit uncomfortable though, especially if your app is hidden behind an ingress reverse proxy and you do not want to punch lots of holes into your firewall config, or create lots and lots of vhosts.

JanKoppe /
Created May 24, 2018 — forked from lelandbatey/
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!


This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"


JanKoppe / command
Created Apr 5, 2018 — forked from Brachamul/command
Set an existing user to superuser using Django shell
View command
python shell
JanKoppe / descriptors.c
Created Mar 24, 2018 — forked from jmcgill/descriptors.c
A minimal sample of a generic batch mode USB device using LUFA.
View descriptors.c
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
JanKoppe /
Last active Jul 6, 2020
nginx basic auth with different users for read/write

This nginx configuration allows to restrict access via different methods to separate users.

This is very useful for private docker registries, where you want every member of your team to be able to fetch Docker images, but only some users (admins and CI users) to push new images to the registry.


  • User write can use GET, POST, PUT, DELETE and everything else.
  • User read can only use GET and HEAD.
  • Anonymous users are denied access entirely.
JanKoppe /
Created May 5, 2017
Grafana Cat Panel

Grafana Cat Panel

Recent studies have shown that a steady flow of cute kitten pictures can increase work productivity by up to 100% and boost general morale. Therefore every dashboard should provide a cat panel.

Paste this code in a "Text" Panel with html mode and enjoy.

JanKoppe / gist:777bbd484be5ba5cfc9ff8a35e0c902c
Created Mar 4, 2017
Naming Docker Swarm Services after their respective node name
View gist:777bbd484be5ba5cfc9ff8a35e0c902c
mostolog commented 19 days ago
As you said, swarm nodes get host's hostname as swarm node name (internally). That's perfectly correct for me.
After deploying some services with default setting, ps shows something like:
37bbf2b56dbf serviceBar.1.ngneetjtxwhm2eijfs1gvt60t
a90e2d59cd77 serviceBar.2.d4lf8h3gqj9e7gyhfi3lgrtdt
ed6d150d7c84 serviceBar.3.iz85bp0sc5t6e3b15w6gtteus
JanKoppe / config
Created Feb 26, 2017
Exclude Vagrant boxes from Hostkey checks
View config
Host 172.17.8.*
StrictHostKeyChecking no
You can’t perform that action at this time.