fi
case $input in
http*)
- path="$repo_dir/${input##https://$domain/wiki/}"
+ path="$repo_dir/${input##http*://$domain/wiki/}"
if [[ $path == */ ]]; then
path=${path%/}.mdwn
fi
;;
*)
path=$(fp "$input")
- url="https://$domain/wiki/${path#$repo_dir/}"
+ url="http*://$domain/wiki/${path#$repo_dir/}"
url="${url%.mdwn}/"
j echo "$url"
;;
esac
}
-# Convert brains file path to url and vice versa. It copies the result to clipboard
-# usage: brains [URL_OR_PATH]
-brains() {
- local url path input repo_dir err path
- repo_dir=/a/f/brains
- err=false
- if ! type -p xclip &>/dev/null; then
- echo "missing dependency for brains, please do: sudo apt install xclip" >&2
- err=true
- fi
- if ! type -p pee &>/dev/null; then
- echo "missing dependency for brains, please do: sudo apt install moreutils" >&2
- err=true
- fi
- if $err; then
- return 1
- fi
- if [[ $1 ]]; then
- input="$*"
- else
- read -r -p "enter path or url"$'\n' input
- fi
- case $input in
- http*)
- path="$repo_dir/${input##https://brains.fsf.org/wiki/}"
- if [[ $path == */ ]]; then
- path=${path%/}.mdwn
- fi
- printf "%s\n" "$path" |& pee "xclip -r -selection clipboard" cat
- ;;
- *)
- path=$(realpath -s "$input")
- url="https://brains.fsf.org/wiki/${path#$repo_dir/}"
- url="${url%.mdwn}/"
- echo "$url" |& pee "xclip -r -selection clipboard" cat
- ;;
- esac
-}
-
# Generate beet smartplaylists for navidrome.
# for going in the reverse direction, run
mkdir -p /tmp/b/s
for host in $remote $alt; do
- # this takes a while, we only want to do it on 1st run
- if [[ -s /tmp/b/$host.log ]]; then continue; fi
- ssh $host journalctl -u btrbk-run -u btrbk -u switch-mail-host -u btrbk-spread >/tmp/b/$host.log
+ h=$(ssh $host hostname)
+ rsync -a /var/log/btrbk $host:/var/log/btrbk /var/log/btrbk/$h
+ grr '\bsnapshot success' /var/log/btrbk/$h >/tmp/b/$h.log
+
+ ## this takes a while, we only want to do it on 1st run
+ # if [[ -s /tmp/b/$host.log ]]; then continue; fi
+ # ssh $host journalctl -u btrbk-run -u btrbk -u switch-mail-host -u btrbk-spread >/tmp/b/$host.log
done
- if [[ ! -s /tmp/b/local.log ]]; then
- jrbtrbk >/tmp/b/local.log
- fi
+ gr '\bsnapshot success' /var/log/btrbk/*.log >/tmp/b/local.log
cd /tmp/b
for f in *.log; do
gr '\bsnapshot success' $f >s/$f
# rg my main files
rgm() {
- rg "$@" /p/pd.org /p/w.org /a/t.org /a/work.org /b
+ rg "$@" /p/w.org /a/t.org /a/work.org /b
}
reset-konsole() {