Skip to content

Instantly share code, notes, and snippets.


Heinrich Hartmann HeinrichHartmann

View GitHub Profile
HeinrichHartmann /
Created Aug 18, 2014
Banzhaf power index calculation
# -------
# ------- banzhaf - version 1.1
# -------
# ------- A simple self-contained function to compute the Banzhaf Power Index given:
# ------- * a list of integer weights for all voters in the system, sorted in ascending order
# ------- * the quota for the voting system
# -------
# ------- This is a slight modification (mainly vectorization) of the code by
# ------- Ruben R. Puentedura (
# ------- which was published under CC-License in 2004
HeinrichHartmann /
Created May 5, 2021
Pull issues into local text files via GH CLI
#!/usr/bin/env python
gh-issue-fetch [-R <repository url>] [-d <output directory>]
Fetch all issues from a GH repository into local text files.
By default issues are placed in ./issues/*, this can be
changed by using the -d flag.
HeinrichHartmann / Makefile
Last active Apr 30, 2021
Search Sum Exercise in x86-Assembly
View Makefile
main: main.c lib.asm
nasm -f elf64 -o lib.o lib.asm
gcc -o main main.c lib.o
run: main
HeinrichHartmann /
Created Dec 29, 2020
CSV to VCard Converer for Monica CRM
import pandas as pd
import vobject
df = pd.read_csv("contacts.csv", index_col="Id")
for row in df.iterrows():
rec = row[1].to_dict()
for k,v in rec.items():
if v == "-":
rec[k] = None
HeinrichHartmann /
Created Sep 23, 2016
Read data from std in and show in a browser
# Read data from std in and show in a browser.
# E.g. curl | bcat
TMPFILE=`mktemp '/tmp/bcat.XXXXXXXX'`"$EXT" || exit 1
cat > $TMPFILE
HeinrichHartmann /
Last active Jan 18, 2019
Publish dropbox "files remaining" as statsd metrics
# Example output of ` status`
# ```
# Syncing (51,938 files remaining, 2 mins left)
# Downloading 51,938 files (3,069 KB/sec, 2 mins left)

Keybase proof

I hereby claim:

  • I am heinrichhartmann on github.
  • I am hartmann ( on keybase.
  • I have a public key ASADQm4Cys6zXNQQjsHsuEk7xwjRTWF7VSrdUI2kRjrcuQo

To claim this, I am signing this object:

HeinrichHartmann /
Created Jul 26, 2018
Python IRONdb/Snowth Bindings
# This is a Python wrapper for the Snowth/IRONdb API I wrote
# for personal use in 2014. Use at your own risk.
import logging
log = logging.getLogger()
if __name__ == "__main__": log.setLevel(logging.DEBUG)
else: log.setLevel(logging.WARN)
import requests
View Circonus for Data Science.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.