Skip to content

Instantly share code, notes, and snippets.

View willpower232's full-sized avatar
Hey there! I am using GitHub.

Will Power willpower232

Hey there! I am using GitHub.
View GitHub Profile
willpower232 /
Created August 6, 2022 11:06
add your tailscale IPs to your hosts file when you're scared of messing up your DNS
tailscale status | while IFS= read -r aHost; do
hostname=$(echo "$aHost" | awk '{print $2}' | cut -d '-' -f 1)
ip=$(echo "$aHost" | awk '{print $1}')
hostctl add domains tailscale "$hostname.ts" --ip "$ip"
willpower232 / postal_database_size.sql
Last active February 3, 2020 14:27
get the Postal database size for each mail server
SELECT sizes.dbname, orgs.`name` AS org, servers.`name` AS `server`, sizes.size
SELECT substring(sizes.table_schema, 15) AS fakeid, sizes.table_schema AS dbname, ROUND(SUM(sizes.data_length + sizes.index_length) / 1024 / 1024, 1) AS size
FROM information_schema.`TABLES` AS sizes
GROUP BY sizes.table_schema
) AS sizes, postal.servers AS servers, postal.organizations AS orgs
WHERE = sizes.fakeid
AND servers.organization_id =
ORDER BY org, `server`
willpower232 /
Created January 27, 2020 16:47
Interactive terminal menu to download an asset from a known github repo release
# usage
# mozilla/sops
# mozilla/sops 3.4.0
if ! [ -x "$(command -v jq)" ]; then
echo 'Error: jq is not installed.' >&2
exit 1
willpower232 /
Created December 13, 2019 11:10
Create an AWS Route53 zone in a delegation set and change the NS record to match your vanity nameservers
if [ -z "$1" ]; then
echo "Please specify domain name"
exit 1
willpower232 /
Created December 13, 2019 10:06
How to loop through folders in AWS S3, select a file, and download it
# if you're looking for a specific file extension
# you can do something like this instead
# while [[ "$target" != *.tgz ]]; do
# while there is a slash at the end of the path
willpower232 /
Last active November 17, 2022 09:35
dmenu script for pass
#!/usr/bin/env bash
# 1 - source copy from (
# 2 - make dmenu case insensitive
# 3 - correct include_username variable
# 4 - only pick out usernames if they are the start of the sentence, i.e. ignore non-primary usernames listed in the file (mostly for bitbucket)
# 5 - dependency test and install
# 6 - error output on bad argument
shopt -s nullglob globstar
willpower232 /
Last active April 16, 2019 13:15
Setting up my perfect development environment in virtualbox



Definitely more ready out of the box also seems to cope with 3D in Virtualbox better


save 1.1GB for base install of 5.5GB apt remove mintstick transmission-gtk timeshift thunderbird xed simple-scan rhythmbox redshift-gtk pix xplayer libreoffice-* xviewer hexchat gimp firefox xreader baobab gnome-calendar gnome-calculator gnome-terminal blueberry gufw tomboy && apt autoremove

willpower232 / my.vimrc
Last active June 19, 2019 14:29
Guess I have to get into vim one day
" syntax highlighting
syntax on
" todo: experiment with colour schemes
"colorscheme elflord
" might help vim cope with random terminals and colours
" by reminding it that the background is dark
set background=dark
willpower232 /
Created January 22, 2018 10:35
Certbot with DNS verification and AWS route53 plugin
# run these first to install certbot globally with the route53 plugin
# $ sudo apt install python-setuptools
# $ sudo easy_install pip
# $ sudo -H pip install certbot-dns-route53
# verify the route53 plugin is present
# $ certbot plugins
willpower232 /
Created December 13, 2017 16:24
Reset Linux Home directory permissions based on /etc/passwd
chown root:root /home
chmod 755 /home
USERS=$(grep '/home' /etc/passwd | tr "\n" "\n")
for USER in $USERS