diff options
Diffstat (limited to 'misc/bin')
| -rwxr-xr-x | misc/bin/git-annex-picard.sh | 6 | ||||
| -rwxr-xr-x | misc/bin/merge-tracks.sh | 25 | ||||
| -rwxr-xr-x | misc/bin/mpvmix.sh | 22 | ||||
| -rwxr-xr-x | misc/bin/mv-single-pages.sh | 3 | ||||
| -rwxr-xr-x | misc/bin/org-a-sync.el | 45 | ||||
| -rwxr-xr-x | misc/bin/ttrss-fetch.el | 10 | ||||
| -rwxr-xr-x | misc/bin/unzipall.sh | 8 | ||||
| -rwxr-xr-x | misc/bin/zipall.sh | 9 |
8 files changed, 128 insertions, 0 deletions
diff --git a/misc/bin/git-annex-picard.sh b/misc/bin/git-annex-picard.sh new file mode 100755 index 0000000..de14399 --- /dev/null +++ b/misc/bin/git-annex-picard.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -eu +git annex get "$1" +git annex unlock "$1" +picard "$1" diff --git a/misc/bin/merge-tracks.sh b/misc/bin/merge-tracks.sh new file mode 100755 index 0000000..ddfc36d --- /dev/null +++ b/misc/bin/merge-tracks.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Consolidate albums of < 3 tracks to a "medley" album + +find . -wholename './.git' -prune -o -type d -links 2 \ + -exec /bin/bash -c 'a=( "{}"/* ); [[ ${#a[*]} -lt 3 ]]' ';' -print | + while IFS=$'\n' read -r dir; do + for f in "$dir"/*; do + # echo "$f" + p1=$(echo "$f" | cut -d/ -f 2) + p2=$(basename "$f") + if [[ "$p1" == "Various Artists" ]]; then + newf="./Various Artists/Medley/$p2" + else + newf="./Various Artists/Medley/$p1-$p2" + fi + git mv "$f" "$newf" + done + done + +# May need to do multiple times to remove all empty dirs +find . -wholename './.git' -prune -o -type d -empty -print | + while IFS=$'\n' read -r dir; do + echo rmdir "$dir" + done diff --git a/misc/bin/mpvmix.sh b/misc/bin/mpvmix.sh new file mode 100755 index 0000000..8bc0ac8 --- /dev/null +++ b/misc/bin/mpvmix.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Randomly play media segments from a list of files with start and end +# time line format: +# 1:00//1:05//~/file.mp4 + +f="$1" +n=$(cat "$f" | wc -l) +while true; do + while read -r line; do + echo "$line" + regex='([0-9:]+)//([0-9:]+)//(.+)' + [[ "$line" =~ $regex ]] || continue + start=${BASH_REMATCH[1]} + end=${BASH_REMATCH[2]} + media=${BASH_REMATCH[3]} + media="${media/#~/${HOME}}" + # echo "start: $start; end: $end; file: $media" + mpv --start=$start --end=$end "$media" + done <<<$(shuf -n $n "$f") + sleep 1 +done diff --git a/misc/bin/mv-single-pages.sh b/misc/bin/mv-single-pages.sh new file mode 100755 index 0000000..76c234f --- /dev/null +++ b/misc/bin/mv-single-pages.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +grep -l "^ Page saved with SingleFile $" -Z ~/Downloads/*.html | xargs -0 -I {} mv {} "$MY_WEBPAGE_INCOMING_DIR/" diff --git a/misc/bin/org-a-sync.el b/misc/bin/org-a-sync.el new file mode 100755 index 0000000..7123f04 --- /dev/null +++ b/misc/bin/org-a-sync.el @@ -0,0 +1,45 @@ +#!/bin/emacs --script + +(add-to-list 'load-path (locate-user-emacs-file "lisp/my")) +(require 'org-agenda) +(require 'my-package) +(my-read-local-config) +(my-setq-from-local my-org-agenda-and-next-export-files) +(my-setq-from-local org-agenda-files) + +(progn + (setq org-todo-keywords + '((sequence "TODO(t)" "DOIN(i)" "WAIT(w)" "|" + "DONE(d)" "OBSO(o)" "DUPL(u)"))) + (setq org-closed-keep-when-no-todo t) + (setq org-enforce-todo-dependencies t + org-enforce-todo-checkbox-dependencies nil) + (setq org-use-fast-todo-selection 'expert) + (setq org-agenda-custom-commands + `(("A" "Agenda and next" + ((agenda "" + ((org-agenda-span 32) + ;; only works when `org-agenda-start-on-weekday' + ;; is nil + (org-agenda-start-day "-2d"))) + (tags-todo "PRIORITY=\"A\"" nil)) + nil + ,my-org-agenda-and-next-export-files + ))) + (setq large-file-warning-threshold nil) + (setq org-agenda-todo-ignore-time-comparison-use-seconds t) + (setq org-agenda-todo-ignore-deadlines 'all) + (setq org-agenda-todo-ignore-scheduled 'all) + (setq org-agenda-todo-ignore-with-date 'all) + (setq org-agenda-todo-ignore-timestamp 'all) + (setq org-agenda-tags-todo-honor-ignore-options t) + (setq org-agenda-sticky t) + (setq org-agenda-inhibit-startup t) + (setq org-agenda-skip-deadline-if-done nil) + (setq org-agenda-skip-scheduled-if-done nil) + (setq org-agenda-skip-timestamp-if-done t) + (setq org-agenda-start-on-weekday nil) + ) + +(let ((make-backup-files nil)) + (call-interactively 'org-store-agenda-views)) diff --git a/misc/bin/ttrss-fetch.el b/misc/bin/ttrss-fetch.el new file mode 100755 index 0000000..770ff46 --- /dev/null +++ b/misc/bin/ttrss-fetch.el @@ -0,0 +1,10 @@ +#!/bin/emacs --script + +(add-to-list 'load-path (locate-user-emacs-file "lisp/ttrss.el")) +(add-to-list 'load-path (locate-user-emacs-file "lisp/my")) +(require 'my-ttrss) +(require 'my-package) +(my-read-local-config) +(my-setq-from-local ttrss-address ttrss-user ttrss-password) +(my-setq-from-local my-ttrss-dir) +(my-ttrss-fetch) diff --git a/misc/bin/unzipall.sh b/misc/bin/unzipall.sh new file mode 100755 index 0000000..2d654f0 --- /dev/null +++ b/misc/bin/unzipall.sh @@ -0,0 +1,8 @@ +#/bin/bash + +# unzip all zip/7z files with 7z in pwd +for f in ./*; do + ext=${f##*.} + if test "$ext" = zip; then 7z e "$f"; fi; + if test "$ext" = 7z; then 7z e "$f"; fi; +done diff --git a/misc/bin/zipall.sh b/misc/bin/zipall.sh new file mode 100755 index 0000000..0a244c2 --- /dev/null +++ b/misc/bin/zipall.sh @@ -0,0 +1,9 @@ +#/bin/bash + +# zip all non-7z and non-zip files with 7z in pwd and delete the original +for f in ./*; do + ext=${f##*.} + if test "$ext" = zip; then continue; fi; + if test "$ext" = 7z; then continue; fi; + 7z a -sdel "$f.7z" "$f" +done |
