scripts/housekeeping

51 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Run karn on all work projects so that my git identities are correct
WORK_ROOT="/home/nemo/projects/work/razorpay"
find $WORK_ROOT -maxdepth 2 -type d -iname .git | xargs -I{} bash -c "cd {}/.. && karn update"
PERSONAL_ROOT="/home/nemo/projects/personal"
find $PERSONAL_ROOT -maxdepth 2 -type d -iname .git | xargs -I{} bash -c "cd {}/.. && karn update"
# Cleanup yay-cache
find /home/nemo/.cache/yay -iregex '.*\.\(bz2\|tar\|zip\|deb\|xz\|gz\)$' -delete
# Remove orphan packages
sudo pacman -Rns $(pacman -Qtdq)
# Delete pacman cache files older than 7 days
sudo find /var/cache/pacman/pkg -maxdepth 1 -mindepth 1 -mtime +7 -delete
# Clear systemd logs
sudo journalctl --vacuum-size=100M
# Clear docker stuff
sudo docker system prune -af
## KEEP ALL NETWORK RELATED STUFF BELOW THIS
echo "Going to try stuff that needs network access now"
# Push passwords to keybase
pass git pushall
# Sync mobile passwords
cd /home/nemo/projects/personal/mobile-passwords
git from && ./runme.sh && git pushall
# Sync mobile passwords
pushd /home/nemo/projects/personal/mobile-passwords
git from && ./runme.sh && git push origin master
popd
# Generate a blacklist hosts file
if ping -c 1 192.168.1.1 &> /dev/null
then
# Generate the Blacklist
pushd /home/nemo/projects/personal/dnscrypt-proxy/contrib/
python2 ./generate-domains-blacklist.py > blacklist.txt
blacklist2hosts.php blacklist.txt hosts
popd
else
echo 0
fi