Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian Stade-Schuldt Tafkas

View GitHub Profile
@Tafkas
Tafkas / sun_flight_map.R
Created May 20, 2014
Plot sun elevations along a flight path.
View sun_flight_map.R
# sun_flight_map.R
#
# Plot sun elevations along a flight path.
#
# Airport information can be sourced from http://openflights.org/data.html.
# Note that the time zone offsets provided in their airports.dat never count
# daylight savings time.
#
# This code is for fun only, so it comes with no guarantee of accuracy and
# is not to be used for any serious purpose including making any decisions
@Tafkas
Tafkas / collect_weather.py
Created Jul 28, 2014
Fetch current weather from openweathermap api and save it to a sqlite database
View collect_weather.py
import sqlite3
import json
import urllib
import datetime
import calendar
WEATHER_DATA_URL = 'http://api.openweathermap.org/data/2.5/weather?q=Berlin,de&units=metric'
DB_PATH = ''
def get_data():
@Tafkas
Tafkas / pysml.py
Last active Aug 29, 2015
Script to read SML data packages from a residential meter
View pysml.py
#!/usr/bin/env python
# encoding: utf-8
"""
pysml.py
Created by Christian Stade-Schuldt on 2014-10-25.
"""
import sys
import os
import datetime
@Tafkas
Tafkas / codebase_munin.py
Last active Nov 24, 2015
A munin plugin for Linux to monitor Codebase ticket progress
View codebase_munin.py
#!/usr/bin/env python
"""
codebase_munin - A munin plugin for Linux to monitor Codebase ticket progress
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:
[codebase_*]
@Tafkas
Tafkas / fitbit_stride_regression.R
Created Dec 19, 2014
Fitbit Stride Length Linear Regression
View fitbit_stride_regression.R
runs <- read.csv("myrunninglog.csv", header=T, sep=",")
#convert date
runs$Date <- strptime(as.character(runs$Date), format="%Y-%m-%d")
#convert distance from km to meters
runs$Distance <- 1000 * runs$Distance
ggplotRegression <- function (fit) {
@Tafkas
Tafkas / berlin_marathon_2014_participants.R
Created Nov 13, 2013
Distribution of Birth Year and Top 10 Participating Nations in Berlin Marathon 2014
View berlin_marathon_2014_participants.R
Distribution of Birth Year and Top 10 Participating Nations in Berlin Marathon 2014
setwd("~/")
bm <- read.csv("BerlinMarathon2014.csv", header=T)
library(ggplot2)
p <- ggplot(bm, aes(birth_date, ..density..))
p <- p + geom_histogram(binwidth=1, colour = "black", fill = "lightblue") + geom_density()
p + ggtitle("Distribution of Birth Year for the Berlin Marathon 2014") + xlab("Year of Birth") + ylab("Density")
# get the top 10 particpating nations
@Tafkas
Tafkas / activity_extractor.py
Created Nov 17, 2013
Extracts duration from gpx and tcx files for further processing
View activity_extractor.py
#!/usr/local/bin/python
# encoding: utf-8
"""
activity_extractor.py
Created by Christian Stade-Schuldt on 2013-10-29.
"""
import os
from lxml import etree as et
from datetime import timedelta, datetime
@Tafkas
Tafkas / goeuro_test.py
Created Nov 21, 2013
Python solution to the GoEuroTest
View goeuro_test.py
#!/usr/bin/env python
# encoding: utf-8
"""
Created by Christian Stade-Schuldt on 2013-11-12.
"""
import sys
import os
import csv
import json
@Tafkas
Tafkas / rouletty.py
Created Dec 9, 2013
A simulation of the martingale roulette system
View rouletty.py
#!/usr/local/bin/python
# encoding: utf-8
import random
import time
import matplotlib.pyplot as plt
import numpy as np
#simulates the martingale roulette system
def simulation():
@Tafkas
Tafkas / AtlanticCity10Miler.r
Created Dec 9, 2013
Some charts of the St. Pat's 10 Miler and 5K 2008
View AtlanticCity10Miler.r
data <- read.csv(file = "2008TenMiler.csv", header = TRUE, sep=",")
summary(data)
data <- na.omit(data)
#convert time to minutes
data$Nettime <- as.character(data$Nettime)
data$Nettime <- sapply(strsplit(data$Nettime, ":"),
function(x) {
x <- as.numeric(x)
x[1]*60 + x[2] + x[3]/60
You can’t perform that action at this time.