find_google_history.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. # google happily tells us what we googled at particular points in time
  3. # their arguments are microseconds since the beginning of the epoch
  4. # Copyright © 2016, 2018 Jeffrey Cliff
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or (at
  9. # your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. # General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. function google_history_for_day
  19. {
  20. # echo $1
  21. # echo $2
  22. echo `date +"%s"`000000 - $1 | bc > /tmp/tmp_1
  23. echo `date +"%s"`000000 - $2 | bc > /tmp/tmp_2
  24. MIN=`cat /tmp/tmp_1`
  25. MAX=`cat /tmp/tmp_2`
  26. echo "https://myactivity.google.com/myactivity?max=$MAX&min=$MIN"
  27. }
  28. # this would probably have been easier in lua
  29. # leap years make this kind of ugly.
  30. # ONE_MIN_Y=31622400000000
  31. ONE_MAX_Y=31536000000000
  32. MIN_Y=31622400000000
  33. MAX_Y=31536000000000
  34. STUPID_LEAP_YEAR=86400000000
  35. google_history_for_day $MIN_Y $MAX_Y
  36. MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
  37. MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
  38. google_history_for_day $MIN_Y $MAX_Y
  39. MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
  40. MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
  41. google_history_for_day $MIN_Y $MAX_Y
  42. MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
  43. MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
  44. google_history_for_day $MIN_Y $MAX_Y
  45. MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
  46. MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
  47. MIN_Y=`echo $MIN_Y + $STUPID_LEAP_YEAR | bc`
  48. MAX_Y=`echo $MAX_Y + $STUPID_LEAP_YEAR | bc`
  49. google_history_for_day $MIN_Y $MAX_Y
  50. MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
  51. MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
  52. google_history_for_day $MIN_Y $MAX_Y
  53. MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
  54. MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
  55. google_history_for_day $MIN_Y $MAX_Y
  56. MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
  57. MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
  58. google_history_for_day $MIN_Y $MAX_Y
  59. MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
  60. MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
  61. MIN_Y=`echo $MIN_Y + $STUPID_LEAP_YEAR | bc`
  62. MAX_Y=`echo $MAX_Y + $STUPID_LEAP_YEAR | bc`
  63. google_history_for_day $MIN_Y $MAX_Y
  64. MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
  65. MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
  66. google_history_for_day $MIN_Y $MAX_Y
  67. MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
  68. MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
  69. google_history_for_day $MIN_Y $MAX_Y
  70. MIN_Y=`echo $MIN_Y + $ONE_MAX_Y | bc`
  71. MAX_Y=`echo $MAX_Y + $ONE_MAX_Y | bc`
  72. google_history_for_day $MIN_Y $MAX_Y