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
# 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) |
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 | |
# 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 |
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
## 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 |