justfiles for automating various tasks on my workstation

Add more

Changed files
+68
+68
utilities.just
···
set unstable := true
set script-interpreter := ["uv", "run", "--script"]
+
# List systemd services
+
[group('utilities')]
+
lssvc:
+
sudo systemctl list-units --type=service
+
+
# Copy public IPv4 address
+
[group('utilities')]
+
pubip:
+
curl -s -m 5 ipv4.icanhazip.com | xclip -selection clipboard
+
+
# Copy SSH public key
+
[group('utilities')]
+
pubkey:
+
#!/usr/bin/env zsh
+
cat "${HOME}/.ssh/id_ed25519.pub" | tr -d '\n' | xclip -selection clipboard
+
echo "--> SSH public key copied to clipboard"
+
+
# Generate a pseudo-random 16-character string
+
[group('utilities')]
+
genrand:
+
openssl rand -base64 16
+
+
# Remove all .jpeg, .jpg, .png, .svg, .webp files from downloads
+
[group('utilities')]
+
rmimages:
+
#!/usr/bin/env bash
+
find "${HOME}/downloads" \
+
-maxdepth 1 \
+
-type f \
+
\( -name "*.jpg" -o -name "*.jpg_original" -o -name "*.jpeg" -o -name "*.svg" -o -name "*.png" -o -name "*.webp" \) \
+
-delete
+
+
# Remove ISOs and disk images from downloads
+
[group('utilities')]
+
rmdimages:
+
#!/usr/bin/env bash
+
find "${HOME}/downloads" \
+
-maxdepth 1 \
+
-type f \
+
\( -name "*.iso" -o -name "*.img" \) \
+
-delete
+
+
# Clear downloads folder
+
[group('utilities')]
+
cldl:
+
#!/usr/bin/env bash
+
rm -rf "${HOME}/downloads/"*
+
+
# List zshrc aliases
+
[group('utilities')]
+
lsali:
+
#!/usr/bin/env zsh
+
_begin_line=$(grep -n "### ALIASES" ~/.zshrc | awk -F: '{print $1}')
+
_end_line=$(grep -n "### BINDINGS" ~/.zshrc | awk -F: '{print $1}')
+
_end_line=$(( $_end_line - 2 ))
+
_quit_line=$(( $_end_line + 1 ))
+
sed -n "${_begin_line},${_end_line}p;${_quit_line}q" ~/.zshrc | bat -l zsh
+
+
# List zshrc functions
+
[group('utilities')]
+
lsfun:
+
#!/usr/bin/env zsh
+
_begin_line=$(grep -n "### FUNCTIONS" ~/.zshrc | awk -F: '{print $1}')
+
_end_line=$(grep -n "### FZF" ~/.zshrc | awk -F: '{print $1}')
+
_end_line=$(( $_end_line - 2 ))
+
_quit_line=$(( $_end_line + 1 ))
+
sed -n "${_begin_line},${_end_line}p;${_quit_line}q" ~/.zshrc | bat -l zsh
+
# Quickly copy the Tailscale install command
[group('utilities')]
copy-ts-cmd: