From 42c88c9eefb74b099f95797aa775e35a34874fde Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Fri, 15 Sep 2023 15:46:04 -0400 Subject: [PATCH] move bin to .local/bin --- .chezmoiexternal.toml | 24 ++++--- .chezmoiignore | 5 +- dot_config/environment | 4 +- dot_config/zsh/dot_zshrc | 11 --- dot_local/bin/executable_android-bt-snoop | 2 + dot_local/bin/executable_ffmpeg.bars | 3 + dot_local/bin/executable_ffmpeg.lossy_trim | 3 + dot_local/bin/executable_find-acoustid-dups | 14 ++++ dot_local/bin/executable_jq-compress | 5 ++ .../bin}/executable_kde-rofi-rbw-autotype | 0 .../bin}/executable_kde-rofi-rbw-totp | 0 .../executable_ssh-check-host-fingerprint | 0 dot_local/bin/executable_xxbranch | 10 +++ dot_local/bin/executable_xxbranchupdates | 67 +++++++++++++++++++ dot_local/bin/executable_xxdeps | 29 ++++++++ dot_local/bin/executable_xxdist | 17 +++++ dot_local/bin/executable_xxtip | 15 +++++ dot_local/bin/executable_xxtreecrawl | 59 ++++++++++++++++ dot_local/bin/symlink_ffmpeg.trim | 1 + 19 files changed, 248 insertions(+), 21 deletions(-) create mode 100644 dot_local/bin/executable_android-bt-snoop create mode 100644 dot_local/bin/executable_ffmpeg.bars create mode 100644 dot_local/bin/executable_ffmpeg.lossy_trim create mode 100644 dot_local/bin/executable_find-acoustid-dups create mode 100644 dot_local/bin/executable_jq-compress rename {bin => dot_local/bin}/executable_kde-rofi-rbw-autotype (100%) rename {bin => dot_local/bin}/executable_kde-rofi-rbw-totp (100%) rename {bin => dot_local/bin}/executable_ssh-check-host-fingerprint (100%) create mode 100644 dot_local/bin/executable_xxbranch create mode 100644 dot_local/bin/executable_xxbranchupdates create mode 100644 dot_local/bin/executable_xxdeps create mode 100644 dot_local/bin/executable_xxdist create mode 100644 dot_local/bin/executable_xxtip create mode 100644 dot_local/bin/executable_xxtreecrawl create mode 100644 dot_local/bin/symlink_ffmpeg.trim diff --git a/.chezmoiexternal.toml b/.chezmoiexternal.toml index 4aea269..3f14ca9 100644 --- a/.chezmoiexternal.toml +++ b/.chezmoiexternal.toml @@ -1,10 +1,18 @@ [".config/kitty/kitty-gruvbox-theme"] - type = "archive" - url = "https://github.com/wdomitrz/kitty-gruvbox-theme/archive/master.tar.gz" - exact = true - stripComponents = 1 - refreshPeriod = "168h" +type = "archive" +url = "https://github.com/wdomitrz/kitty-gruvbox-theme/archive/master.tar.gz" +exact = true +stripComponents = 1 +refreshPeriod = "168h" + [".config/variety/plugins/verse.py"] - type = "file" - url = "https://raw.githubusercontent.com/Crissium/variety-daily-verse/master/verse.py" - refreshPeriod = "168h" +type = "file" +url = "https://raw.githubusercontent.com/Crissium/variety-daily-verse/master/verse.py" +refreshPeriod = "168h" + +[".local/share/xxtools"] +type = "archive" +url = "https://github.com/Piraty/xxtools/archive/master.tar.gz" +exact = true +stripComponents = 1 +refreshPeriod = "168h" diff --git a/.chezmoiignore b/.chezmoiignore index 08f848e..c78750a 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -4,8 +4,9 @@ .config/kitty/kitty-gruvbox-theme .config/sway .config/waybar -bin/kde-rofi-rbw-totp +.local/share/gnupg/sshcontrol bin/kde-rofi-rbw-autotype +bin/kde-rofi-rbw-totp {{ end }} {{ if eq .chezmoi.hostname "epoch" }} @@ -14,6 +15,7 @@ bin/kde-rofi-rbw-autotype .config/kitty/kitty-gruvbox-theme .config/sway .config/waybar +.local/share/gnupg/sshcontrol bin/kde-rofi-rbw-totp bin/kde-rofi-rbw-autotype {{ end }} @@ -24,6 +26,7 @@ bin/kde-rofi-rbw-autotype .config/kitty/kitty-gruvbox-theme .config/sway .config/waybar +.local/share/gnupg/sshcontrol bin/kde-rofi-rbw-totp bin/kde-rofi-rbw-autotype {{ end }} diff --git a/dot_config/environment b/dot_config/environment index 0d40b9e..acd4ea9 100644 --- a/dot_config/environment +++ b/dot_config/environment @@ -1,3 +1,4 @@ +#!/bin/sh # icky, but necessary since this might inject the needed XDG vars . "$HOME/.config/environment.local" 2>/dev/null . "$XDG_DATA_HOME/cargo/env" 2>/dev/null @@ -34,6 +35,7 @@ export WINEPREFIX="$XDG_DATA_HOME"/wine export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority export XCURSOR_PATH=/usr/share/icons:"$XDG_DATA_HOME"/icons export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java +export PATH="$PATH:$HOME/.local/bin:$XDG_DATA_HOME/xxtools" export PGUSER=postgres -export XBPS_DISTDIR=$HOME/repos/void-packages +export XBPS_DISTDIR="$HOME"/repos/void-packages diff --git a/dot_config/zsh/dot_zshrc b/dot_config/zsh/dot_zshrc index 72b6449..24fdaff 100644 --- a/dot_config/zsh/dot_zshrc +++ b/dot_config/zsh/dot_zshrc @@ -17,17 +17,6 @@ zstyle :compinstall filename "$ZDOTDIR/.zshrc" autoload -Uz compinit compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION" # End of lines added by compinstall -prependpath() { - case ":$PATH:" in - *:"$1":*) - ;; - *) - PATH="$1:${PATH:+$PATH}" - esac -} -prependpath ~/bin -prependpath ~/repos/xxtools - ### User configuration # prompt configuration autoload -Uz vcs_info diff --git a/dot_local/bin/executable_android-bt-snoop b/dot_local/bin/executable_android-bt-snoop new file mode 100644 index 0000000..ab53610 --- /dev/null +++ b/dot_local/bin/executable_android-bt-snoop @@ -0,0 +1,2 @@ +#!/bin/sh +adb shell nc -s 127.0.0.1 -p 8872 -L system/bin/tail -f -c +0 data/misc/bluetooth/logs/btsnoop_hci.log diff --git a/dot_local/bin/executable_ffmpeg.bars b/dot_local/bin/executable_ffmpeg.bars new file mode 100644 index 0000000..f0e7ca1 --- /dev/null +++ b/dot_local/bin/executable_ffmpeg.bars @@ -0,0 +1,3 @@ +#!/bin/sh +output_file="$(echo "$1" | sed 's,.mp4,.bars.mp4,')" +ffmpeg -i "$1" -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1" -c:a copy "$output_file" diff --git a/dot_local/bin/executable_ffmpeg.lossy_trim b/dot_local/bin/executable_ffmpeg.lossy_trim new file mode 100644 index 0000000..edd238c --- /dev/null +++ b/dot_local/bin/executable_ffmpeg.lossy_trim @@ -0,0 +1,3 @@ +#!/bin/sh +output_file="$(echo "$1" | sed 's,\(.*\)\.\(.*\)$,\1.sermon.\2,')" +ffmpeg -i "$1" -ss "$2" -to "$3" "$output_file" diff --git a/dot_local/bin/executable_find-acoustid-dups b/dot_local/bin/executable_find-acoustid-dups new file mode 100644 index 0000000..fb51a7c --- /dev/null +++ b/dot_local/bin/executable_find-acoustid-dups @@ -0,0 +1,14 @@ +#!/bin/sh +for i in $(seq 1 60); do +if [ "$(find . -name "$i *" | wc -l)" = 2 ]; then + first_track="$(find . -name "$i *" | head -n1)" + last_track="$(find . -name "$i *" | tail -n1)" + first_acoustid="$(exiftool "$first_track" | rg Acoustid)" + last_acoustid="$(exiftool "$last_track" | rg Acoustid)" + if [ "$first_acoustid" = "$last_acoustid" ]; then + if [ "$first_track" != "$last_track" ]; then + rm "$first_track" + fi + fi +fi +done diff --git a/dot_local/bin/executable_jq-compress b/dot_local/bin/executable_jq-compress new file mode 100644 index 0000000..87674ec --- /dev/null +++ b/dot_local/bin/executable_jq-compress @@ -0,0 +1,5 @@ +#!/bin/sh +# +# I made this script to clean up duplicate messages in the Android SMS/MMS +# database as exported by https://github.com/tmo1/sms-ie (v2.0.0). +jq -c '.__recipient_addresses |= unique_by(.address)' messages.ndjson > messages.uniqued.ndjson diff --git a/bin/executable_kde-rofi-rbw-autotype b/dot_local/bin/executable_kde-rofi-rbw-autotype similarity index 100% rename from bin/executable_kde-rofi-rbw-autotype rename to dot_local/bin/executable_kde-rofi-rbw-autotype diff --git a/bin/executable_kde-rofi-rbw-totp b/dot_local/bin/executable_kde-rofi-rbw-totp similarity index 100% rename from bin/executable_kde-rofi-rbw-totp rename to dot_local/bin/executable_kde-rofi-rbw-totp diff --git a/bin/executable_ssh-check-host-fingerprint b/dot_local/bin/executable_ssh-check-host-fingerprint similarity index 100% rename from bin/executable_ssh-check-host-fingerprint rename to dot_local/bin/executable_ssh-check-host-fingerprint diff --git a/dot_local/bin/executable_xxbranch b/dot_local/bin/executable_xxbranch new file mode 100644 index 0000000..57a3c72 --- /dev/null +++ b/dot_local/bin/executable_xxbranch @@ -0,0 +1,10 @@ +#!/bin/sh +if [ $# -eq 1 ]; then + branch=$1 + git fetch upstream master + git checkout upstream/master + git checkout -b "$branch" +else + echo "Please specify new branch." +fi + diff --git a/dot_local/bin/executable_xxbranchupdates b/dot_local/bin/executable_xxbranchupdates new file mode 100644 index 0000000..05f0b70 --- /dev/null +++ b/dot_local/bin/executable_xxbranchupdates @@ -0,0 +1,67 @@ +#!/bin/sh + +# always capture the current branch so we can go back to it :) +current_branch="$(git branch --show-current)" + +_default() { + if [ -n "$1" ]; then + git checkout -q "$1" + fi + branch_name="$(git branch --show-current)" + update_list="" + for p in $(common/travis/changed_templates.sh 2>&1 >/dev/null); do + if [ -z "$update_list" ]; then + update_list=$("${XBPS_DISTDIR}"/xbps-src update-check "$p" 2>&1) + else + appendee=$("${XBPS_DISTDIR}"/xbps-src update-check "$p") + if [ -n "$appendee" ]; then + # yay explicit newline :( + update_list="${update_list} +${appendee}" + fi + fi + done + if [ -n "$update_list" ]; then + printf "branch: %s\n%s\n\n" "$branch_name" "$update_list" + fi +} + +_maint() { + git checkout -q master + for b in $(git branch --list 'maint*'); do + _default "$b" + done +} + +_update() { + git checkout -q master + for b in $(git branch --list 'update*'); do + _default "$b" + done +} + +_organized() { + git checkout -q master + for b in $(git branch --list '*/*'); do + _default "$b" + done +} + +if [ $# = 0 ]; then + _default +else + while test $# != 0 + do + case "$1" in + -m|--maint) _maint;; + -u|--update) _update;; + -o|--organized) _organized;; + --) shift; break;; + *) _default;; + esac + shift + done +fi + +# return to branch we were on before running script +git checkout "$current_branch" >/dev/null 2>&1 diff --git a/dot_local/bin/executable_xxdeps b/dot_local/bin/executable_xxdeps new file mode 100644 index 0000000..020ea97 --- /dev/null +++ b/dot_local/bin/executable_xxdeps @@ -0,0 +1,29 @@ +#!/bin/sh + +_check() { + for p in $(xbps-query -Rx "$1" | cut -d '>' -f1); do + num_child_deps=$(xbps-query -Rx "$p" | wc -l) + update_check_result=$("${XBPS_DISTDIR}"/xbps-src update-check "$p") + if [ "$num_child_deps" -lt 3 ]; then + + if [ -n "$update_check_result" ]; then + printf '%s' "$update_check_result" | + while IFS= read -r line; do + for _i in $(seq "$2"); do + printf ' ' + done + printf '%s\n' "$line" + done + else + for _i in $(seq "$2"); do + printf ' ' + done + printf '%s (latest version)\n' "$p" + fi + + _check "$p" "$(($2+1))" + fi + done +} + +_check "$1" 0 diff --git a/dot_local/bin/executable_xxdist b/dot_local/bin/executable_xxdist new file mode 100644 index 0000000..8cdde11 --- /dev/null +++ b/dot_local/bin/executable_xxdist @@ -0,0 +1,17 @@ +#!/bin/sh + +branch_name="$(git branch --show-current)" + +if [ $# = 0 ]; then + rsync -P -r "${XBPS_DISTDIR}/hostdir/binpkgs/${branch_name}" daybreak: + rsync -P -r "${XBPS_DISTDIR}/hostdir/binpkgs/${branch_name}" epoch: +elif [ "$1" = "repo" ]; then + cd "${XBPS_DISTDIR}/hostdir/binpkgs/${branch_name}" + for p in *.xbps; do + rsync -P $p daybreak:/srv/repo + ssh daybreak "xbps-rindex --add /srv/repo/$p; + xbps-rindex --privkey /srv/repo/private.pem --sign-pkg /srv/repo/*.xbps" + done +else + rsync -P -r "${XBPS_DISTDIR}/hostdir/binpkgs/${branch_name}" "$1": +fi diff --git a/dot_local/bin/executable_xxtip b/dot_local/bin/executable_xxtip new file mode 100644 index 0000000..151cc6d --- /dev/null +++ b/dot_local/bin/executable_xxtip @@ -0,0 +1,15 @@ +#!/bin/sh + +current_branch="$(git branch --show-current)" + +trap back_to_current_branch 1 2 3 6 15 +back_to_current_branch() { + git checkout "$current_branch" + exit 1 +} + +git checkout master +git pull --rebase upstream master +git push -f +git checkout "$current_branch" +git rebase master diff --git a/dot_local/bin/executable_xxtreecrawl b/dot_local/bin/executable_xxtreecrawl new file mode 100644 index 0000000..93da832 --- /dev/null +++ b/dot_local/bin/executable_xxtreecrawl @@ -0,0 +1,59 @@ +#!/bin/sh + +# always capture the current branch so we can go back to it :) +current_branch="$(git branch --show-current)" + +_default() { + if [ -n "$1" ]; then + git checkout -q "$1" + fi + branch_name="$(git branch --show-current)" + update_list="" + for p in $(common/travis/changed_templates.sh 2>&1 >/dev/null); do + if [ -z "$update_list" ]; then + update_list="$p" + else + appendee="$p" + if [ -n "$appendee" ]; then + # yay explicit newline :( + update_list="${update_list} +${appendee}" + fi + fi + done + if [ -n "$update_list" ]; then + printf "branch: %s\n%s\n\n" "$branch_name" "$update_list" + fi +} + +_maint() { + git checkout -q master + for b in $(git branch --list 'maint*'); do + _default "$b" + done +} + +_update() { + git checkout -q master + for b in $(git branch --list 'update*'); do + _default "$b" + done +} + +if [ $# = 0 ]; then + _default +else + while test $# != 0 + do + case "$1" in + -m|--maint) _maint;; + -u|--update) _update;; + --) shift; break;; + *) _default;; + esac + shift + done +fi + +# return to branch we were on before running script +git checkout "$current_branch" >/dev/null 2>&1 diff --git a/dot_local/bin/symlink_ffmpeg.trim b/dot_local/bin/symlink_ffmpeg.trim new file mode 100644 index 0000000..515cd14 --- /dev/null +++ b/dot_local/bin/symlink_ffmpeg.trim @@ -0,0 +1 @@ +ffmpeg.lossy_trim