X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc2;h=1be253a6151eab4f2b735a557c67d026c5fa5b73;hb=8d29de95be2b44cac6e2cc3d0643f542be05e4bd;hp=b6a4bd320e9b79b2be4c09dfb8e1877ae478070c;hpb=b757c84a4fc56f58b4985681b76df655d8db007a;p=distro-setup diff --git a/brc2 b/brc2 index b6a4bd3..1be253a 100644 --- a/brc2 +++ b/brc2 @@ -401,8 +401,7 @@ glue() { # usage: $0 REPO_PATH [URL_OR_PATH] _iki-convert() { - local url path input err repo_dir domain filename dir path url_dir - local initial_oldpwd initial_pwd + local url domain path input err repo_dir dir url_dir url repo_dir="$1" domain="$2" shift 2 @@ -417,7 +416,7 @@ _iki-convert() { fi case $input in http*) - path="$repo_dir/${input##http*://$domain/wiki/}" + path="$repo_dir/${input##http*://"$domain"/wiki/}" if [[ $path == */ ]]; then path=${path%/}.mdwn fi @@ -633,7 +632,7 @@ beetag-help() { cat <<'EOF' -y other genres z fg player ' = toggle play 1-5 rate +y other genres z fg player ' = toggle play 1-5 rate ] repeat1 ; previous _ = delete up/down skip mpv vol,pause,seek EOF hr @@ -697,12 +696,13 @@ mpvrpc-percent-pos() { # 1-5 rate # q quit # ret next +# beetag() { local last_genre_i fstring tag id char new_item char_i genre tag remove doplay i j random path local do_rare_genres read_wait help line lsout tmp ls_line skip_lookback local escape_char escaped_input expected_input skip_input_regex right_pad erasable_line seek_sec local pl_state_path pl_state_dir pl_state_file tmpstr - local new_random pl_seed_path seed_num seed_file fmt first_play + local new_random pl_seed_path seed_num seed_file fmt first_play repeat1 local -a buttons button_map ids tags tmp_tags initial_ls ls_lines paths local -A button_i local -i i j volume scrolled id_count line_int skip_start pre_j_count head_count skip_lookback @@ -714,6 +714,7 @@ beetag() { scrolled=999 # more than any $LINES ### begin arg processing ### random=false + repeat1=false new_random=false case $1 in -r) @@ -778,6 +779,7 @@ beetag() { fi # PijokVipiotOzeph is just a random string for a delimiter + # shellcheck disable=SC2016 # false positive fmt='%ifdef{rating,$rating }'"$fstring"'$genre | $title - $artist - $album $length $id PijokVipiotOzeph $path' # shellcheck disable=SC2016 # obvious reason tmpstr=$(beet ls -f "$fmt" "$@" | { if $random; then sort -R --random-source=$pl_seed_path; else cat; fi; } ) @@ -940,6 +942,15 @@ beetag() { echo volume=$volume continue ;; + ']') + if $repeat1; then + repeat1=false + else + repeat1=true + fi + echo repeat1=$repeat1 + continue + ;; q) kill-bg-quiet return @@ -1106,10 +1117,12 @@ beetag() { fi fi done - if (( j < id_count - 1 )); then - j+=1 - else - j=0 + if ! $repeat1; then + if (( j < id_count - 1 )); then + j+=1 + else + j=0 + fi fi if [[ $playlist ]]; then echo $j >$pl_state_path @@ -2317,9 +2330,119 @@ wgkey() { umask $umask_orig } +declare -A vpn_ips +vpn_ips[kd]=2 +# note: 1, 4, 5 are occupied by mail wireguard +vpn_ips[x3]=8 +vpn_ips[sy]=12 +vpn_ips[x2]=13 +vpn_ips[kw]=27 +vpn_ips[bo]=28 +vpn_ips[frodo]=34 + +vpn-ips-update() { + local host ipsuf f files + for host in ${!vpn_ips[@]}; do + ipsuf=${vpn_ips[$host]} + wghole $host $ipsuf + u /a/bin/ds/machine_specific/$host/filesystem/etc/systemd/system/openvpn-client-tr@.service < 3 )); then e expected 2-3 arg of hostname, ip suffix, and extrahost >&2 @@ -2331,12 +2454,20 @@ wghole() { if [[ $3 ]]; then extrahost=,$3 fi + for vpn_host in ${!vpn_ips[@]}; do + if [[ $vpn_host == "$host" ]]; then + continue + fi + vpn_allowed+=",10.174.${vpn_ips[$vpn_host]}.2/32" + done mkdir -p /p/c/machine_specific/$host/filesystem/etc/wireguard ( cd /p/c/machine_specific/$host/filesystem/etc/wireguard umask_orig=$(umask) umask 0077 - wg genkey | tee hole-priv.key | wg pubkey > hole-pub.key + if [[ ! -s hole-priv.key || ! -s hole-pub.key ]]; then + wg genkey | tee hole-priv.key | wg pubkey > hole-pub.key + fi cat >wghole.conf <>/tmp/calendar-bytes done done < <(grep -v '[#-]' /p/calendar-data) @@ -3504,7 +3636,7 @@ rem() { -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 ||: - } +} # setup: # pip3 install linode-cli