1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #!/bin/bash
- # google happily tells us what we googled at particular points in time
- # their arguments are microseconds since the beginning of the epoch
- # Copyright © 2016, 2018 Jeffrey Cliff
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or (at
- # your option) any later version.
- #
- # This program is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- # General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
- function google_history_for_day
- {
- # echo $1
- # echo $2
- echo `date +"%s"`000000 - $1 | bc > /tmp/tmp_1
- echo `date +"%s"`000000 - $2 | bc > /tmp/tmp_2
- MIN=`cat /tmp/tmp_1`
- MAX=`cat /tmp/tmp_2`
- echo "https://myactivity.google.com/myactivity?max=$MAX&min=$MIN"
- }
- # this would probably have been easier in lua
- # leap years make this kind of ugly.
- # ONE_MIN_Y=31622400000000
- ONE_MAX_Y=31536000000000
- MIN_Y=31622400000000
- MAX_Y=31536000000000
- STUPID_LEAP_YEAR=86400000000
- google_history_for_day $MIN_Y $MAX_Y
- MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
- MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
- google_history_for_day $MIN_Y $MAX_Y
- MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
- MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
- google_history_for_day $MIN_Y $MAX_Y
- MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
- MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
- google_history_for_day $MIN_Y $MAX_Y
- MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
- MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
- MIN_Y=`echo $MIN_Y + $STUPID_LEAP_YEAR | bc`
- MAX_Y=`echo $MAX_Y + $STUPID_LEAP_YEAR | bc`
- google_history_for_day $MIN_Y $MAX_Y
- MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
- MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
- google_history_for_day $MIN_Y $MAX_Y
- MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
- MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
- google_history_for_day $MIN_Y $MAX_Y
- MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
- MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
- google_history_for_day $MIN_Y $MAX_Y
- MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
- MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
- MIN_Y=`echo $MIN_Y + $STUPID_LEAP_YEAR | bc`
- MAX_Y=`echo $MAX_Y + $STUPID_LEAP_YEAR | bc`
- google_history_for_day $MIN_Y $MAX_Y
- MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
- MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
- google_history_for_day $MIN_Y $MAX_Y
- MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
- MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
- google_history_for_day $MIN_Y $MAX_Y
- MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
- MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
- google_history_for_day $MIN_Y $MAX_Y
|