dotfiles

regexghost dotfiles and scripts
git clone https://git.regexghost.com/dotfiles.git
Log | Files | Refs | README

commit bc36148dc28d9bbc49416ba337fe90951d46cd2a
parent d6fea8bcabc2af4fbebcd488f906ad1622520dc4
Author: regexghost <dev@regexghost.com>
Date:   Wed,  8 Jul 2026 13:38:00 +0100

added my local media-cut and iphone scripts to the repo

Diffstat:
Rfirefox.md -> guides/firefox.md | 0
MotherPrograms.sh | 11+++++++++++
Mterminal-scripts/Makefile | 3+++
Aterminal-scripts/iphone-mount.sh | 43+++++++++++++++++++++++++++++++++++++++++++
Aterminal-scripts/iphone-music-sync.sh | 39+++++++++++++++++++++++++++++++++++++++
Aterminal-scripts/media-cut.sh | 27+++++++++++++++++++++++++++
6 files changed, 123 insertions(+), 0 deletions(-)

diff --git a/firefox.md b/guides/firefox.md diff --git a/otherPrograms.sh b/otherPrograms.sh @@ -301,6 +301,14 @@ alpine () { cd .. } +dotacat () { + git clone https://gitlab.scd31.com/sophie/dotacat.git + cd dotacat + cargo build --release + cp target/release/dotacat ~/.local/bin/dotacat + cd .. +} + build () { read -p "q to quit, s to skip (next: $1)" qToQuit [ "$qToQuit" = "q" ] && exit @@ -332,6 +340,7 @@ elif [ "$1" = "notmine" ]; then build sbase build sxiv build alpine + build dotacat build retroarch echo "done" elif [ "$1" = "jwm" ]; then @@ -378,6 +387,8 @@ elif [ "$1" = "sbase" ]; then sbase elif [ "$1" = "sxiv" ]; then sxiv +elif [ "$1" = "dotacat" ]; then + dotacat elif [ "$1" = "alpine" ]; then alpine else diff --git a/terminal-scripts/Makefile b/terminal-scripts/Makefile @@ -34,3 +34,6 @@ normal: cp login-bsky.sh ${BIN}/login-bsky cp favs-backup.sh ${BIN}/favs-backup cp balance-folders.sh ${BIN}/balance-folders + cp iphone-mount.sh ${BIN}/iphone-mount + cp iphone-music-sync.sh ${BIN}/iphone-music-sync + cp media-cut.sh ${BIN}/media-cut diff --git a/terminal-scripts/iphone-mount.sh b/terminal-scripts/iphone-mount.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +MOUNTPOINT="$HOME/Downloads/USBDrive" + +if [[ "$1" == "mount" ]]; then + idevicepair validate + idevicepair pair || exit + ifuse "$MOUNTPOINT" +elif [[ "$1" == "fbmount" ]]; then + idevicepair validate + idevicepair pair || exit + ifuse --documents com.foobar2000.mobile "$MOUNTPOINT" +elif [[ "$1" == "vlcmount" ]]; then + idevicepair validate + idevicepair pair || exit + ifuse --documents org.videolan.vlc-ios "$MOUNTPOINT" +elif [[ "$1" == "infusemount" ]]; then + idevicepair validate + idevicepair pair || exit + ifuse --documents com.firecore.infuse "$MOUNTPOINT" +elif [[ "$1" == "pdfmount" ]]; then + idevicepair validate + idevicepair pair || exit + ifuse --documents com.pspdfkit.viewer "$MOUNTPOINT" +elif [[ "$1" == "readeramount" ]]; then + idevicepair validate + idevicepair pair || exit + ifuse --documents org.readera.book-reader "$MOUNTPOINT" +elif [[ "$1" == "ashellmount" ]]; then + idevicepair validate + idevicepair pair || exit + ifuse --documents org.AsheKube.app.a-Shell "$MOUNTPOINT" +elif [[ "$1" == "pocketbookmount" ]]; then + idevicepair validate + idevicepair pair || exit + ifuse --documents com.obreey.reader "$MOUNTPOINT" +elif [[ "$1" == "unmount" ]] || [[ "$1" == "umount" ]]; then + fusermount -u "$MOUNTPOINT" +elif [[ "$1" == "force" ]]; then + fusermount -uz "$MOUNTPOINT" +fi + +echo "Done" diff --git a/terminal-scripts/iphone-music-sync.sh b/terminal-scripts/iphone-music-sync.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +MOUNT_LOCATION="$HOME/Downloads/USBDrive" + +# Mount phone + +if ! lsusb | grep -q Apple; then + echo "Plug in iPhone" + exit +fi + +idevicepair validate +idevicepair pair + +[[ "$?" == "0" ]] || exit + +ifuse --documents com.foobar2000.mobile "$MOUNT_LOCATION" + +[[ "$?" == "0" ]] || exit + +# Create folder for playlists + +[ -d "${MOUNT_LOCATION}/Playlists" ] || mkdir "${MOUNT_LOCATION}/Playlists" + +# Copy/update playlists + + +while read -r line; do + local="$(echo "$line" | cut -d "," -f 1)" + phone="$(echo "$line" | cut -d "," -f 2)" + echo "${local} -> ${phone}" + [ -d "${MOUNT_LOCATION}/${phone}" ] || mkdir "${MOUNT_LOCATION}/${phone}" + rsync -vr --update --delete --modify-window=1 --info=progress2 "${HOME}/Music/${local}/" "${MOUNT_LOCATION}/${phone}/" + find ~/Music/"${local}/" -type f | sort | sed "s|.*${local}/|../${phone}/|g" > "/tmp/${phone}.m3u8" + cp "/tmp/${phone}.m3u8" "${MOUNT_LOCATION}/Playlists/" +done < "$XDG_CONFIG_HOME/regexghost/playlists-phone-sync.csv" + +fusermount -u "${MOUNT_LOCATION}" +idevicepair unpair diff --git a/terminal-scripts/media-cut.sh b/terminal-scripts/media-cut.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Script to cut media file without re-encoding + +if [[ "$#" != "4" ]]; then + echo "Usage:" + echo " ./media_cut.sh input_file start_time end_time output_file" + exit +fi + +input_file="$1" +start_time="$2" +end_time="$3" +output_file="$4" + +cut_time=$(awk -v start="$start_time" -v end="$end_time" ' + BEGIN { + split(start, a, ":") + split(end, b, ":") + t1 = a[1]*3600 + a[2]*60 + a[3] + t2 = b[1]*3600 + b[2]*60 + b[3] + diff = t2 - t1 + printf "%02d:%02d:%02d\n", diff/3600, diff%3600/60, diff%60 + } +') + +ffmpeg -v quiet -stats -ss "$start_time" -i "$input_file" -to "$cut_time" -c copy "$output_file"