Skip to content

Instantly share code, notes, and snippets.

import sys
import locale
if sys.stdout.isatty():
default_encoding = sys.stdout.encoding
else:
default_encoding = locale.getpreferredencoding()

Keybase proof

I hereby claim:

  • I am mfa on github.
  • I am mfandreas (https://keybase.io/mfandreas) on keybase.
  • I have a public key whose fingerprint is C0E0 906A FFC8 4C45 2F01 0535 5F62 A6E5 EFA1 2513

To claim this, I am signing this object:

@mfa
mfa / pelicanconf.py
Created August 29, 2014 09:25
pelican config for madflex.de (anonymized)
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'FIXME'
SITENAME = u'FIXME'
SITEURL = 'http://example.org'
TIMEZONE = 'Europe/Berlin'
@mfa
mfa / gist:227894
Created November 6, 2009 10:23 — forked from augustjoki/gist:31867
# version for bash 2.03
# no use of =~ and BASH_REMATCH allowed
function parse_git_branch {
if [[ `uname -s` == "SunOS" ]]; then
return 1
fi
if git rev-parse --git-dir >/dev/null 2>&1
then
git_status="$(git status 2> /dev/null)"
remote_pattern="# Your branch is "
@mfa
mfa / post-commit
Created July 10, 2012 12:06 — forked from consti/post-commit
Take a photo of you, whenever you make a commit (linux version)
#!/bin/sh
#
# Take a photo of you, whenever you make a commit
#
# This is an improved version of Víctor Martínez original post:
# http://coderwall.com/p/xlatfq
#
# Improvements:
# * This is non-blocking (you dont have to wait for your image to be taken)
# -*- coding: utf-8 -*-
#
# frwd to other interested parties at the institute
#
import datetime, time, sys
leave_at = datetime.datetime(2012, 12, 13, 12, 00)
first = True
while True:
delta = leave_at - datetime.datetime.now()
@mfa
mfa / gist:628301e3aca160bbdbc4
Created February 5, 2016 10:12
protokoll der migration
delete FROM "schemaorg_jsonthing" WHERE UPPER("schemaorg_jsonthing"."pure_data"::text) LIKE UPPER('%nan,%');
@mfa
mfa / gps.py
Created January 31, 2019 19:56
GPS "GY-GPS6MV2" at serial of a RPi
# Python 3.6+
import pynmea2
import serial
s = serial.Serial("/dev/ttyAMA0", 9600, timeout=0.5)
line = ""
while True:
try:
line = s.readline().decode()
except UnicodeDecodeError:
@mfa
mfa / gist:455f7a278ea0099e8862d0dd1b04c46a
Created June 9, 2017 11:02
daily_stuttgart_bike_counter.md
## Böblinger-Strasse
curl -X POST "http://www.eco-public.com/ParcPublic/CounterData?table=ecobdd.%60Z_100034894%60&idOrganisme=607&idPdc=100034894&fin=09%2F06%2F2017&debut=01%2F01%2F2017&interval=4&pratiques=101034894%3B102034894%3B103034894%3B104034894"
## König-Karls-Brücke
curl -X POST "http://www.eco-public.com/ParcPublic/CounterData?table=ecobdd.%60Z_100037170%60&idOrganisme=607&idPdc=100037170&fin=09%2F06%2F2017&debut=01%2F01%2F2017&interval=4&pratiques="