From 8d33c68549c02c45ed78a05f7de703a08ec245c6 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Sun, 29 Oct 2023 19:27:43 -0400 Subject: [PATCH] fixes, new features like initial debbugs --- .bashrc | 7 ++ brc | 96 +++++++++++++-- brc2 | 22 +++- distro-end | 5 + .../etc/systemd/system/bitcoind.service | 6 +- i3-sway/common.conf | 4 +- laptop-xrandr | 16 +-- mail-setup | 114 ++++++++++++++++++ mount-latest-subvol | 1 + pkgs | 3 + prof-tail | 6 +- subdir_files/.config/dunst/dunstrc | 75 +++++++++++- subdir_files/.gnupg/gpg.conf | 4 +- .../share/konsole/ianktheme.colorscheme | 98 +++++++++++++++ .../.local/share/konsole/profileian.profile | 2 +- 15 files changed, 429 insertions(+), 30 deletions(-) create mode 100644 subdir_files/.local/share/konsole/ianktheme.colorscheme diff --git a/.bashrc b/.bashrc index d8cbd97..c1dbd77 100644 --- a/.bashrc +++ b/.bashrc @@ -103,3 +103,10 @@ return 0 ## BEGIN_KITTY_SHELL_INTEGRATION # if test -n "$KITTY_INSTALLATION_DIR" -a -e "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; then source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; fi ## END_KITTY_SHELL_INTEGRATION + +# Automatically added by the Guix install script. +if [ -n "$GUIX_ENVIRONMENT" ]; then + if [[ $PS1 =~ (.*)"\\$" ]]; then + PS1="${BASH_REMATCH[1]} [env]\\\$ " + fi +fi diff --git a/brc b/brc index b2bac5b..d54570e 100644 --- a/brc +++ b/brc @@ -242,6 +242,7 @@ export SL_FILES_DIR=/b/ds/sl/.iank export SL_INFO_DIR=/p/sshinfo + # * include files if [[ -s $bashrc_dir/path-add-function ]]; then @@ -302,6 +303,15 @@ mysrc /a/bin/distro-functions/src/package-manager-abstractions ### begin FSF section ### +# use for temporary functions +y() { + m "${@//spring/fall}" +} +h() { + e "${@//spring/fall}" +} + + # Comments before functions are meant to be good useful # documentation. If they fail at that, please improve them or send Ian a # note. @@ -1766,8 +1776,12 @@ profsrc() { prof() { command prof &>/dev/null & } - - +# self chat +sc() { + while read -r l; do + printf '\033[1A\033[K'; printf "%s\n" "$l"| ts "%F %T" | tee -a /p/self-chat.log + done +} nmt() { # cant use s because sudo -i doesnt work for passwordless sudo command @@ -1820,15 +1834,15 @@ pkx() { # package extract c "$(mktemp -d)" pkg=$1 # shellcheck disable=SC2012 - cached=$(ls -t /var/cache/apt/archives/$pkg* | tail -n1 2>/dev/null) ||: + cached=$(ls -t /var/cache/apt/archives/${pkg}_* | tail -n1 2>/dev/null) ||: if [[ $cached ]]; then - cp $cached . + m cp $cached . else - aptitude download $pkg || return 1 + m aptitude download $pkg || return 1 fi tmp=(*); f=${tmp[0]} # only 1 expected - ex $f - rm -f $f + m ex $f + m rm -f $f } # pgrep and kill @@ -2750,6 +2764,45 @@ on-bat() { fi } +# make vim work with my light colortheme terminal. +vim() { + if [[ -e ~/.vimrc ]]; then + command vim "$@" + else + command vim -c ':colorscheme peachpuff' "$@" + fi +} + +# ls count. usage: pass a directory, get the number of files. +# https://unix.stackexchange.com/questions/90106/whats-the-most-resource-efficient-way-to-count-how-many-files-are-in-a-director +lsc() { + ls -Uq "$@"|wc -l +} + +# run then notify. close notification after the next prompt. +rn() { + "$@" + dunstify -u critical "$*" + _psrun=(dunstctl close-all) +} +n() { + dunstify -u critical n +} + +catnew() { + local dir file + dir="$1" + inotifywait -m "$dir" -e create -e moved_to | while read -r _ _ file; do + hr + cat "$dir/$file" + done +} +# cat mail +cm() { + catnew /m/md/$1/new +} + + # * misc stuff @@ -2840,6 +2893,26 @@ if [[ $- == *i* ]]; then if [[ $(jobs -p) ]]; then jobs_char='j\j ' fi + + + # allow a function to specify a command to run after we run the next + # command. Use case: a function makes a persistent notification. If + # we happen to be using that terminal, we can just keep working by + # entering our next command, even a noop in order to dismiss the + # notification, instead of having to explicitly dismiss it. + if [[ ${_psrun[@]} ]]; then + if (( _psrun_count >= 1 )); then + + "${_psrun[@]}" ||: + _psrun_count=0 + unset _psrun + else + _psrun_count=$(( _psrun_count + 1 )) + fi + else + _psrun_count=0 + fi + # We could test if sudo is active with sudo -nv # but then we get an email and log of lots of failed sudo commands. # We could turn those off, but seems better not to. @@ -2851,6 +2924,15 @@ if [[ $- == *i* ]]; then fi PS1="${PS1%"${PS1#*[wW]}"} $jobs_char$psudo\[$ps_color\]$ps_char\[$term_nocolor\] " + # copy of what is automatically added by guix. + # adds [env] to PS1 if GUIX_ENVIRONMENT is set and PS1 contains '$'; + if [ -n "$GUIX_ENVIRONMENT" ]; then + if [[ $PS1 =~ (.*)"\\$" ]]; then + PS1="${BASH_REMATCH[1]} [env]\\\$ " + fi + fi + + # set titlebar. instead, using more advanced # titelbar below #echo -ne "$_title_escape $HOSTNAME ${PWD/#$HOME/~} \007" diff --git a/brc2 b/brc2 index 93581a7..cc65950 100644 --- a/brc2 +++ b/brc2 @@ -71,6 +71,8 @@ source /a/bin/ds/beet-data # * functions + + multimic() { local i local -a sources @@ -674,6 +676,7 @@ beetag-nostatus() { fi if $erasable_line; then # https://stackoverflow.com/a/71286261 + # erase line / delete line in terminal printf '\033[1A\033[K' fi erasable_line=false @@ -2142,7 +2145,7 @@ gpg() { } gse() { - local email=ian@iankelling.org + local email=iank@fsf.org git send-email --notes "--envelope-sender=<$email>" \ --suppress-cc=self "$@" } @@ -3307,9 +3310,12 @@ testexim() { # # -t = get recipient from header exim -d -t </dev/null | grep -iP --color=auto -- "$*" ||: + rgv -- "$*" $paths /a/t.org /p/w.org /a/work.org ||: +} +reml() { # with limit to 5 matches per file local paths paths="/p/c /b" find $paths -not \( -name .svn -prune -o -name .git -prune \ diff --git a/distro-end b/distro-end index 4389b84..6e7f92a 100755 --- a/distro-end +++ b/distro-end @@ -1817,6 +1817,11 @@ DEVICESCAN -a -o on -S on -n standby,q $sched \ ########### misc stuff + +xdg-settings set default-web-browser abrowser.desktop +# see current with: +# xdg-settings get default-web-browser + # pressing tab after sdf here: # scp sdfbash: set +o noglob: command not found # in t11, bash 5.1.16. this fixes it. diff --git a/filesystem/etc/systemd/system/bitcoind.service b/filesystem/etc/systemd/system/bitcoind.service index 5d3206d..1a754e9 100644 --- a/filesystem/etc/systemd/system/bitcoind.service +++ b/filesystem/etc/systemd/system/bitcoind.service @@ -22,9 +22,9 @@ Wants=network-online.target [Service] # iank: on a laptop, when it is doing its catchup, it tends to jump -# between 100% and 180% cpu and makes the fan spin annoyingly. Randomly -# trying out 50% to see if it will make the fan quieter. -CPUQuota=50% +# between 100% and 180% cpu and makes the fan spin annoyingly. +# 50% still had annoying fan spin. trying out 20% +CPUQuota=20% ExecStart=/usr/bin/bitcoind -daemonwait \ -pid=/run/bitcoind/bitcoind.pid \ -conf=/etc/bitcoin/bitcoin.conf \ diff --git a/i3-sway/common.conf b/i3-sway/common.conf index d7b7745..ba9cdbd 100644 --- a/i3-sway/common.conf +++ b/i3-sway/common.conf @@ -25,7 +25,8 @@ bindsym $mod+6 exec "/usr/local/bin/start-tor-browser" # bindsym $mod+grave exec "t s lunch; t in; t out -a '45 minutes from now'" -bindsym $mod+equal focus parent +bindsym $mod+1 focus parent +bindsym $mod+equal exec "dunstctl close-all" # move firefox to current workspace. # https://i3wm.org/docs/userguide.html#keybindings # get class with xprop, example output @@ -99,7 +100,6 @@ 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 # 65 = space. diff --git a/laptop-xrandr b/laptop-xrandr index 8182e44..2b8425c 100755 --- a/laptop-xrandr +++ b/laptop-xrandr @@ -1,11 +1,13 @@ #!/bin/bash set -e; . /usr/local/lib/err; set +e -# xrandr --auto +if xrandr | grep -q '^HDMI2 disconnected' &>/dev/null; then + xrandr --auto +else + xrandr --output HDMI2 --right-of eDP1 --mode 3840x2160 -# xrandr --output HDMI2 --right-of eDP1 --mode 3840x2160 - -for i in 1 2 4 5 6 7 8 9 10; do - # if the workspace is already there, this will fail - i3-msg '[workspace="'$i'"]' move workspace to output HDMI2 ||: -done + for i in 1 2 4 5 6 7 8 9 10; do + # if the workspace is already there, this will fail + i3-msg '[workspace="'$i'"]' move workspace to output HDMI2 ||: + done +fi diff --git a/mail-setup b/mail-setup index 499bbac..3c1ad81 100755 --- a/mail-setup +++ b/mail-setup @@ -1366,6 +1366,10 @@ smtp_reserve_hosts = +iank_trusted LOCAL_DENY_EXCEPTIONS_LOCAL_ACL_FILE = /etc/exim4/conf.d/local_deny_exceptions_acl acl_not_smtp = acl_check_not_smtp + + +DEBBUGS_DOMAIN = b.b8.nz + EOF if dpkg --compare-versions "$(dpkg-query -f='${Version}\n' --show exim4)" ge 4.94; then @@ -2796,6 +2800,65 @@ EOF fi +# * debbugs + +pi debbugs +# missing dependency. apache error log: +# Can't locate List/AllUtils.pm in @INC (you may need to install the List::AllUtils module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.34.0 /usr/local/share/perl/5.34.0 /usr/lib/x86_64-linux-gnu/perl5/5.34 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.34 /usr/share/perl/5.34 /usr/local/lib/site_perl) at /var/lib/debbugs/www/cgi/pkgreport.cgi line 23. +pi liblist-allutils-perl lynx +# workarounds for broken debbugsconfig which is +# itself deprecated. this is temporary before I +# figure out how to install from git +gunzip /usr/share/doc/debbugs/examples/text.gz +mkdir -p /etc/debbugs/sources +debbugsconfig + + +# ld for local debbugs +/a/exe/web-conf -t -a 127.0.1.1 -p 80 -r /var/lib/debbugs/www - apache2 ld <<'EOF' +# copied from debbugs upstream example + + Options Indexes SymLinksIfOwnerMatch MultiViews + DirectoryIndex index.html + Require all granted + + +ScriptAlias /cgi/ /var/lib/debbugs/www/cgi/ + + AllowOverride None + Options ExecCGI SymLinksIfOwnerMatch + Require all granted + + +RewriteEngine on +RewriteCond %{HTTP_USER_AGENT} .*apt-listbugs.* +RewriteRule .* /apt-listbugs.html [R,L] + +# RewriteLog /org/bugs.debian.org/apache-rewrite.log +# RewriteLogLevel 0 + +#RewriteRule ^/$ http://www.debian.org/Bugs/ +RewriteRule ^/(robots\.txt|release-critical|apt-listbugs\.html)$ - [L] +# The following two redirect to up-to-date pages +RewriteRule ^/[[:space:]]*#?([[:digit:]][[:digit:]][[:digit:]]+)([;&].+)?$ /cgi-bin/bugreport.cgi?bug=$1$2 [L,R,NE] +RewriteRule ^/([^/+]*)([+])([^/]*)$ "/$1%%{%}2B$3" [N] +RewriteRule ^/[Ff][Rr][Oo][Mm]:([^/]+\@.+)$ /cgi-bin/pkgreport.cgi?submitter=$1 [PT,NE] +# Commented out, 'cuz aj says it will crash master. (old master) +# RewriteRule ^/[Ss][Ee][Vv][Ee][Rr][Ii][Tt][Yy]:([^/]+\@.+)$ /cgi-bin/pkgreport.cgi?severity=$1 [L,R] +RewriteRule ^/([^/]+\@.+)$ /cgi-bin/pkgreport.cgi?maint=$1 [PT,NE] +RewriteRule ^/mbox:([[:digit:]][[:digit:]][[:digit:]]+)([;&].+)?$ /cgi-bin/bugreport.cgi?mbox=yes&bug=$1$2 [PT,NE] +RewriteRule ^/src:([^/]+)$ /cgi-bin/pkgreport.cgi?src=$1 [PT,NE] +RewriteRule ^/severity:([^/]+)$ /cgi-bin/pkgreport.cgi?severity=$1 [PT,NE] +RewriteRule ^/tag:([^/]+)$ /cgi-bin/pkgreport.cgi?tag=$1 [PT,NE] +# RewriteMap fix-chars int:noescape +RewriteCond %{REQUEST_URI} ^/(Access\.html|Developer\.html|Reporting\.html|server-request\.html|server-control\.html|server-refcard\.html).* [NC] +RewriteRule .* - [L] +# PT|passthrough to bugreport.cgi and pkgreport.cgi +RewriteRule ^/([0-9]+)$ /cgi-bin/bugreport.cgi?bug=$1 [PT,NE] +RewriteRule ^/([^/]+)$ /cgi-bin/pkgreport.cgi?pkg=$1 [PT,NE] +EOF + + # * exim host conditional config # ** exim certs @@ -3035,6 +3098,36 @@ EOF if [[ ! -e /etc/exim4/no-delay-eximids ]]; then install -o iank -g iank <(echo) /etc/exim4/no-delay-eximids fi + + u /etc/exim4/conf.d/transport/30_debbugs <<'EOF' +debbugs_pipe: + debug_print = "T: debbugs_pipe for $local_part@$domain" + driver = pipe + command = /usr/lib/debbugs/receive + return_output +EOF + + + # We dont want delays or backups for mail being stored locally. + # We could put domain exclusion on other routes, but going for + # higher priority instead. + u /etc/exim4/conf.d/router/153_debbugs <<'EOF' +debbugs: + debug_print = "R: debbugs for $local_part@$domain" + driver = accept + transport = debbugs_pipe + local_parts = submit : bugs : maintonly : quiet : forwarded : \ + done : close : request : submitter : control : ^\\d+ + domains = DEBBUGS_DOMAIN + +bounce_debbugs: + debug_print = "R: bounce_debbugs for $local_part@$domain" + driver = redirect + allow_fail + data = :fail: Unknown user + domains = DEBBUGS_DOMAIN +EOF + u /etc/exim4/conf.d/router/155_delay <<'EOF' # By default, delay sending email by 30-40 minutes in case I # change my mind. @@ -3318,6 +3411,8 @@ EOF ;; # ** not MAIL_HOST|bk|je *) + echo|u /etc/exim4/conf.d/transport/30_debbugs + echo|u /etc/exim4/conf.d/router/153_debbugs echo|u /etc/exim4/conf.d/router/155_delay # this one should be removed for all non mail_hosts. note # bk and je never become mail_host @@ -3598,6 +3693,25 @@ elif [[ $uid != 608 ]]; then m find / /nocow -xdev -path ./var/tmp -prune -o -gid $gid -execdir chgrp -h 608 {} + fi + +# note: example config has a debbugs user, +# but my exim runs setuid as Debian-exim so it can't switch +# to another user. Anyways, I'm not exposing this to the +# internet at this time. If I do, the thing to do would +# be to use a sudo config (or sudo alternative). This +# would be how to setup + +# IFS=:; read -r _ _ uid _ < <(getent passwd debbugs||:) ||:; unset IFS +# if [[ ! $uid ]]; then +# # /a/opt/debbugs/debian/README.mail +# adduser --uid 610 --system --group --home /o/debbugs \ +# --no-create-home --disabled-login --force-badname debbugs +# m find /o/debbugs -xdev -path ./var/tmp -prune -o -uid $uid -execdir chown -h 610 {} + +# m find /o/debbugs -xdev -path ./var/tmp -prune -o -gid $gid -execdir chgrp -h 610 {} + +# elif [[ $uid != 610 ]]; then +# err debbugs exist but is not uid 610: investigate +# fi + # * start / stop services reifactive dnsmasq nscd diff --git a/mount-latest-subvol b/mount-latest-subvol index 9fd9932..cad9e1c 100644 --- a/mount-latest-subvol +++ b/mount-latest-subvol @@ -271,6 +271,7 @@ EOF fi fstab </dev/null \ - | awk '$3 != "me:" {print $3; fflush()}' | sed -u 's/^/pm /;s/@.*//' || [[ $? == 124 ]] & + | awk '$3 != "me:" {print $3; fflush()}' | sed -u 's/^/pm /;s/@.*//' ||: & timeout --foreground $secs_till_midnight tail -n0 -qF \ $logdir/rooms/*/$log_today 2>/dev/null \ - | awk '$3 != "iank:"' | grep -i '\biank\b' | awk '{print $3; fflush()}' | sed 's/^/room /;s/@.*//' || [[ $? == 124 ]] + | awk '$3 != "iank:"' | grep -i '\biank\b' | awk '{print $3; fflush()}' | sed 's/^/room /;s/@.*//' ||: sleep 1 diff --git a/subdir_files/.config/dunst/dunstrc b/subdir_files/.config/dunst/dunstrc index 3463bb0..d0be228 100644 --- a/subdir_files/.config/dunst/dunstrc +++ b/subdir_files/.config/dunst/dunstrc @@ -1,8 +1,79 @@ +[global] + monitor = 0 + follow = mouse + geometry = "300x5-30+20" + indicate_hidden = yes + shrink = no + transparency = 0 + notification_height = 0 + separator_height = 2 + padding = 8 + horizontal_padding = 8 + frame_width = 3 + frame_color = "#aaaaaa" + separator_color = frame + sort = yes + idle_threshold = 120 + font = Monospace 8 + line_height = 0 + markup = full + format = "%s\n%b" + alignment = left + vertical_alignment = center + show_age_threshold = 60 + word_wrap = yes + ellipsize = middle + ignore_newline = no + stack_duplicates = true + hide_duplicate_count = false + show_indicators = yes + icon_position = left + min_icon_size = 0 + max_icon_size = 32 + icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/ + sticky_history = yes + history_length = 20 + dmenu = /usr/bin/dmenu -p dunst: + browser = /usr/bin/sensible-browser + always_run_script = true + title = Dunst + class = Dunst + startup_notification = false + verbosity = mesg + corner_radius = 0 + ignore_dbusclose = false + force_xinerama = false + mouse_left_click = close_current + mouse_middle_click = do_action, close_current + mouse_right_click = close_all +[experimental] + per_monitor_dpi = false +[shortcuts] + close = ctrl+space + close_all = ctrl+shift+space + history = ctrl+grave + context = ctrl+shift+period +[urgency_low] + background = "#222222" + foreground = "#888888" + timeout = 10 +[urgency_normal] + background = "#285577" + foreground = "#ffffff" + timeout = 10 +[urgency_critical] + background = "#900000" + foreground = "#ffffff" + frame_color = "#ff0000" + timeout = 0 + +# above are the defaults from t11 in /etc/xdg/dunst/dunstrc + [play_sound] summary = "*" script = /b/ds/sound-alert # default light blue is too light -[urgency_normal] - background = "#335EA8" +#[urgency_normal] +# background = "#335EA8" diff --git a/subdir_files/.gnupg/gpg.conf b/subdir_files/.gnupg/gpg.conf index 0bf5256..d8ec5fc 100644 --- a/subdir_files/.gnupg/gpg.conf +++ b/subdir_files/.gnupg/gpg.conf @@ -43,9 +43,9 @@ default-key B125F60B7B287FF6A2B7DF8F170AF0E2954295DF #keyserver hkp://pgp.mit.edu #keyserver hkp://keyserver.pgp.com #keyserver hkp://ipv4.pool.sks-keyservers.net -#keyserver hkp://keys.gnupg.net +keyserver hkp://keys.gnupg.net #keyserver hkp://keyserver.ubuntu.com -keyserver hkp://keyring.debian.org +#keyserver hkp://keyring.debian.org #keyserver keyserver.ubuntu.com # more secure hkps, but had problems with my gpg version #keyserver hkps://hkps.pool.sks-keyservers.net diff --git a/subdir_files/.local/share/konsole/ianktheme.colorscheme b/subdir_files/.local/share/konsole/ianktheme.colorscheme new file mode 100644 index 0000000..1b4102d --- /dev/null +++ b/subdir_files/.local/share/konsole/ianktheme.colorscheme @@ -0,0 +1,98 @@ +# iank: did create new from black on white, then changed +# background to #f6f6f6 +[Background] +Color=246,246,246 + +[BackgroundFaint] +Color=246,246,246 + +[BackgroundIntense] +Color=246,246,246 + +[Color0] +Color=0,0,0 + +[Color0Faint] +Color=0,0,0 + +[Color0Intense] +Color=104,104,104 + +[Color1] +Color=178,24,24 + +[Color1Faint] +Color=101,0,0 + +[Color1Intense] +Color=255,84,84 + +[Color2] +Color=24,178,24 + +[Color2Faint] +Color=0,101,0 + +[Color2Intense] +Color=84,255,84 + +[Color3] +Color=178,104,24 + +[Color3Faint] +Color=101,94,0 + +[Color3Intense] +Color=255,255,84 + +[Color4] +Color=24,24,178 + +[Color4Faint] +Color=0,0,101 + +[Color4Intense] +Color=84,84,255 + +[Color5] +Color=178,24,178 + +[Color5Faint] +Color=101,0,101 + +[Color5Intense] +Color=255,84,255 + +[Color6] +Color=24,178,178 + +[Color6Faint] +Color=0,101,101 + +[Color6Intense] +Color=84,255,255 + +[Color7] +Color=178,178,178 + +[Color7Faint] +Color=101,101,101 + +[Color7Intense] +Color=255,255,255 + +[Foreground] +Color=0,0,0 + +[ForegroundFaint] +Color=0,0,0 + +[ForegroundIntense] +Color=0,0,0 + +[General] +Blur=false +ColorRandomization=false +Description=ianktheme +Opacity=1 +Wallpaper= diff --git a/subdir_files/.local/share/konsole/profileian.profile b/subdir_files/.local/share/konsole/profileian.profile index 6c55a5e..6e3eb3d 100644 --- a/subdir_files/.local/share/konsole/profileian.profile +++ b/subdir_files/.local/share/konsole/profileian.profile @@ -1,5 +1,5 @@ [Appearance] -ColorScheme=BlackOnLightYellow +ColorScheme=ianktheme Font=DejaVu Sans Mono,12,-1,5,50,0,0,0,0,0 [General] -- 2.30.2