From: Ian Kelling Date: Wed, 18 May 2022 18:20:04 +0000 (-0400) Subject: improvements and fixes X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=774fe9ab8c8d5c71614feda5a283b4a91fb3f145;p=distro-setup improvements and fixes --- diff --git a/brc b/brc index ebbe38e..2a770ae 100644 --- a/brc +++ b/brc @@ -426,15 +426,17 @@ utcl() { # utc 24 hour time to local hour 24 hour time } # c. better cd -if type -p wcd &>/dev/null; then - if [[ $LC_INSIDE_EMACS ]]; then - c() { wcd -c -z 50 -o "$@"; } +if ! type -t c &>/dev/null; then + if type -p wcd &>/dev/null; then + if [[ $LC_INSIDE_EMACS ]]; then + c() { wcd -c -z 50 -o "$@"; } + else + # lets see what the fancy terminal does from time to time + c() { wcd -c -z 50 "$@"; } + fi else - # lets see what the fancy terminal does from time to time - c() { wcd -c -z 50 "$@"; } + c() { cd "$@"; } fi -else - c() { cd "$@"; } fi ccomp cd c @@ -1118,7 +1120,7 @@ low() { # make filenames lowercase, remove bad chars fi f="${arg##*/}" new="${f,,}" # downcase - new="${new//[^[:alnum:]._-]/_}" # sub bad chars + new="${new//[^a-zA-Z0-9._-]/_}" # sub bad chars new="${new#"${new%%[[:alnum:]]*}"}" # remove leading/trailing non-alnum new="${new%"${new##*[[:alnum:]]}"}" # remove bad underscores, like __ and _._ diff --git a/brc2 b/brc2 index d374c52..7d94df1 100644 --- a/brc2 +++ b/brc2 @@ -6,7 +6,9 @@ # * settings -HISTFILE=$HOME/.bh +if [[ $HISTFILE ]]; then + HISTFILE=$HOME/.bh +fi source /a/bin/distro-setup/path-add-function path-add /a/exe @@ -1074,9 +1076,11 @@ jrf() { journalctl -n 200 -f "$@" ; } ccomp journalctl jtail jr jrf -kff() { # keyboardio firmware flash - pushd /a/bin/distro-setup/Arduino/Model01-Firmware - yes $'\n' | make flash +kff() { # keyboardio firmware flash. you must hold down the tilde key + pushd /a/opt/Model01-Firmware + # if we didn't want this yes hack, then remove "shell read" from + # /a/opt/Kaleidoscope/etc/makefiles/sketch.mk + yes $'\n' | VERBOSE=1 make flash popd } @@ -1275,6 +1279,54 @@ mo() { xset dpms force off; } # monitor off mpvd() { mpv --profile=d "$@"; } +# mpv all media files in . or $1 +mpvm() { + local -a extensions arg + # get page source of https://en.wikipedia.org/w/index.php?title=Video_file_format&action=edit + # into /a/x.log, then + # grep '^| *\.' /a/x.log | sed 's/| *//;s/,//g' + extensions=( + .webm + .mkv + .flv + .flv + .vob + .ogv .ogg + .drc + .gif + .gifv + .mng + .avi + .MTS .M2TS .TS + .mov .qt + .wmv + .yuv + .rm + .rmvb + .viv + .asf + .amv + .mp4 .m4p .m4v + .mpg .mp2 .mpeg .mpe .mpv + .mpg .mpeg .m2v + .m4v + .svi + .3gp + .3g2 + .mxf + .roq + .nsv + ) + arg=("(" -iname "*${extensions[0]}") + for (( i=1 ; i < ${#extensions[@]}; i++ )); do + arg+=(-o -iname "*${extensions[i]}") + done + arg+=(")") + dir=${1:-.} + # debug: + #find $dir "${arg[@]}" -size +1M + find $dir "${arg[@]}" -size +1M -exec mpv --profile=d '{}' + +} mpvs() { mpv --profile=s "$@"; } @@ -1782,12 +1834,7 @@ mailnncheck() { vpncmd() { m sudo -E env "PATH=$PATH" nsenter -t $(pgrep -f "/usr/sbin/openvpn .* --config /etc/openvpn/.*client.conf") -n "$@" } -vpnf() { - sudo -v - vpncmd sudo -E -u iank env "PATH=$PATH" abrowser -no-remote -P vpn & - sleep 5 - r -} + vpn2f() { sudo -v vpncmd sudo -u iank env "PATH=$PATH" abrowser -no-remote -P vpn2 & r @@ -2044,7 +2091,9 @@ path-add /usr/local/go/bin # I have both because I was trying to solve an issue that # turned out to be unrelated. # ARDUINO_PATH=/a/opt/Arduino/build/linux/work -export ARDUINO_PATH=/a/opt/arduino-1.8.15 + +## i should have documented this... +# based on https://github.com/keyboardio/Kaleidoscope export KALEIDOSCOPE_DIR=/a/opt/Kaleidoscope # They want to be added to the start, but i think diff --git a/conflink b/conflink index 0e42e66..b045711 100755 --- a/conflink +++ b/conflink @@ -117,7 +117,7 @@ common-file-setup() { --exclude='/etc/exim4/passwd*' --exclude='/etc/exim4/*.pem' $fs/ / ) - echo "${cmd[@]@Q}" + m "${cmd[@]@Q}" while read -r line; do file="${line:12}" case $file in diff --git a/distro-end b/distro-end index 4b73b8b..e8e3ee0 100755 --- a/distro-end +++ b/distro-end @@ -1724,13 +1724,23 @@ pi --no-install-recommends kdeconnect # # I'm not seeing the icon, but the clipboard replication is working -### model 01 arduino support ### +### begin model 01 arduino support ### # https://github.com/keyboardio/Kaleidoscope/wiki/Install-Arduino-support-on-Linux # also built latest arduino in /a/opt/Arduino, (just cd build; ant build; ant run ) # set arduino var in bashrc, # have system config file setup too. sudo adduser $USER dialout +# as of 2022-05, +# download arduino ide, extract in /a/opt, ignore the install script, run ./arduino, +# toolbar, preferences, add board manager url: +# https://raw.githubusercontent.com/keyboardio/boardsmanager/master/package_keyboardio_index.json +# toolbar, board manager, add keyboardio +# toolbar, select model01 board +# toolbar, examples, model01, compile + +### + # this is for the mail command too. update-alternatives is kind of misleading # since at least it's main commands pretend mail does not exist. # bsd's mail got pulled in on some dumb dependency, i dunno how. diff --git a/mailtest-check b/mailtest-check index e997895..c7d40c1 100755 --- a/mailtest-check +++ b/mailtest-check @@ -93,7 +93,31 @@ main() { folders=(/m/md/l/testignore) froms=(testignore@je.b8.nz testignore@expertpathologyreview.com testignore@amnimal.ninja ian@iankelling.org z@zroe.org iank@gnu.org) if ! $int; then - timeout 120 rsync --chown iank:iank -e "ssh -oIdentitiesOnly=yes -F /dev/null -i /root/.ssh/jtuttle" -t --inplace -r 'jtuttle@fencepost.gnu.org:/home/j/jtuttle/Maildir/new/' /m/md/l/testignore/new + ### begin rsyncing fencepost email ### + # We dont want to exit if rsync fails, that will get caught by + # our later test by virtue of not having the latest email. + did_rsync=false + try_start_time=$EPOCHSECONDS + try_limit=140 # somewhat arbitrary value + while ! $did_rsync; do + try_left=$(( try_limit - ( EPOCHSECONDS - try_start_time) )) + timeout=120 # somewhat arbitrary value + if (( try_left < 0 )); then + break + fi + if (( try_left < timeout )); then + timeout=$try_left + fi + if timeout $timeout rsync --chown iank:iank -e "ssh -oIdentitiesOnly=yes -F /dev/null -i /root/.ssh/jtuttle" -t --inplace -r 'jtuttle@fencepost.gnu.org:/home/j/jtuttle/Maildir/new/' /m/md/l/testignore/new; then + did_rsync=true + else + sleep 4 + fi + done + if ! $did_rsync; then + echo mailtest-check: warning: fencepost rsync failed + fi + ### end rsyncing fencepost email ### fi ;; esac @@ -138,6 +162,7 @@ EOF last_sec="$file_sec" fi done <$tmpfile + rm -f $tmpfile to=$(awk '/^Envelope-to: / {print $2}' $latest) @@ -237,12 +262,21 @@ EOF #fi fi rm -f $resultfile - unexpected=$(( unexpected + ${#results[@]} )) + for r in ${results[@]}; do + case $r in + DKIM_INVALID|T_SPF_TEMPERROR|T_SPF_HELO_TEMPERROR) + missing_dnswl+=1 + ;; + *) + unexpected=$(( unexpected + 1 )) + ;; + esac + done for miss in ${missing[@]}; do - # We expect dns reputation services to go down from time to time, so + # We expect dns failures from time to time, so # we count them separately and alert differently. case $miss in - RCVD_IN_DNSWL_MED|DKIMWL_WL_HIGH) + DKIM_VALID|DKIM_VALID_AU|DKIM_VALID_EF|SPF_HELO_PASS|SPF_PASS|RCVD_IN_DNSWL_MED|DKIMWL_WL_HIGH) missing_dnswl+=1 ;; *) diff --git a/subdir_files/.config/i3/config b/subdir_files/.config/i3/config deleted file mode 100644 index a99c8c3..0000000 --- a/subdir_files/.config/i3/config +++ /dev/null @@ -1,141 +0,0 @@ -####### DO NOT EDIT LIVE CONFIG. generated from /a/bin/distro-setup/i3-sway/gen ####### - -# https://i3wm.org/docs/userguide.html#keybindings -#To get the current mapping of your keys, use xmodmap -pke. To -#interactively enter a key and see what keysym it is configured to, use -#xev. -set $mod Mod4 - -bindsym $mod+2 exec "pavucontrol" -bindsym $mod+3 exec "abrowser" -#bindsym $mod+3 exec "abrowser -no-remote -P sfw" -bindsym $mod+4 exec "abrowser -no-remote -P firefox-main-profile" -bindsym $mod+5 exec "/usr/local/bin/start-tor-browser" -bindsym $mod+6 exec "/a/bin/redshift.sh" -# bindsym $mod+equal exec "t s w; t in" -# bindsym $mod+Home exec "t out" -# #bindsym $mod+End exec "t s x; t in" -# bindsym $mod+grave exec "t s lunch; t in; t out -a '45 minutes from now'" - - -bindsym $mod+equal focus parent -# move firefox to current workspace. -# https://i3wm.org/docs/userguide.html#keybindings -# get class with xprop, example output -# WM_CLASS(STRING) = "irssi", "URxvt" -# xprop |& grep WM_CLASS -bindsym $mod+w [class="abrowser"] move workspace current - -bindsym $mod+e fullscreen toggle -bindsym $mod+r exec "/a/bin/ds/xl" -# todo, in newer i3, make this toggle split tabbed -bindsym $mod+t layout toggle split -bindsym $mod+Shift+t move workspace to output right -bindsym $mod+g layout tabbed - -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -bindsym $mod+u focus left -bindsym $mod+i focus right -bindsym $mod+o focus up -bindsym $mod+p focus down - -bindsym $mod+Left move left -bindsym $mod+Right move right -bindsym $mod+Up move up -bindsym $mod+Down move down - -# switch to workspace -bindsym $mod+Shift+a move container to workspace 4 -bindsym $mod+a workspace 4 -# move focused container to workspace -bindsym $mod+Shift+s move container to workspace 3 -bindsym $mod+s workspace 3 - -bindsym $mod+Shift+d move container to workspace 2 -bindsym $mod+d workspace 2 - -bindsym $mod+Shift+f move container to workspace 1 -bindsym $mod+f workspace 1 - -bindsym $mod+Shift+z move container to workspace 5 -bindsym $mod+z workspace 5 - -bindsym $mod+Shift+x move container to workspace 6 -bindsym $mod+x workspace 6 - - -# todo, in newer i3, make this split toggle -bindsym $mod+v split vertical -bindsym $mod+Shift+v split horizontal -# https://faq.i3wm.org/question/7662/reverse-perl-matches-in-criteria-in-i3-config.1.html -bindsym $mod+b [class="Emacs" title="^(?!#[a-zA-Z][a-zA-Z-]*$)"] move workspace current - -bindsym $mod+c kill - - -bindsym $mod+Shift+Home move container to workspace 7 -bindsym $mod+Home workspace 7 -bindsym $mod+Shift+q move container to workspace 8 -bindsym $mod+q workspace 8 - -bindsym $mod+Shift+8 move container to workspace 9 -bindsym $mod+8 workspace 9 -bindsym $mod+Shift+9 move container to workspace 10 -bindsym $mod+9 workspace 10 - - -# random keybind, feel free to change -bindsym $mod+Shift+m border toggle - -# toggle tiling / floating -bindcode $mod+Shift+65 floating toggle - -# change focus between tiling / floating windows -bindcode $mod+65 focus mode_toggle -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -bindsym $mod+j exec emacsclient -c -bindsym $mod+k exec konsole -bindsym $mod+l exec dmenu_run -# note default is 27% on my system76. not sure if these -# keybinds will screw up other laptop brightness keys. -bindsym XF86MonBrightnessUp exec brightnessctl s +5% -bindsym XF86MonBrightnessDown exec brightnessctl s 5%- - -# Font for window titles. Will also be used by the bar unless a different font -# is used in the bar {} block below. -font pango:monospace 8 - -# todo: only available in newer i3n -#hide_edge_borders smart - -#exec --no-startup-id /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd - -# Start clipster daemon -#exec --no-startup-id /a/opt/clipster/clipster -d - - -# shortcut to selection widget (primary) -bindsym $mod+End exec /a/opt/clipster/clipster -sp - -# file:///usr/share/doc/i3-wm/userguide.html#_border_style_for_new_windows -new_window none -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+o exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" - -bindsym $mod+Shift+p restart - -# need this for kde connect -# bar { -# status_command i3status -# # #status_command /usr/local/bin/myi3status -# mode hide -# # hidden_state hide -# # font pango:monospace 14 -# } - -exec copyq -exec /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd diff --git a/subdir_files/.config/sway/config b/subdir_files/.config/sway/config deleted file mode 100644 index 04ecbbd..0000000 --- a/subdir_files/.config/sway/config +++ /dev/null @@ -1,129 +0,0 @@ -####### DO NOT EDIT LIVE CONFIG. generated from /a/bin/distro-setup/i3-sway/gen ####### - -# https://i3wm.org/docs/userguide.html#keybindings -#To get the current mapping of your keys, use xmodmap -pke. To -#interactively enter a key and see what keysym it is configured to, use -#xev. -set $mod Mod4 - -bindsym $mod+2 exec "pavucontrol" -bindsym $mod+3 exec "abrowser" -#bindsym $mod+3 exec "abrowser -no-remote -P sfw" -bindsym $mod+4 exec "abrowser -no-remote -P firefox-main-profile" -bindsym $mod+5 exec "/usr/local/bin/start-tor-browser" -bindsym $mod+6 exec "/a/bin/redshift.sh" -# bindsym $mod+equal exec "t s w; t in" -# bindsym $mod+Home exec "t out" -# #bindsym $mod+End exec "t s x; t in" -# bindsym $mod+grave exec "t s lunch; t in; t out -a '45 minutes from now'" - - -bindsym $mod+equal focus parent -# move firefox to current workspace. -# https://i3wm.org/docs/userguide.html#keybindings -# get class with xprop, example output -# WM_CLASS(STRING) = "irssi", "URxvt" -# xprop |& grep WM_CLASS -bindsym $mod+w [class="abrowser"] move workspace current - -bindsym $mod+e fullscreen toggle -bindsym $mod+r exec "/a/bin/ds/xl" -# todo, in newer i3, make this toggle split tabbed -bindsym $mod+t layout toggle split -bindsym $mod+Shift+t move workspace to output right -bindsym $mod+g layout tabbed - -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -bindsym $mod+u focus left -bindsym $mod+i focus right -bindsym $mod+o focus up -bindsym $mod+p focus down - -bindsym $mod+Left move left -bindsym $mod+Right move right -bindsym $mod+Up move up -bindsym $mod+Down move down - -# switch to workspace -bindsym $mod+Shift+a move container to workspace 4 -bindsym $mod+a workspace 4 -# move focused container to workspace -bindsym $mod+Shift+s move container to workspace 3 -bindsym $mod+s workspace 3 - -bindsym $mod+Shift+d move container to workspace 2 -bindsym $mod+d workspace 2 - -bindsym $mod+Shift+f move container to workspace 1 -bindsym $mod+f workspace 1 - -bindsym $mod+Shift+z move container to workspace 5 -bindsym $mod+z workspace 5 - -bindsym $mod+Shift+x move container to workspace 6 -bindsym $mod+x workspace 6 - - -# todo, in newer i3, make this split toggle -bindsym $mod+v split vertical -bindsym $mod+Shift+v split horizontal -# https://faq.i3wm.org/question/7662/reverse-perl-matches-in-criteria-in-i3-config.1.html -bindsym $mod+b [class="Emacs" title="^(?!#[a-zA-Z][a-zA-Z-]*$)"] move workspace current - -bindsym $mod+c kill - - -bindsym $mod+Shift+Home move container to workspace 7 -bindsym $mod+Home workspace 7 -bindsym $mod+Shift+q move container to workspace 8 -bindsym $mod+q workspace 8 - -bindsym $mod+Shift+8 move container to workspace 9 -bindsym $mod+8 workspace 9 -bindsym $mod+Shift+9 move container to workspace 10 -bindsym $mod+9 workspace 10 - - -# random keybind, feel free to change -bindsym $mod+Shift+m border toggle - -# toggle tiling / floating -bindcode $mod+Shift+65 floating toggle - -# change focus between tiling / floating windows -bindcode $mod+65 focus mode_toggle -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -bindsym $mod+j exec emacsclient -c -bindsym $mod+k exec konsole -bindsym $mod+l exec dmenu_run -# note default is 27% on my system76. not sure if these -# keybinds will screw up other laptop brightness keys. -bindsym XF86MonBrightnessUp exec brightnessctl s +5% -bindsym XF86MonBrightnessDown exec brightnessctl s 5%- - -# Font for window titles. Will also be used by the bar unless a different font -# is used in the bar {} block below. -font pango:monospace 8 - -# todo: only available in newer i3n -#hide_edge_borders smart - -#exec --no-startup-id /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd - -# Start clipster daemon -#exec --no-startup-id /a/opt/clipster/clipster -d - - -# shortcut to selection widget (primary) -bindsym $mod+End exec /a/opt/clipster/clipster -sp - -# file:///usr/share/doc/i3-wm/userguide.html#_border_style_for_new_windows -new_window none -# exit sway (logs you out of your Wayland session) -bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' - -bindsym $mod+Shift+p reload