#!/bin/sh # A bunch of miscellaneous tasks I often forget the commands for. set -e source ~/.profile case "$@" in turn\ wifi\ on|turn\ the\ wifi\ on|wifi\ on) nmcli radio wifi on;; turn\ wifi\ off|turn\ the\ wifi\ off|wifi\ off) nmcli radio wifi off;; toggle\ wifi|refresh\ wifi|reload\ wifi\|wifi\ toggle) echo "Toggling wifi off and on again..." nmcli radio wifi off sleep 1 nmcli radio wifi on ;; connect\ to\ wifi|wifi) nmtui;; bright) xbacklight -set "30";; dim\ the\ screen|dim\ screen|dim) xbacklight -set "0.1";; screen\ off|turn\ screen\ off|turn\ the\ screen\ off) xbacklight -set "0";; mute) amixer set Master off;; unmute) amixer set Master on;; sync) src="$(ask -p "Which dir? ")" dest="$(ask -p "To where? " -q "$src")" if ! expr "$src" : ".*/$"; then src="$src/"; fi rsync -ahzt --partial --info=progress2 bruce@"$CLUNKER_IP":"$src" "$dest";; mount\ desktop|mount\ clunker) sshfs bruce@"$CLUNKER_IP":/ ~/clunker -o reconnect;; unmount\ clunker) umount ~/clunker;; sleep\ clunker|hibernate\ clunker) ssh -t bruce@"$CLUNKER_IP" 'systemctl hibernate';; mount\ website|website) sshfs bphill@bruce-hill.com:/home/bphill ~/bruce-hill.com -o reconnect;; unmount\ website) umount ~/bruce-hill.com;; mount\ usb) sudo mount /dev/sda1 /mnt;; unmount\ usb|remove\ usb) sudo umount /mnt;; hdmi) xrandr --output DP3 --mode auto --primary;; update\ clock|update\ time) sudo ntpd -gq;; uh) nvim ~/scripts/uh;; *) printf "Not a recognized \033[1muh\033[0m command:\033[31;1m %s\033[0m\n" "$@" exit 1; esac