features
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index 676c5973a760a2c7936cd24c901336a8f09b2727..7f6011f43dd05b4cf61d19d7658449a3a5c4053d 100644 (file)
--- a/brc2
+++ b/brc2
@@ -395,16 +395,27 @@ astudio() {
 # becomes
 # https://brains.fsf.org/wiki/sysadmin/interns/2022/nick_shrader/intro_blog_post
 iki() {
-  local url path
+  local url path input
   if [[ $1 ]]; then
-    path="$*"
+    input="$*"
   else
-    read -r -p "enter path" path
+    read -r -p "enter path or url" input
   fi
-  url=$(readlink -f "$path")
-  url="https://brains.fsf.org/wiki/${url#*brains/}"
-  url="${url%.mdwn}"
-  echo "$url"
+  case $input in
+    http*)
+      path="/f/brains/${input##https://brains.fsf.org/wiki/}"
+      if [[ $path == */ ]]; then
+        path=${path%/}.mdwn
+        fi
+      j printf "%s\n" "$path"
+      ;;
+    *)
+      url=$(readlink -f "$input")
+      url="https://brains.fsf.org/wiki/${url#*brains/}"
+      url="${url%.mdwn}"
+      j echo "$url"
+      ;;
+  esac
 
 }
 
@@ -1562,7 +1573,11 @@ dsign() {
 # set day start for use in other programs.
 # expected to do be in a format like 830, or 800 or 1300.
 ds() {
-  echo $1 >/b/data/daystart
+  if [[ $1 ]]; then
+    echo $1 >/b/data/daystart
+  else
+    cat /b/data/daystart
+  fi
 }
 
 #### begin bitcoin related things
@@ -2573,9 +2588,17 @@ otp() {
   oathtool --totp -b "$*" | xclip -selection clipboard
 }
 j() {
-  "$@" |& pee "xclip -r -selection clipboard"
+  "$@" |& pee "xclip -r -selection clipboard" cat
 }
 
+# x copy
+xc() {
+  xclip -r -selection clipboard
+}
+# echo copy
+ec() {
+  pee "xclip -r -selection clipboard" cat
+}
 
 pakaraoke() {
   # from http://askubuntu.com/questions/456021/remove-vocals-from-mp3-and-get-only-instrumentals
@@ -3159,6 +3182,17 @@ fixu() {
   fi
 }
 
+# unmute
+um() {
+  pactl set-sink-mute @DEFAULT_SINK@ false
+  rm -f /tmp/ianknap
+}
+nap() {
+  pactl set-sink-mute @DEFAULT_SINK@ true
+  touch /tmp/ianknap
+}
+
+
 # systemctl is-enabled / status / cat says nothing, instead theres
 # some obscure symlink. paths copied from man systemd.unit.
 # possibly also usefull, but incomplete, doesnt show units not loaded in memory: