Skip to content

Instantly share code, notes, and snippets.

Florian Klien flowolf

View GitHub Profile
View gist:de4374e697a2cb94f15b
### Keybase proof
I hereby claim:
* I am flowolf on github.
* I am flowolf ( on keybase.
* I have a public key whose fingerprint is 82CB C28E 4125 ABF9 DB0C 0E07 0167 D15E 878D 8361
To claim this, I am signing this object:
flowolf / gist:7247585
Last active Dec 27, 2015
simple python solution to puddle problem found here:
View gist:7247585
# Python solution to the puddle problem
# from:
# single pass, streaming capable. O(n), memory as much as wall size.
def calc_vol(a):
vol = 0
count = [0]
maxi = 0
last = 0
flowolf / phone_booth_austria
Last active Jan 25, 2016
query all phone booths in Austria
View phone_booth_austria
This is an Overpass query.
It queries all phone booths in Austria.
flowolf /
Last active Feb 22, 2016
Sum up your transmission uploads
# tested with transmission-remote 2.51 (13280)
# call like:
# $ transmission-remote -l | ./
# units:
import sys
total = 0
input = sys.stdin
for l in input:
View Salt postgres config
# my working salt postgres config (updated since first post on IRC #salt)
- installed
- pkgs:
- postgresql
- running
- name: postgresql
- enable: True
View RFID door opener
* door lock application (c) 2011 Florian Klien
* some code parts are borrowed from different authors ;) thx
#include <NewSoftSerial.h>
#define rxPin 2
#define txPin 3
# get a country statistic for Fail2Ban blocks:
# this just accounts for IPs once. Multiple failed attempts by one IP just show up once for a country.
for i in `sudo cat /var/log/fail2ban.log | sed 's/.*[Bb]an \(.*\)/\1/' | sort | uniq | cut -d ' ' -f 1 | grep "\."`;
echo $i; whois $i | grep country\: |head -n 1 >> fail2ban_ctry.log ;
cat fail2ban_ctry.log | sed 's/country: //g' |sort | uniq -c | sort -nr
import RPi.GPIO as GPIO
import time
import subprocess
# we will use the pin numbering to match the pins on the Pi, instead of the
# GPIO pin outs (makes it easier to keep track of things)
# use the same pin that is used for the reset button (one button to rule them all!)
View shutdown.rc
#! /bin/sh
# Provides: pi_shutdown
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: S
# Default-Stop:
# Short-Description: Shutdown on GPIO trigger
# Description: Python script listens for GPIO and runs shutdown command
# Installs python script to enable safe shutdown of Raspberry Pi on PIN5/GPIO3 Logic LOW
# Author:
# Adapted from
# Download and run this setup script in the terminal using the following command:
# curl | bash
You can’t perform that action at this time.