This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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(): | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 [email protected] | |
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
decodeLine <- function(encoded){ | |
require(bitops) | |
vlen <- nchar(encoded) | |
vindex <- 0 | |
varray <- NULL | |
vlat <- 0 | |
vlng <- 0 | |
while(vindex < vlen){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
pysml.py | |
Created by Christian Stade-Schuldt on 2014-10-25. | |
""" | |
import sys | |
import os | |
import datetime |