Cleanup your Google Chrome/Chromium history
Just wanted to share this with you.
#!/bin/zsh
if [ a$(uname) = aDarwin ]
then dbfile="$HOME/Library/Application Support/Google/Chrome/Default/History"
else dbfile="$HOME/.chromium/???"; fi
blacklistfile=$HOME/.config/history-blacklist
if [ ! -f $dbfile ]
then echo "oops! history db '$dbfile' not found!";
exit -1; fi
if [ ! -f $blacklistfile ]
then echo "oops! blacklist not found! please create '$blacklistfile' (see doc).";
exit -2; fi
filter=""
while read i; do filter="\n url like '$i' or ${filter}"; done < $blacklistfile
request="delete from urls where ${filter% or };"
echo -n "Do you want to execute:\n'${request}'\nin your chrome history db? [y/N] "
read answer; case $answer in
y|Y) echo $request | sqlite3 $dbfile; return $?;;
*) echo "mission abort, pu\$\$y!";; esac
And in $HOME/.config/history-blacklist, use something like:
%4chan.org% %4chanarchive.org% %piratebay.org% %youtube.com%
You need to close Chromium/Chrome before running this script (else you’ll hit a permanent db lock).
