commit 64dcbd3457030f850ab24aff93e55526f3e276b7
parent 41aeedb8e287e4050d4b38ae07933363e682c043
Author: regexghost <dev@regexghost.com>
Date: Sun, 2 Aug 2026 21:52:47 +0100
a bunch of minor tweaks to my terminal-scripts
Diffstat:
12 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/terminal-scripts/backup.sh b/terminal-scripts/backup.sh
@@ -19,7 +19,7 @@ elif [ "$1" = "make" ]; then
date +"%y-%m-%d" >> "$XDG_DATA_HOME/regexghost/script-data/backup-history.txt"
rsync -ar --links --delete --info=progress2 "${BACKUP_LOCATION}/latest/" "${BACKUP_LOCATION}/previous/"
rsync -ar --links --delete --info=progress2 --files-from="${BACKUP_FILE}" "$HOME" "${BACKUP_LOCATION}/latest/"
- hashFile="${BACKUP_LOCATION}/hashes/$(date +"%y%m%d").txt"
+ hashFile="${BACKUP_LOCATION}/hashes/$(date +"%y%m%d-%H%M").txt"
while read -r thing; do
echo "Hashing: ${HOME}${thing}"
[ -f "${HOME}${thing}" ] && sha256sum "${HOME}${thing}" >> "$hashFile"
diff --git a/terminal-scripts/balance-folders.sh b/terminal-scripts/balance-folders.sh
@@ -8,6 +8,7 @@ dirs=( $(find "$1" -type d) )
IFS="$oldIFS"
for dir in "${dirs[@]}"; do
+ # Only leaf dirs, in theory should be no music in non-leaf dirs
if [ "$(find "$dir" -type d | wc -l)" -gt 2 ]; then
continue
fi
diff --git a/terminal-scripts/blog-devlog.sh b/terminal-scripts/blog-devlog.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+# Helper scripts for my blog and devlog
+
blog () {
dir="$HOME/Programs/websites/personal-website/blog/$(date +%Y/%B | awk '{print tolower($0)}')"
[ -d "$dir" ] || mkdir -p "$dir"
diff --git a/terminal-scripts/cmpfolder.sh b/terminal-scripts/cmpfolder.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Script to compare two folders to ensure they are byte for byte identical
+# Script to compare two folders to ensure they are byte for byte identical
if [[ "$2" == "" ]]; then
echo "Usage: ./cmpfolder.sh [-o] folder1 folder2"
diff --git a/terminal-scripts/github-latest-release.sh b/terminal-scripts/github-latest-release.sh
@@ -8,6 +8,7 @@ if [[ "$site" == "github" ]] || [[ "$site" == "gh" ]]; then
latest_tag=$(curl -w "%{redirect_url}" https://github.com/${user_name}/${repo_name}/releases/latest/ | sed 's/.*\///g')
echo https://github.com/${user_name}/${repo_name}/archive/refs/tags/${latest_tag}.zip
elif [[ "$site" == "codeberg" ]] || [[ "$site" == "cb" ]]; then
+ # Sometimes this doesn't work due to browser checks
latest_tag=$(curl -w "%{redirect_url}" https://codeberg.org/${user_name}/${repo_name}/releases/latest/ | sed -nE 's/.*tag\/([^"]*)">.*/\1/p')
echo https://codeberg.org/${user_name}/${repo_name}/archive/${latest_tag}.zip
elif [[ "$site" == "sourcehut" ]] || [[ "$site" == "srht" ]]; then
diff --git a/terminal-scripts/iphone-mount.sh b/terminal-scripts/iphone-mount.sh
@@ -34,6 +34,10 @@ elif [[ "$1" == "pocketbookmount" ]]; then
idevicepair validate
idevicepair pair || exit
ifuse --documents com.obreey.reader "$MOUNTPOINT"
+elif [[ "$1" == "comicbookreadermount" ]]; then
+ idevicepair validate
+ idevicepair pair || exit
+ ifuse --documents com.realvirtuality.Comic-Book-Reader "$MOUNTPOINT"
elif [[ "$1" == "unmount" ]] || [[ "$1" == "umount" ]]; then
fusermount -u "$MOUNTPOINT"
elif [[ "$1" == "force" ]]; then
diff --git a/terminal-scripts/iphone-music-sync.sh b/terminal-scripts/iphone-music-sync.sh
@@ -24,13 +24,12 @@ ifuse --documents com.foobar2000.mobile "$MOUNT_LOCATION"
# Copy/update playlists
-
while read -r line; do
- local="$(echo "$line" | cut -d "," -f 1)"
+ computer="$(echo "$line" | cut -d "," -f 1)"
phone="$(echo "$line" | cut -d "," -f 2)"
- echo "${local} -> ${phone}"
+ echo "${computer} -> ${phone}"
[ -d "${MOUNT_LOCATION}/${phone}" ] || mkdir "${MOUNT_LOCATION}/${phone}"
- rsync -vr --copy-links --update --delete --modify-window=1 --info=progress2 "${HOME}/Music/${local}/" "${MOUNT_LOCATION}/${phone}/"
+ rsync -vr --copy-links --update --delete --modify-window=1 --info=progress2 "${HOME}/Music/${computer}/" "${MOUNT_LOCATION}/${phone}/"
find "${MOUNT_LOCATION}/${phone}/" -type f | sort | sed "s|.*${phone}/|../${phone}/|g" > "/tmp/${phone}.m3u8"
cp "/tmp/${phone}.m3u8" "${MOUNT_LOCATION}/Playlists/"
done < "$XDG_CONFIG_HOME/regexghost/playlists-phone-sync.csv"
diff --git a/terminal-scripts/opus-single.sh b/terminal-scripts/opus-single.sh
@@ -17,7 +17,7 @@ for file in "${files[@]}"; do
filename="$(basename "$file" | sed 's/.m4a//g')"
outputDir="$(dirname "$outputFile")"
mkdir -p "$outputDir"
-
+
success=no
ffmpeg -y -i "$file" -map 0:1 "${outputDir}/${filename}.jpg" && success=yes
ffmpeg -i "$file" -b:a "${BITRATE_KBPS}000" "$outputFile"
diff --git a/terminal-scripts/opus-soundtrack.sh b/terminal-scripts/opus-soundtrack.sh
@@ -21,7 +21,6 @@ for dir in "${dirs[@]}"; do
echo "First File: ${firstFile}"
ffmpeg -y -i "$firstFile" -map 0:1 "$dir/output.jpg"
cp "${dir}/output.jpg" "${outputDir}/output.jpg"
- # [[ "$dir" == *"Other"* ]] && exit
done
i=0
diff --git a/terminal-scripts/qmount.sh b/terminal-scripts/qmount.sh
@@ -2,6 +2,7 @@
mount_points="~/Downloads/USBDrive
~/Downloads/BackupMount"
+
root_device="$(/usr/bin/lsblk -l -n --output NAME,MOUNTPOINTS | grep '/$' | sed 's/p[0-9] \///g; s/[0-9] \///g')"
mount () {
@@ -15,10 +16,12 @@ mount () {
[ "$chosen_partition" = "" ] && exit
chosen_mount_point="$(echo "$mount_points" | fzf | sed "s|~|$HOME|")"
[ "$chosen_mount_point" = "" ] && exit
+
args=""
if [ "$chosen_fstype" = "vfat" ] || [ "$chosen_fstype" = "exfat" ]; then
args="-o rw,users,umask=000"
fi
+
sudo mount $args "/dev/${chosen_partition}" "$chosen_mount_point" && notify-send "Mounted Successfully" || notify-send "Mount Failed"
}
@@ -28,6 +31,7 @@ unmount () {
chosen_path="$(echo "$mounted" | fzf | cut -d " " -f 2-)"
[ "$chosen_path" = "" ] && exit
+
sudo umount "$chosen_path" && notify-send "Unmounted Successfully" || notify-send "Unmounting Failed"
}
diff --git a/terminal-scripts/rm-trash.sh b/terminal-scripts/rm-trash.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# wrapper script around the rm, and trash-cli commands
+# Wrapper script around the rm, and trash-cli commands
command="trash-put"
dialog="rm: Trash"
diff --git a/terminal-scripts/stream-check.sh b/terminal-scripts/stream-check.sh
@@ -3,7 +3,7 @@
CONFIG_FILE="$XDG_CONFIG_HOME/regexghost/streams.csv"
format="pretty"
-[ "$1" = "-yn" ] && format="yn" && shift
+[ "$1" = "-yn" ] && format="yn" && shift # Pretty print, or just yes/no (for scripts)
line="$(grep "^${1}," "$CONFIG_FILE")"
[ "$line" = "" ] && exit