Skip to content

Instantly share code, notes, and snippets.

View HeinrichHartmann's full-sized avatar

Heinrich Hartmann HeinrichHartmann

View GitHub Profile
@HeinrichHartmann
HeinrichHartmann / Monitoring Gloassary.md
Last active July 3, 2016 11:33
Monitoring Glossary

Glossary of Monitoring

  • A system is a set of connected components

The definition of connected and components is missing. I think we can go with definitions like:

  • A components is a set of processes (in the OS sense)
  • Two components are connected if they can talk to each other (over a network or IPC).

Example: A LAMP system, consists of components:

@HeinrichHartmann
HeinrichHartmann / bcat.sh
Created September 23, 2016 10:10
Read data from std in and show in a browser
#!/bin/bash
#
# Read data from std in and show in a browser.
#
# E.g. curl google.com | bcat
#
EXT=${1:-.html}
TMPFILE=`mktemp '/tmp/bcat.XXXXXXXX'`"$EXT" || exit 1
cat > $TMPFILE
@HeinrichHartmann
HeinrichHartmann / dropbox-statsd.sh
Last active January 18, 2019 15:35
Publish dropbox "files remaining" as statsd metrics
statsd=localhost:8125
dropbox=$HOME/bin/dropbox.py
socat=/usr/bin/socat
grep=/bin/grep
sed=/bin/sed
# Example output of `drobox.py status`
# ```
# Syncing (51,938 files remaining, 2 mins left)
# Downloading 51,938 files (3,069 KB/sec, 2 mins left)
@HeinrichHartmann
HeinrichHartmann / lua_examples.c
Created April 19, 2018 09:20
Lua C API Examples
#include <stdio.h>
#include <string.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
// Helper function to print the stack contents
// Values other than numbers and strings are printed as "(null)"
void print_stack(lua_State *L, char* title){
int nargs = lua_gettop(L);
@HeinrichHartmann
HeinrichHartmann / ignite.el
Last active May 2, 2018 19:18
emacs functions to simulate ignite talks
(defun ignite-start ()
"Auto advaince slides"
(interactive)
(set 'ignite-interval 15)
(set 'ignite-t ignite-interval)
(message (format "Go! (%d sec)" ignite-interval))
(run-at-time 0 1 (lambda ()
(if (<= ignite-t 0)
(progn
(doc-view-next-page)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HeinrichHartmann
HeinrichHartmann / snowth_connector.py
Created July 26, 2018 18:50
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

Keybase proof

I hereby claim:

  • I am heinrichhartmann on github.
  • I am hartmann (https://keybase.io/hartmann) on keybase.
  • I have a public key ASADQm4Cys6zXNQQjsHsuEk7xwjRTWF7VSrdUI2kRjrcuQo

To claim this, I am signing this object:

@HeinrichHartmann
HeinrichHartmann / csv2vcard.py
Created December 29, 2020 20:05
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
HeinrichHartmann / Makefile
Last active April 30, 2021 07:00
Search Sum Exercise in x86-Assembly
main: main.c lib.asm
nasm -f elf64 -o lib.o lib.asm
gcc -o main main.c lib.o
run: main
./main