minor improvements
authorIan Kelling <ian@iankelling.org>
Mon, 22 Dec 2025 05:29:29 +0000 (00:29 -0500)
committerIan Kelling <ian@iankelling.org>
Mon, 22 Dec 2025 05:29:29 +0000 (00:29 -0500)
.gemrc [deleted file]
beetag
brc
brc2
fsf-script-lib

diff --git a/.gemrc b/.gemrc
deleted file mode 100644 (file)
index d90ed0f..0000000
--- a/.gemrc
+++ /dev/null
@@ -1,2 +0,0 @@
-# if a gem fails on documentation, uncomment this.
-# gem: --no-document
diff --git a/beetag b/beetag
index e6b9864397bc6efe010ea07b3e513809a607aa6e..c0d7ff65077f335839ddf82f4253c5a0f1000ace 100755 (executable)
--- a/beetag
+++ b/beetag
@@ -60,7 +60,7 @@ beetag-help() {
     cat <<'EOF'
 
 
-y other genres   z fg player      ' = toggle play  1-5 rate    ] repeat1
+y other genres   z fg player      ' = toggle autoplay  1-5 rate    ] repeat1
 ; previous       ) delete         j/k skip         mpv_keys vol,pause,seek
 EOF
     hr
@@ -365,14 +365,18 @@ usage: beetag [OPTIONS] QUERY
 
 It lists/plays the query, reads an input char for tagging one by one.
 
-note, you may want to change the play command for doing rapid taging
+note: you may want to change the play command for doing rapid taging
 by immediately jumping forward into the song. this is set in the beets
 config yaml.
 
-(available buttons: ` _ ] [ and non-printing chars, see
+available buttons:
+ * ` _ ] [
+ * ' (autoplay), I've never used it so it could just be a cli option.
+ * non-printing chars, see
 https://stackoverflow.com/questions/10679188/casing-arrow-keys-in-bash
 
 
+
 note: after foregrounding the player, must quit it to get back. can't ctrl-c.
 
 keys I dont need help to remember:
@@ -392,7 +396,7 @@ beetag()  {
   source /a/bin/ds/beet-data
 
   # state vars altered by user input:
-  local char do_rare_genres last_genre_i doplay=true repeat1=false
+  local char do_rare_genres last_genre_i autoplay=true repeat1=false
   local -i volume=70 read_wait=2 j=0
   local -a button_map
   local -A button_i
@@ -517,7 +521,7 @@ beetag()  {
     beetag-help
     printf "██ %s\n" "$ls_out"
     beetag-nostatus 1
-    if $doplay; then
+    if $autoplay; then
       if $first_play; then first_play=false; mpvrpc-wait-idle; fi
       mpvrpc-loadfile "$path"
       erasable_line=false
@@ -528,7 +532,7 @@ beetag()  {
 
     while true; do
       char=
-      if $doplay; then
+      if $autoplay; then
         ret=0
         read -rsN1 -t $read_wait char || ret=$?
         read_wait=2
@@ -561,11 +565,11 @@ beetag()  {
           break
           ;;
         "'")
-          if $doplay; then
-            echo "play toggled off"
-            doplay=false
+          if $autoplay; then
+            echo "autoplay toggled off"
+            autoplay=false
           else
-            doplay=true
+            autoplay=true
             mpvrpc-loadfile "$path"
             erasable_line=false
           fi
diff --git a/brc b/brc
index 3043c2e8a88e74e0a9943b4d21c24e239de5085f..545aa85c0dc939bbdbc9903d8d77c3239bf93bb4 100644 (file)
--- a/brc
+++ b/brc
@@ -4647,6 +4647,19 @@ wgkey() {
   umask $umask_orig
 }
 
+# Dedupe a project with several node_modules dirs for the purpose of
+# license scanning. Dedupe is by directory name, not worried about
+# versions for a simple license scan.
+dedup-node-modules() {
+  mkdir -p ../deduped
+  for d in $(find . -type d -name node_modules | perl -e 'print sort {length $b <=> length $a} <>'); do for mod in $d/*; do [[ -d $mod ]] || rm $mod; n="${m##*/}"; if [[ -d ../deduped/$n ]]; then rm -r $mod; else mv $mod ../deduped; fi; done; done
+  cd ../deduped
+  # for each dir that has a min.js file, compare char count of min.js
+  # files vs char count of files with just .js or .ts, etc. If minified
+  # is bigger, then flag it by doing an ls.
+  for d in $(find -type f -name '*.min.js'|sed -r 's,^./,,;s,/.*$,,' | sort -u); do a=$(cat $(find $d -name '*.min.js')|wc -c); b=$(cat $(find $d -type f \! -name '*.min.js' \( -name '*.js' -o -name '*.ts' -o -name '*.mjs' -o -name '*.tsx' -o -name '*.cts' -o -name '*.mts \)') | wc -c); if ! uintp "$a" "$b"; then e "uint $a, $b"; continue; fi; if (( a < b )); then find $d -name '*.min.js' -delete; else m ll $d; fi; done
+  #time /t/sc/scancode --info --classify --only-findings --max-in-memory 300000 -clpue --unknown-licenses --tallies --tallies-with-details --summary --generated --json-pp scan.json .
+  }
 
 
 # * stuff that makes sense to be at the end
diff --git a/brc2 b/brc2
index 998f2806c04a130268f675b3b8d1a5fbffacde6b..e36cef2ee60c45dd425f08f18ebc16513f2b9b5e 100644 (file)
--- a/brc2
+++ b/brc2
@@ -106,6 +106,13 @@ if [[ $EUID == 1000 ]]; then
     # shellcheck disable=SC1091 # may not exist, & third party
     [[ -s "$NVM_DIR/bash_completion" ]] && source "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
   }
+  # the nvm docs say: to update, rerun the curl|bash install
+  # script. Then later it says "the install script basically just clones
+  # the repo", wow, what a horribly gratuitous use of curl|bash.
+  nvm-update() {
+    cd ~/.nvm
+    git pull
+    }
 fi
 
 export I2X_SORT_ORDER=path_desc
@@ -683,26 +690,6 @@ beetadd() {
   unset -f err-cleanup
 }
 
-# beetag: error: no result from beet ls totag:t
-# [1] 711197
-# █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
-# a arp            i nv             s sleep          8 pump1
-# b avant          l latin          t techno         , pumprap
-# c blues          m metal          u world          . rend
-# d chill          n mq             v expl           / run
-# e country        o pop            w gimicky        - tiredof
-# f dance          p rap            6 sad            = worm
-# g darkwave       r rock           7 love           \ lesser_version
-# h hardcore
-
-# y other genres   z fg player      ' = toggle play  1-5 rate    ] repeat1
-# ; previous       _ delete         j/k skip         mpv_keys vol,pause,seek
-# █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
-# ██
-# [file] Cannot open file '': No such file or directory
-# Failed to open .
-# bash: ( j + 1 ) % id_count : division by 0 (error token is "id_count ")
-
 
 ##### begin beet2nav functions #####
 # update navidrome music data after doing beets tagging
index d24e751ffb4f62a97ac32847543360e74f434f65..1abab5feba1f27f488219ab6c79edab7f46d7599 100644 (file)
@@ -54,6 +54,13 @@ uint_regex='^[0-9]+$'
 # shellcheck disable=SC2034
 graph_regex='^[[:graph:]]+$'
 
+# slightly less typing
+uintp() {
+  for arg; do
+    [[ $arg =~ $uint_regex ]] || return 1
+  done
+}
+
 # horizontal row. used to break up output
 # shellcheck disable=SC2120 # not a big deal.
 hr() {