Skip to content

Instantly share code, notes, and snippets.

View laurivaltteri's full-sized avatar

Lauri laurivaltteri

View GitHub Profile
@laurivaltteri
laurivaltteri / beddit_cloud_to_csv.py
Last active July 13, 2018 16:37
Beddit cloudapi data wrapper to .csv-file
## python snippet to extract some elements from BEDDIT couldapi json struct
## and save them to .csv-file
## USAGE: beddit_cloud_to_csv.py <number_of_days_included>
## number of days defaults to seven
## CC laurivaltteri
import sys, os
import requests, csv
from datetime import date, timedelta, datetime
@laurivaltteri
laurivaltteri / lweek_chrome_history.sh
Last active September 11, 2017 11:39
Script for downloading weekly internet history from google
#!./bin/bash
# redirect all IO to /dev/null
exec 1>/dev/null 2>/dev/null
# copy History to /tmp to unlock
cp /Users/laurivaltteri/Library/Application\ Support/Google/Chrome\ Canary/Default/History /tmp/history.sql
keysfile=$(date +"%Y%m%d")"_keywrds.log"
histfile=$(date +"%Y%m%d")"_history.log"
# send query to the copien database to save last week's data to $now_history -file
/usr/bin/sqlite3 /tmp/history.sql "select lower_term from keyword_search_terms" > /Users/laurivaltteri/Google\ Drive/quantified_me/browsing_history/$keysfile
/usr/bin/sqlite3 /tmp/history.sql "select * from urls where last_visit_time between (strftime('%s',datetime('now','-7 days')) - strftime('%s','1601-01-01'))*1000000 and (strftime('%s','now') - strftime('%s','1601-01-01'))*1000000" > /Users/laurivaltteri/Google\ Drive/quantified_me/browsing_history/$histfile
@laurivaltteri
laurivaltteri / firstbeat_analyses.R
Last active October 5, 2018 16:43
Testing correlation between data gathered with Firstbeat device against data from Oura cloud (from the ring) and Google Fit cloud (multiple devices)
# It's fake
# Data from cloud but already on computer
# Testing self measurement devices
# CC Lauri Ahonen 2018
require(scales)
library(tidyverse)
library(lubridate)
library(jsonlite)