Skip to content

Instantly share code, notes, and snippets.

@laurivaltteri
Last active September 11, 2017 11:39
Show Gist options
  • Save laurivaltteri/d7974de3402f17d99b3a52549eee7432 to your computer and use it in GitHub Desktop.
Save laurivaltteri/d7974de3402f17d99b3a52549eee7432 to your computer and use it in GitHub Desktop.
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
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment