Skip to content

Instantly share code, notes, and snippets.

Christian Stade-Schuldt Tafkas

View GitHub Profile
@Tafkas
Tafkas / sleepdata.R
Last active Apr 4, 2016
A first look at the sleepdata recorded with the Sleep Cycle app for the iPhone
View sleepdata.R
sleep <- read.csv(file="sleepdata.csv", header=T, sep=";")
#split end time
sleep$End <- as.character(sleep$End)
#get the date
sleep$Date <- sapply(strsplit(sleep$End, " "),"[[",1)
sleep$Date <- strptime(sleep$Date, format="%Y-%m-%d")
#fix sleep quality
@Tafkas
Tafkas / read_ehz.sh
Created Oct 27, 2014
Reading data from an eHZ-IW8E2A5 residential meter
View read_ehz.sh
#!/bin/bash
# read and evaluate SML output received from EMH eHZ
# set serial device
INPUT_DEV="/dev/ttyUSB0"
#set $INPUT_DEV to 9600 8N1
stty -F $INPUT_DEV 1:0:8bd:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
SML_START_SEQUENCE="1B1B1B1B0101010176"
@Tafkas
Tafkas / collect_meter.py
Created May 18, 2016
A script to collect values from a residential meter
View collect_meter.py
#!/usr/bin/env python
# encoding: utf-8
"""
collect_meter.py
Created by Christian Stade-Schuldt on 2014-10-25.
"""
import sys
import os
@Tafkas
Tafkas / slack_channel_munin.py
Created May 21, 2016
A munin plugin for to monitor channel count in Slack
View slack_channel_munin.py
#!/usr/bin/env python
"""
slack_channel_munin - A munin plugin for to monitor channel count in Slack
Copyright (C) 2015 Christian Stade-Schuldt
Author: Christian Stade-Schuldt
Like Munin, this plugin is licensed under the GNU GPL v2 license
http://www.opensource.org/licenses/GPL-2.0
Add the following section to your munin-node's plugin configuration:
[slack_*]
@Tafkas
Tafkas / slack_user_munin.py
Last active May 21, 2016
A munin plugin for to monitor online presence in Slack
View slack_user_munin.py
#!/usr/bin/env python
"""
slack_user_munin - A munin plugin for to monitor online presence in Slack
Copyright (C) 2015 Christian Stade-Schuldt
Author: Christian Stade-Schuldt
Like Munin, this plugin is licensed under the GNU GPL v2 license
http://www.opensource.org/licenses/GPL-2.0
Add the following section to your munin-node's plugin configuration:
[slack_*]
@Tafkas
Tafkas / createhighchartfromxml.js
Last active Feb 23, 2017
Parse xml file generated from RRDTool export and create Highchart series
View createhighchartfromxml.js
$.ajax({
type: "GET",
url: "data/temperature24h.xml",
dataType: "xml",
success: function(xml) {
var series = []
//define series
$(xml).find("entry").each(function() {
var seriesOptions = {
@Tafkas
Tafkas / xport-temp.sh
Created Nov 13, 2013
Export RRDTool database to xml
View xport-temp.sh
#!/usr/bin/env bash
rrdtool xport -s now-3h -e now --step 300 \
DEF:a=/home/pi/weather/temperatures.rrd:temps1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:temps2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:temps3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:temps4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:temps5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:temps6:AVERAGE \
XPORT:a:"Livingroom" \
@Tafkas
Tafkas / fetch_wde_data.sh
Created Nov 13, 2013
Fetch data from USB-WDE1 receiver and write it to RRDTool database
View fetch_wde_data.sh
#!/usr/bin/env bash
# Receive weather data from remote USB WDE1 and store it into database
# Loop forever to read data from USB WDE1
socat / dev/ttyUSB0, B9600 STDOUT | \
while read line
do
if [["$ {line%% *}" == '$ 1']] then
# Format data
"{? line # 1, 1,} $" tmp = `echo | tr ',' ','`.
@Tafkas
Tafkas / tmpdb.sh
Created Nov 13, 2013
Create RRDTool database for storing temperature values
View tmpdb.sh
#!/usr/bin/env bash
rrdtool create temperatures.rrd \
--start N \
--step 300 \
DS:temps1:GAUGE:1200:-40:50 \
DS:temps2:GAUGE:1200:-40:50 \
DS:temps3:GAUGE:1200:-40:50 \
DS:temps4:GAUGE:1200:-40:50 \
DS:temps5:GAUGE:1200:-40:50 \
View gist:d6f5e50599e6079ccdb7c5d94e41399e
### Keybase proof
I hereby claim:
* I am tafkas on github.
* I am tafkas (https://keybase.io/tafkas) on keybase.
* I have a public key whose fingerprint is 7B9C 21AC AE24 13D8 CD42 C5CE 4B01 E33B 1795 4301
To claim this, I am signing this object:
You can’t perform that action at this time.