Added run alias and some random bash scripts

This commit is contained in:
Random936
2025-09-30 19:48:54 -07:00
commit cd69ef9e7d
7 changed files with 63 additions and 0 deletions

12
aliases.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
SCRIPT_DIR="$(dirname $(realpath "$0"))"
function run() {
if [ $# -lt 2 ]; then
echo "Usage: $0 <category> <script> [args...]"
return
fi
bash "$SCRIPT_DIR/$1/$2.sh" ${@:3}
}

4
hello/world.sh Normal file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
echo "Hello world!"
echo "Remaining arguments: $@"

7
i3/switch.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
autorandr -l undocked
autorandr -l docked
sleep 5
ps aux | grep polybar | awk '{ if (NR > 1) print prev; prev = $2}' | xargs kill
~/.screenlayout/polybar.sh
~/.screenlayout/wallpapers.sh

15
nixos/update.sh Executable file
View File

@@ -0,0 +1,15 @@
update() {
cd ~/dotfiles
git pull
sudo nixos-rebuild switch --flake ~/dotfiles
home-manager switch --flake ~/dotfiles
}
# Nixos VMs
ssh media@media.randomctf.com -t "$(typeset -f update); update"
ssh logging@logging.randomctf.local -t "$(typeset -f update); update"
ssh mindforge@mindforge.randomctf.local -t "$(typeset -f update); update"
ssh sampledb@sampledb.randomctf.local -t "$(typeset -f update); update"
# Ubuntu VMs
ssh pbx@pbx.randomctf.local -t "sudo apt update -y && sudo apt upgrade -y"

7
tld/cleanup.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
ROOT="$HOME/backup_tld"
for save in $(find . -mindepth 1 -maxdepth 1 -type d | cut -d '/' -f 2 | sort -n | head -n -3); do
rm -rf "$ROOT/$save"
done

13
tld/restore.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
if [[ $# < 1 ]]; then
echo "Please provide save name (eg. sandbox2)"
exit
fi
ROOT="$HOME/backup_tld"
latest=$(find $ROOT -mindepth 1 -maxdepth 1 -type d | rev | cut -d '/' -f 1 | rev | sort -nr | head -n 1)
echo "Restoring save $latest/$1"
cp "$ROOT/$latest/$1" "$HOME/.local/share/Hinterland/TheLongDark/Survival/"

5
tld/save.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
backup=$(date +%s)
mkdir "$HOME/backup_tld/$backup"
cp -R "$HOME/.local/share/Hinterland/TheLongDark/Survival/"* "$HOME/backup_tld/$backup"