Skip to content

Instantly share code, notes, and snippets.

Christian Stade-Schuldt Tafkas

Block or report user

Report or block Tafkas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Tafkas
Tafkas / packt2slack.py
Last active Oct 9, 2017
ebook monkey script for posting Packt free technology eBook to Slack
View packt2slack.py
import json
import re
import requests
from lxml import html
BASEURL = 'https://www.packtpub.com'
HEADER = {'User-Agent': 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'}
OUTPUT = {'pav': {'channel': "#ebook-monkey",
@Tafkas
Tafkas / decodeLine.R
Created Feb 12, 2014
Decode Encoded Polylines in R
View decodeLine.R
decodeLine <- function(encoded){
require(bitops)
vlen <- nchar(encoded)
vindex <- 0
varray <- NULL
vlat <- 0
vlng <- 0
while(vindex < vlen){
@Tafkas
Tafkas / here-theme.json
Last active May 4, 2018
HERE Theme for Deckset.app
View here-theme.json
{
"identifier": "7235481C-546B-4E32-B068-F24B1FAC0D42",
"name": "HERE Theme",
"customizations": {},
"baseTheme": {
"variantIdentifier": "scheme2",
"identifier": "next"
},
"creationDate": 1525381263.4608269,
"importDate": 1525442729.7030401,
View berlin_marathon_participants_2014.py
#!/usr/bin/env python
# encoding: utf-8
"""
berlin_marathon_participants_2014.py
Created by Christian Stade-Schuldt on 2013-11-12.
"""
import urllib
import json
@Tafkas
Tafkas / trendweight.r
Last active Aug 31, 2018
Chart your data from http://trendweight.com/export with ggplot2 in R
View trendweight.r
#read data
tw <- read.csv(file="TrendWeightData.csv",header=T)
summary(tw)
#remove interpolated values
tw <- tw[tw$WeightIsInterpolated == "False",]
#convert strings to date and extract year
tw$Date <- as.POSIXlt(as.character(tw$Date), format="%Y-%m-%d")
tw$Year <- tw$Date$year + 1900
@Tafkas
Tafkas / rmsle.py
Created Nov 25, 2013
Compute the Root Mean Squared Log Error for hypothesis h and targets y
View rmsle.py
import numpy as np
def rmsle(h, y):
"""
Compute the Root Mean Squared Log Error for hypthesis h and targets y
Args:
h - numpy array containing predictions with shape (n_samples, n_targets)
y - numpy array containing targets with shape (n_samples, n_targets)
"""
@Tafkas
Tafkas / fitbitdownload.gs
Created Jan 28, 2014
This script will access your Fitbit data via the Fitbit API and insert it into a Google spreadsheet.
View fitbitdownload.gs
/* FitbitDownload.gs
This script will access your Fitbit data via the Fitbit API and insert it into a Google spreadsheet.
The first row of the spreadsheet will be a header row containing data element names. Subsequent rows will contain data, one day per row.
Note that Fitbit uses metric units (weight, distance) so you may wish to convert them.
Original script by loghound@gmail.com
Original instructional video by Ernesto Ramirez at http://vimeo.com/26338767
Modifications by Mark Leavitt (PDX Quantified Self organizer) www.markleavitt.com
Further Modifications by Christian Stade-Schuldt blog.tafkas.net
Here's to your (quantified) health!
@Tafkas
Tafkas / collect_weather.py
Created May 18, 2016
A script to fetch weather data from OpenWeatherMap
View collect_weather.py
"""
Created by Christian Stade-Schuldt on 2014-07-28.
"""
import sqlite3
import json
import urllib
import time
import datetime
import calendar
@Tafkas
Tafkas / computeSunrise.js
Last active Sep 28, 2019
A simple sunrise-sunset algorithm taken from http://williams.best.vwh.net/sunrise_sunset_algorithm.htm in JavaScript
View computeSunrise.js
function computeSunrise(day, sunrise) {
/*Sunrise/Sunset Algorithm taken from
http://williams.best.vwh.net/sunrise_sunset_algorithm.htm
inputs:
day = day of the year
sunrise = true for sunrise, false for sunset
output:
time of sunrise/sunset in hours */
@Tafkas
Tafkas / collect_kostal.py
Created May 18, 2016
A script to fetch data from a Kostal Piko 5 inverter
View collect_kostal.py
#!/usr/local/bin/python
# encoding: utf-8
"""
collect_kostal.py
Created by Christian Stade-Schuldt on 2014-07-27.
"""
import urllib2
You can’t perform that action at this time.