# 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
}
# 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
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
if $locked && (( mdiff < 6 || mdiff > 21 )); then
case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in
no)
+ # for log purposes
+ echo unmuted
pactl set-sink-mute @DEFAULT_SINK@ true
;;
esac
if ! $locked && (( mdiff > 6 || mdiff < 12 )) && [[ ! -e /tmp/ianknap ]]; then
case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in
yes)
+ # for log purposes
+ echo muted
pactl set-sink-mute @DEFAULT_SINK@ false
;;
esac