X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=brc2;fp=brc2;h=1c57452b1cb82c01cfd33554bc50573ab8eeb82a;hp=ec5969fef4929276b151883fe698fd24d3c78c5e;hb=d67edcdca8795a4bca116aa532d02dda246a6f53;hpb=a9e3d60b4254cd5c6216c4b3e7f8cd5cc5107fad diff --git a/brc2 b/brc2 index ec5969f..1c57452 100644 --- a/brc2 +++ b/brc2 @@ -463,7 +463,7 @@ glue() { # usage: see above _iki-convert() { - local url url_prefix path input err repo_dir dir url_dir url name + local url url_prefix path input repo_dir dir url_dir url name url_prefix="$1" name="${url_prefix%%.*}" repo_dir="/f/$name" @@ -476,8 +476,16 @@ _iki-convert() { case $input in http*) path="$repo_dir/${input##http*://"$url_prefix"/}" + # for files like x.jpg, we dont need to convert the extension. if [[ $path == */ ]]; then path=${path%/}.mdwn + # brains adds trailing slash, but without trailing is still + # valid. We can't be totally sure whether to add mdwn, but we + # can guess based on the existence of the file. We can't be sure + # because it could be a file like x.jpg, that we just don't have + # in our local repo. + elif [[ ! -f $path && -e $path.mdwn ]]; then + path=${path}.mdwn fi j printf "%s\n" "$path" ;; @@ -485,7 +493,9 @@ _iki-convert() { path=$(fp "$input") url_dir=$(echo "$path" | sed -r "s,^(/a)?$repo_dir/,,") url="https://$url_prefix/$url_dir" - url="${url%.mdwn}/" + if [[ $url == *.mdwn ]]; then + url="${url%.mdwn}/" + fi j echo "$url" ;; esac @@ -748,6 +758,7 @@ mpvrpc-percent-pos() { # background, this relies on how ps converts newlines in arguments to spaces, and # assumes we won't be searching for a command with spaces in its arguments rinr() { + # shellcheck disable=SC2009 # pgrep has no fixed string option, plus see above. if ps h -o args -C "${1##*/}" | grep -Fxqv "$*" &>/dev/null || [[ $? == 141 ]]; then "$@" fi @@ -780,7 +791,7 @@ mpvrpc-loadfile() { finalpath="$cachedir${path#/i/m}" rowir rsync --partial -a --inplace --mkpath "b8.nz:$path" "$finalpath" finalnextpath="$cachedir${nextpath#/i/m}" - count=$(pgrep -a -f "^rsync --partial -a --inplace --mkpath $cachdir" || [[ $? == 1 ]] ) + count=$(pgrep -a -f "^rsync --partial -a --inplace --mkpath $cachedir" || [[ $? == 1 ]] ) # allow us to start 2 rsyncs in the background if [[ $count == [01] ]]; then rinr rsync --partial -a --inplace --mkpath "b8.nz:$nextpath" "$finalnextpath" & @@ -1761,7 +1772,8 @@ bindpush() { dsign iankelling.org expertpathologyreview.com zroe.org amnimal.ninja lipush for h in li bk; do - m sl $h.b8.nz <<'EOF' + e sshing $h + ssh $h.b8.nz <<'EOF' source ~/.bashrc m dnsup EOF @@ -1770,7 +1782,8 @@ EOF bindpushb8() { lipush for h in li bk; do - m sl $h <<'EOF' + e sshing $h + ssh $h.b8.nz <<'EOF' source ~/.bashrc m dnsb8 EOF @@ -2932,6 +2945,9 @@ mpvgpu() { mpvd() { mpv --profile=d "$@"; } +mpva() { + mpv --profile=a "$@"; +} # mpv all media files in . or $1 mpvm() { local -a extensions arg @@ -3411,8 +3427,6 @@ spd() { } spamf() { # spamtest on FILE - local spamcpre spamdpid - if (( $# != 1 )); then e spamtest error: expected 1 arg, filename >&2 return 1 @@ -4016,12 +4030,6 @@ vrun() { "$@" } -f=/a/f/ansible-configs/files/common/etc/fsf-workstation-bashrc.sh -if [[ -e $f ]]; then - # shellcheck disable=SC1090 - source $f -fi - electrum() { # https://electrum.readthedocs.io/en/latest/tor.html # https://github.com/spesmilo/electrum-docs/issues/129 @@ -4039,23 +4047,34 @@ rgm() { } # re all my files more expansively + rem() { local paths paths="/p/c /b/" find $paths -not \( -name .svn -prune -o -name .git -prune \ -o -name .hg -prune -o -name .editor-backups -prune \ -o -name .undo-tree-history -prune \) 2>/dev/null | grep -iP --color=auto -- "$*" ||: - rgv -- "$*" $paths /a/t.org /p/w.org /a/work.org ||: + rgv $local_rgv_args -g "!bash_unpublished" -- "$*" $paths /a/work.org ||: } -reml() { # with limit to 5 matches per file +reml() { # rem with limit to 5 matches per file + local_rgv_args="-m 5" + rem "$@" +} + +rep() { local paths - paths="/p/c /b" + paths="/p/c" find $paths -not \( -name .svn -prune -o -name .git -prune \ -o -name .hg -prune -o -name .editor-backups -prune \ -o -name .undo-tree-history -prune \) 2>/dev/null | grep -iP --color=auto -- "$*" ||: - rgv -m 5 -- "$*" $paths /a/t.org /p/w.org /a/work.org ||: + rgv $local_rgv_args -- "$*" $paths /a/t.org /p/w.org ||: +} +repl() { # rem with limit to 5 matches per file + local local_rgv_args="-m 5" + rem "$@" } + # re on common fsf files ref() { local paths @@ -4202,9 +4221,6 @@ mypyenvinit () { } -export GOPATH=$HOME/go -path-add $GOPATH/bin -path-add /usr/local/go/bin # I have the git repo and a release. either one should work. # I have both because I was trying to solve an issue that @@ -4366,6 +4382,54 @@ ftoc() { units "tempF($1)" tempC } +# requires dns/firewall setup first +local-icecast() { + web-conf -e ian@iankelling.org -f 8000 - apache2 live.iankelling.org <<'EOF' + +AuthType Basic +AuthName "basic_auth" +# created with +# htpasswd -c icecast-fsf-htpasswd USERNAME +AuthUserFile "/etc/icecast-fsf-htpasswd" +Require valid-user + + +AuthType Basic +AuthName "basic_auth" +AuthUserFile "/etc/icecast-fsf-tech-htpasswd" +Require valid-user + +EOF +} + +# obs screen switching of +obof() { + ls -l /tmp/no-obs-auto-scene-switch + touch /tmp/no-obs-auto-scene-switch +} +# obs screen switching on +obon() { + ls -l /tmp/no-obs-auto-scene-switch + if [[ -e /tmp/no-obs-auto-scene-switch ]]; then + rm -f /tmp/no-obs-auto-scene-switch + fi +} + +obs-gen-profiles() { + local p=/p/c/basic/profiles + sed 's/fsf-sysops/fsf-tech/g' $p/fsfsysops/basic.ini >$p/fsftech/basic.ini + sed 's/fsf-sysops/fsf/g' $p/fsfsysops/basic.ini >$p/fsf/basic.ini +} + +# terminal clear. like clear, but put the prompt at the bottom, +# useful for obs streaming the bottom half of a terminal window. +tclear() { + for ((i=i; i