Privacy
I try to keep my information as private as possible. Well…as possible without creating so much friction that I’d pull my hair out. Here are some things I do.
Bitwarden
List Last 10 Created Bitwarden Logins
I hate that the Bitwarden Mac client doesn’t let you sort except by name. Sometimes I created an account recently but I can’t remember the site. So I end up exporting out the logins in json format and then running the following query to see the last few logins that were created in the hopes of identifying the right login by name:
jq '.items | sort_by(.creationDate) | reverse | .[0:10] | .[].id' < export.json
This is assuming jq is installed and export.json is the name of your exported login file.
Pi-hole
Determine Number of Queries from Last X Days
Assuming you are running Pi-hole directly on a machine (not Docker), and you want to see the number of queries over the last few day:
sqlite3 "/etc/pihole/pihole-FTL.db" \
"SELECT \
strftime( \
'%Y-%m-%d', \
datetime(timestamp, 'unixepoch') \
) AS day, \
COUNT(*) AS count \
FROM \
queries \
WHERE \
timestamp > strftime('%s', 'now', '-30 days') \
AND timestamp < strftime('%s', 'now') \
GROUP BY \
day;"
If you need to set different timestamps, use an epoch converter.
Check Pi-hole status the API
curl "http://<IP>:<PORT>/admin/api.php?status&auth=<API TOKEN>"
The API token can be found at /admin/settings.php?tab=api through the web UI.
Turn on Pi-hole using API
curl "http://<IP>:<PORT>/admin/api.php?enable&auth=<API TOKEN>"
Turn off Pi-hole using API
curl "http://<IP>:<PORT>/admin/api.php?disable=3600&auth=<API TOKEN>"
Set the disable time in seconds.
Blocking IP ranges
Using ipset and iptables for blocking - I see plenty of people asking for IP blocking functionality in Pi-hole, but that’s not really the goal of Pi-hole.