From: Ian Kelling Date: Thu, 7 Dec 2023 02:55:58 +0000 (-0500) Subject: bunch of new stuff, a few fixes X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=commitdiff_plain;h=523b7ff889aaafdcd997d84b2a06744993018e89 bunch of new stuff, a few fixes --- diff --git a/.dir_colors b/.dir_colors deleted file mode 100644 index 518294f..0000000 --- a/.dir_colors +++ /dev/null @@ -1,482 +0,0 @@ -# LS_COLORS -# Maintainer: Magnus Woldrich -# URL: https://github.com/trapd00r/LS_COLORS -# Version: master -# Updated: undefined -# -# This is a collection of extension:color mappings, suitable to use as your -# LS_COLORS environment variable. Most of them use the extended color map, -# described in the ECMA-48 document; in other words, you'll need a terminal -# with capabilities of displaying 256 colors. -# -# As of this writing, around 300 different filetypes/extensions is supported. -# That's indeed a lot of extensions, but there's a lot more! Therefore I need -# your help. -# -# Fork this project on github, add the extensions you are missing, and send me -# a pull request. -# -# For files that usually ends up next to each other, like html, css and js, -# try to pick colors that fit nicely together. Filetypes with multiple -# possible extensions, like htm and html, should have the same color. -# -# To install and use this file, put something like this is your shell resource -# file: -# -# eval $( dircolors -b $HOME/.LS_COLORS) -# -# where .LS_COLORS is this file. - -# {{{ Base -BLK 38;5;68 -CAPABILITY 38;5;17 -CHR 38;5;113;1 -DIR 38;5;33 -DOOR 38;5;127 -EXEC 38;5;174;1 -FIFO 38;5;126 -FILE 1 -LINK target -MULTIHARDLINK 38;5;220;1 -ORPHAN 38;5;196;38;5;232;1 -OTHER_WRITABLE 38;5;220;1 -SETGID 38;5;234;38;5;100;1 -SETUID 38;5;137 -SOCK 38;5;197 -STICKY 38;5;86;48;5;234 -STICKY_OTHER_WRITABLE 38;5;235;38;5;139 -# }}} -# Code, text, documents {{{ -.BAT 38;5;108 -.PL 38;5;160 -.asm 38;5;240;1 -.awk 38;5;148;1 -.bash 38;5;173 -.bat 38;5;108 -.c 38;5;110 -.cfg 38;5;63 -.coffee 38;5;94;1 -.cow 38;5;94;1 -.conf 38;5;63 -.cpp 38;5;24;1 -.cs 38;5;74;1 -.css 38;5;91 -.csv 38;5;78 -.ctp 38;5;95 -.diff 38;5;197 -.enc 38;5;192;3 -.eps 38;5;192 -.etx 38;5;172 -.ex 38;5;148;1 -.example 38;5;225;1 -.git 38;5;197 -.gitignore 38;5;240 -.go 38;5;117;1 -.h 38;5;81 -.hs 38;5;155;1 -.htm 38;5;125;1 -.html 38;5;125;1 -.info 38;5;101 -.ini 38;5;122 -.java 38;5;142;1 -.jhtm 38;5;125;1 -.js 38;5;42 -.jsm 38;5;42 -.jsm 38;5;42 -.json 38;5;13 -.jsp 38;5;45 -.lisp 38;5;204;1 -.log 38;5;190 -.lua 38;5;34;1 -.map 38;5;58;3 -.markdown 38;5;184 -.md 38;5;184 -.mf 38;5;220;3 -.mfasl 38;5;73 -.mi 38;5;124 -.mkd 38;5;184 -.mtx 38;5;36;3 -.nfo 38;5;220 -.o 38;5;240 -.pacnew 38;5;33 -.patch 38;5;5;1 -.pc 38;5;100 -.pfa 38;5;43 -.php 38;5;93 -.pid 38;5;160 -.pl 38;5;214 -.pm 38;5;197;1 -.pod 38;5;172;1 -.py 38;5;41 -.rb 38;5;192 -.rdf 38;5;144 -.rst 38;5;67 -.ru 38;5;142 -.sed 38;5;130;1 -.sfv 38;5;197 -.sh 38;5;113 -.signature 38;5;206 -.sql 38;5;222 -.srt 38;5;116 -.sty 38;5;58 -.sug 38;5;44 -.t 38;5;28;1 -.tcl 38;5;64;1 -.tdy 38;5;214 -.tex 38;5;172 -.textile 38;5;106 -.tfm 38;5;64 -.tfnt 38;5;140 -.theme 38;5;109 -.txt 38;5;192 -.urlview 38;5;85 -.vim 38;5;28 -.viminfo 38;5;240;1 -.xml 38;5;13 -.yml 38;5;208 -.zsh 38;5;173 - -# Build stuff -.1 38;5;196;1 -.1p 38;5;160 -.3p 38;5;160 -.am 38;5;242 -.in 38;5;242 -.old 38;5;242 -.out 38;5;46;1 - - - - -#}}} -# Pictures, icons {{{ -.bmp 38;5;62 -.cdr 38;5;59 -.gif 38;5;72 -.ico 38;5;73 -.jpeg 38;5;66 -.jpg 38;5;66 -.JPG 38;5;66 -.png 38;5;68;1 -.svg 38;5;24;1 -.xpm 38;5;36 -#}}} -# Emulator roms, emulator savegames {{{ -.32x 38;5;137 -.A64 38;5;82 -.a00 38;5;11 -.a52 38;5;112 -.a64 38;5;82 -.a78 38;5;112 -.adf 38;5;35 -.atr 38;5;213 -.cdi 38;5;124 -.fm2 38;5;35 -.gb 38;5;203 -.gba 38;5;205 -.gbc 38;5;204 -.gel 38;5;83 -.gg 38;5;138 -.ggl 38;5;83 -.j64 38;5;102 -.nds 38;5;193 -.nes 38;5;160 -.rom 38;5;59;1 -.sav 38;5;220 -.sms 38;5;33 -.st 38;5;208;1 -#}}} -# Images {{{ -.ipsw 38;5;146 -.iso 38;5;1 -.nrg 38;5;124 -.qcow 38;5;141 -#}}} -# Video {{{ -.VOB 38;5;137 -.IFO 38;5;240 -.BUP 38;5;241 -.MOV 38;5;42 -.asf 38;5;25 -.avi 38;5;114 -.flv 38;5;131 -.m2v 38;5;166 -.mkv 38;5;173 -.mov 38;5;42 -.mp4 38;5;9 -.mpg 38;5;38 -.mpeg 38;5;38 -.ogm 38;5;97 -.ogv 38;5;94 -.rmvb 38;5;112 -.sample 38;5;130;1 -.ts 38;5;39 -.vob 38;5;137 -.webm 38;5;109 -.wmv 38;5;113 -#}}} -# Music, audio {{{ -.S3M 38;5;71;1 -.aac 38;5;137 -.cue 38;5;112 -.dat 38;5;165 -.dts 38;5;100;1 -.fcm 38;5;41 -.flac 38;5;166;1 -.m3u 38;5;172 -.m4 38;5;196;3 -.m4a 38;5;137;1 -.mid 38;5;102 -.midi 38;5;102 -.mod 38;5;72 -.mp3 38;5;191 -.oga 38;5;95 -.ogg 38;5;96 -.s3m 38;5;71;1 -.sid 38;5;69;1 -.spl 38;5;173 -.wv 38;5;149 -.wvc 38;5;149 -#}}} -# Fonts {{{ -.afm 38;5;58 -.pfb 38;5;58 -.pfm 38;5;58 -.ttf 38;5;1 -.pcf 38;5;65 -.psf 38;5;64 -#}}} -# Backups, undo files, tempfiles {{{ -.bak 38;5;41;1 -.bin 38;5;249 -.swo 38;5;236 -.swp 38;5;241 -.tmp 38;5;244 -.un~ 38;5;240 -.zcompdump 38;5;240 -.zwc 38;5;240 -#}}} -# Databases {{{ -.db 38;5;60 -.dump 38;5;119 -.sqlite 38;5;60 -.typelib 38;5;60 - -#}}} -# Archives {{{ -.7z 38;5;40 -.a 38;5;46 -.arj 38;5;41 -.bz2 38;5;44 -.ipk 38;5;117 -.jad 38;5;50 -.jar 38;5;51 -.part 38;5;240;1 -.r00 38;5;235 -.r01 38;5;235 -.r02 38;5;235 -.r03 38;5;236 -.r04 38;5;237 -.r05 38;5;238 -.r06 38;5;239 -.r07 38;5;240 -.r08 38;5;241 -.r09 38;5;242 -.r10 38;5;243 -.r100 38;5;244 -.r101 38;5;240 -.r102 38;5;241 -.r103 38;5;242 -.r104 38;5;243 -.r105 38;5;244 -.r106 38;5;245 -.r107 38;5;246 -.r108 38;5;247 -.r109 38;5;248 -.r11 38;5;244 -.r110 38;5;249 -.r111 38;5;250 -.r112 38;5;251 -.r113 38;5;252 -.r114 38;5;253 -.r115 38;5;254 -.r116 38;5;255 -.r12 38;5;245 -.r13 38;5;246 -.r14 38;5;247 -.r15 38;5;248 -.r16 38;5;249 -.r17 38;5;250 -.r18 38;5;251 -.r19 38;5;252 -.r20 38;5;253 -.r21 38;5;254 -.r22 38;5;255 -.r25 38;5;255 -.r26 38;5;254 -.r27 38;5;253 -.r28 38;5;252 -.r29 38;5;251 -.r30 38;5;250 -.r31 38;5;249 -.r32 38;5;248 -.r33 38;5;247 -.r34 38;5;246 -.r35 38;5;245 -.r36 38;5;244 -.r37 38;5;243 -.r38 38;5;242 -.r39 38;5;241 -.r40 38;5;240 -.r41 38;5;239 -.r42 38;5;238 -.r43 38;5;237 -.r44 38;5;236 -.r45 38;5;235 -.r46 38;5;235 -.r47 38;5;235 -.r48 38;5;235 -.r49 38;5;235 -.r50 38;5;236 -.r51 38;5;237 -.r52 38;5;238 -.r53 38;5;239 -.r54 38;5;240 -.r55 38;5;241 -.r56 38;5;242 -.r57 38;5;243 -.r58 38;5;244 -.r59 38;5;245 -.r60 38;5;246 -.r61 38;5;247 -.r62 38;5;248 -.r63 38;5;249 -.r64 38;5;250 -.r65 38;5;251 -.r66 38;5;252 -.r67 38;5;253 -.r68 38;5;254 -.r69 38;5;255 -.r69 38;5;255 -.r70 38;5;254 -.r71 38;5;253 -.r72 38;5;252 -.r73 38;5;251 -.r74 38;5;250 -.r75 38;5;249 -.r76 38;5;248 -.r77 38;5;247 -.r78 38;5;246 -.r79 38;5;245 -.r80 38;5;244 -.r81 38;5;243 -.r82 38;5;242 -.r83 38;5;241 -.r84 38;5;240 -.r85 38;5;239 -.r86 38;5;238 -.r87 38;5;237 -.r88 38;5;236 -.r89 38;5;235 -.r90 38;5;235 -.r91 38;5;235 -.r92 38;5;236 -.r93 38;5;237 -.r94 38;5;238 -.r95 38;5;239 -.r96 38;5;240 -.r97 38;5;241 -.r98 38;5;242 -.r99 38;5;243 -.rar 38;5;106;1 -.tar 38;5;118 -.tar.gz 38;5;34 -.tgz 38;5;35;1 -.xz 38;5;118 -.zip 38;5;41 -.xpi 38;5;106 -#}}} -# {{{ Really compressed archives (documends, comics) -.pdf 38;5;203 -.djvu 38;5;141 -.cbr 38;5;140 -.cbz 38;5;140 -.chm 38;5;144 -#}}} -# Open document formats {{{ -.odt 38;5;111 -.ods 38;5;112 -.odp 38;5;166 -.odb 38;5;161 -#}}} -# /etc/hosts.{deny,allow} {{{ -.allow 38;5;112 -.deny 38;5;196 -#}}} -# other {{{ -.SKIP 38;5;244 -.def 38;5;136 -.directory 38;5;83 -.err 38;5;160;1 -.error 38;5;160;1 -.pi 38;5;126 -.properties 38;5;197;1 -.torrent 38;5;2 -.gp3 38;5;114 -.gp4 38;5;115 -.tg 38;5;99 -#}}} - -# {{{ TERM -TERM Eterm -TERM ansi -TERM color-xterm -TERM con132x25 -TERM con132x30 -TERM con132x43 -TERM con132x60 -TERM con80x25 -TERM con80x28 -TERM con80x30 -TERM con80x43 -TERM con80x50 -TERM con80x60 -TERM cons25 -TERM console -TERM cygwin -TERM dtterm -TERM eterm-color -TERM gnome -TERM gnome-256color -TERM jfbterm -TERM konsole -TERM kterm -TERM linux -TERM linux-c -TERM mach-color -TERM mlterm -TERM putty -TERM rxvt -TERM rxvt-256color -TERM rxvt-cygwin -TERM rxvt-cygwin-native -TERM rxvt-unicode -TERM rxvt-unicode-256color -TERM rxvt-unicode256 -TERM screen -TERM screen-256color -TERM screen-256color-bce -TERM screen-bce -TERM screen-w -TERM screen.rxvt -TERM screen.linux -TERM terminator -TERM vt100 -TERM xterm -TERM xterm-16color -TERM xterm-256color -TERM xterm-88color -TERM xterm-color -TERM xterm-debian -# }}} -# vim: set ft=dircolors fdm=marker et sw=2: diff --git a/.gitignore b/.gitignore index 5239dcb..4ebcc92 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ # generated files /subdir_files/.config/i3/config /subdir_files/.config/sway/config +/.mblaze/cur diff --git a/.tclshrc b/.tclshrc new file mode 100644 index 0000000..bb8d327 --- /dev/null +++ b/.tclshrc @@ -0,0 +1,15 @@ +; -*- tcl -*- + +;; iank: i ran tclsh, saw it had barely any editing commands, searched packages for tcl readline, +;; found tcl-tclreadline. it didn't show how to use it for tclsh. googled it, found +;; this page https://wiki.tcl-lang.org/page/tclreadline, which suggested the following snippet. + + + +package require tclreadline + +proc ::tclreadline::prompt1 {} { + return "[lindex [split [info hostname] "."] 0] [lindex [split [pwd] "/"] end] % " +} + +::tclreadline::Loop diff --git a/auto-commit-changes b/auto-commit-changes new file mode 100755 index 0000000..d46dd55 --- /dev/null +++ b/auto-commit-changes @@ -0,0 +1,19 @@ +#!/bin/bash + +commit() { + if ! git diff --quiet || ! git diff --cached --quiet; then + # even with -q, it emits a newline into stderr + git commit -qam autocommit 2>/dev/null + fi +} + + + +if [[ $1 ]]; then + for dir; do + cd $dir + commit + done +else + commit +fi diff --git a/brc b/brc index 048fa51..4274d6e 100644 --- a/brc +++ b/brc @@ -242,6 +242,24 @@ export SL_FILES_DIR=/b/ds/sl/.iank export SL_INFO_DIR=/p/sshinfo +### begin pyenv ### + +# this is adapted from things printed to term after install +# pyenv. commented for now since I'm not actually using pyenv. + +# export PYENV_ROOT="$HOME/.pyenv" +# command -v pyenv &>/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" +# command -v pyenv &>/dev/null && eval "$(pyenv init -)" + + +# output showed this example for pyenv-virtualenv, which i have no idea +# what it is, but leaving it as a comment in case I end up doing python +# dev. + +#eval "$(pyenv virtualenv-init -)" +### end begin pyenv ### + + # * include files @@ -798,12 +816,17 @@ cf() { done } caf() { - # shellcheck disable=SC2033 - find -L "$@" -type f -not \( -name .svn -prune -o -name .git -prune \ - -o -name .hg -prune -o -name .editor-backups -prune \ - -o -name .undo-tree-history -prune \) \ - -exec bash -c '. ~/.bashrc; hr; echo "$1"; hr; cat "$1"' _ {} \; 2>/dev/null + local file +find -L "$@" -type f -not \( -name .svn -prune -o -name .git -prune \ + -o -name .hg -prune -o -name .editor-backups -prune \ + -o -name .undo-tree-history -prune \) -printf '%h\0%d\0%p\n' | sort -t '\0' -n \ + | awk -F '\0' '{print $3}' 2>/dev/null | while read -r file; do + hr + printf "%s\n" "$file" + hr + cat "$file" +done } ccomp cat cf caf @@ -815,6 +838,10 @@ clc() { echo "scale=3; $x" | bc -l } +cx() { + chmod +X "$@" + } + cam() { git commit -am "$*" } @@ -1363,9 +1390,6 @@ and works in older versions of git which did not have that." g() { - # todo: patch emacs so it will look elsewhere. this is kinda sad: - # https://emacs.stackexchange.com/questions/4253/how-to-start-emacs-with-a-custom-user-emacs-directory - local args gdb=false if [[ $EMACSDIR ]]; then @@ -1388,6 +1412,10 @@ g() { fi fi if [[ $EMACSDIR ]]; then + + # todo: we don't have to alter HOME since emacs 29+, we can set + # user-emacs-directory with the flag --init-directory + # Alter the path here, otherwise the nfs mount gets triggered on the # first path lookup when emacs is not being used. # shellcheck disable=SC2098 disable=SC2097 # false positive @@ -2760,6 +2788,7 @@ vim() { # 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() { + # shellcheck disable=SC2790 # intentional ls -Uq "$@"|wc -l } @@ -2792,6 +2821,14 @@ cm() { if $use_color && type -p tput &>/dev/null; then + # this is nice for a dark background terminal: + # https://github.com/trapd00r/LS_COLORS + # I would like if there was something similar for light. + + # the default bold green is too light. + # this explains the codes: https://gist.github.com/thomd/7667642 + export LS_COLORS=ex=1 + term_bold="$(tput bold)" term_red="$(tput setaf 1)" term_green="$(tput setaf 2)" @@ -2885,7 +2922,7 @@ if [[ $- == *i* ]]; then # 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[*]} ]]; then if (( _psrun_count >= 1 )); then "${_psrun[@]}" ||: diff --git a/brc2 b/brc2 index 15f9539..1a6db0c 100644 --- a/brc2 +++ b/brc2 @@ -128,6 +128,12 @@ zcheck() { ssh bow rm /tmp/oegu.jpg feh /t/oegu.jpg } +zmon() { + while true; do + ziva-screen + sleep 15 + done +} slemacs() { local arg rtime v @@ -1646,7 +1652,7 @@ lipush() { local p a # excluding emacs for now #p=(/a/opt/{emacs-debian11{,-nox},mu,emacs} /a/bin /a/exe /a/h /a/c /p/c/machine_specific/vps{,.hosts}) - p=(/a/bin /a/exe /a/h /a/c /p/c/machine_specific/vps{,.hosts} /c/roles/prom_export/files/simple/usr/local/bin/fsf-install-node-exporter) + p=(/a/bin /a/exe /a/h /a/c /p/c/machine_specific/vps{,.hosts} /c/roles/prom_export/files/simple/usr/local/bin/fsf-install-node-exporter /a/opt/fpaste) a="-ahviSAXPH --specials --devices --delete --relative --exclude-from=/p/c/li-rsync-excludes" ret=0 for h in li je bk; do @@ -2169,7 +2175,9 @@ hstatus() { done } -# work log +## work log +# +# note: database location is specified in ~/.timetrap.yml, currently /p/.timetrap.db wlog() { local day i days_back days_back=${1:-16} @@ -2537,12 +2545,49 @@ mns() { # mount namespace m sudo -E /usr/bin/nsenter --mount=/root/mount_namespaces/$ns "$@" } +mnsd() { # mount namespace + systemd namespace + ns=$1 + unit=$2 + shift 2 + + s mkdir -p /root/mount_namespaces + if ! sudo mountpoint /root/mount_namespaces >/dev/null; then + m sudo mount --bind /root/mount_namespaces /root/mount_namespaces + fi + m sudo mount --make-private /root/mount_namespaces + if [[ ! -e /root/mount_namespaces/$ns ]]; then + m sudo touch /root/mount_namespaces/$ns + fi + if ! sudo mountpoint /root/mount_namespaces/$ns >/dev/null; then + m sudo unshare --propagation slave --mount=/root/mount_namespaces/$ns /bin/true + fi + + pid=$(servicepid $unit) + tmpf=$(mktemp --tmpdir $unit.XXXXXXXXXX) + export -p >$tmpf + printf "%s " "${@@Q}" >>$tmpf + echo >>$tmpf + + m sudo nsenter -t $pid -n --mount=/root/mount_namespaces/$ns sudo -u $USER -i bash -c ". $tmpf & sleep 1; rm $tmpf" +} + + mnsr() { # mns run local ns=$1 shift mns $ns sudo -u iank -E env "PATH=$PATH" "$@" } +mnsnonetr() { + ns=$1 + lomh + if ! s ip netns list | grep -Fx nonet &>/dev/null; then + s ip netns add nonet + fi + mns $ns --net=/var/run/netns/nonet /bin/bash + lomh +} + mnsnonet() { ns=$1 lomh @@ -3457,7 +3502,7 @@ sdnbashroot() { # systemd namespace bash sdncmd() { # systemd namespace cmd - local unit pid + local unit pid tmpf if (( $# <= 2 )); then echo $0: error wrong number of args >&2 return 1 @@ -3465,7 +3510,11 @@ sdncmd() { # systemd namespace cmd unit=$1 shift pid=$(servicepid $unit) - m sudo nsenter -t $pid -n -m sudo -u $USER -i "$@" + tmpf=$(mktemp --tmpdir $unit.XXXXXXXXXX) + export -p >$tmpf + printf "%s " "${@@Q}" >>$tmpf + echo >>$tmpf + m sudo nsenter -t $pid -n -m sudo -u $USER -i bash -c ". $tmpf & rm $tmpf" } @@ -3570,11 +3619,33 @@ fixu() { # unmute um() { + local sink card + sink=$(pactl get-default-sink) + if [[ $sink != auto_null ]]; then + return + fi + + # guessing there is just one with an off profile. otherwise we will + # need some other solution, like storing the card identifier that we + # muted with nap. + card=$(pacmd list-cards | sed -n '/^[[:space:]]*index:/{s/^[[:space:]]*index://;h};/^[[:space:]]*active profile: $/{g;p;q}') + m pacmd set-card-profile "$card" output:analog-stereo + pactl set-sink-mute @DEFAULT_SINK@ false rm -f /tmp/ianknap } + nap() { - pactl set-sink-mute @DEFAULT_SINK@ true + local sink card + sink=$(pactl get-default-sink) + card="${sink%.*}" + card="${card/output/card}" + m pacmd set-card-profile "$card" off + + # clicking on a link in a browser can cause unmute. + # I don't want that. So, use a stronger form of mute + # than this. + #pactl set-sink-mute @DEFAULT_SINK@ true touch /tmp/ianknap } @@ -3666,7 +3737,13 @@ vpnoffc() { # vpn off client ser stop openvpn-client-tr@client } vpnc() { - ser start openvpn-client-tr@client + local unit + unit=openvpn-client-tr@client + sudo -v + if [[ $(systemctl is-active $unit) != active ]]; then + s systemctl start $unit + sleep 1 + fi } @@ -3751,6 +3828,13 @@ reml() { # with limit to 5 matches per file rgv -m 5 -- "$*" $paths /a/t.org /p/w.org /a/work.org ||: } + +# for use in /f/bind +fupzone() { + # shellcheck disable=SC2046 # i want word splitting + ./update-zone $(i s | sed -rn 's/.*db\.(.*)/\1/p') +} + # setup: # pip3 install linode-cli # linode-cli @@ -3919,7 +4003,8 @@ rgv() { # -i = case insensitive # -M = max columns # --no-messages because of annoying errors on broken symlinks - command rg -. -z --no-messages -i -M 900 -g '!.git' -g '!auto-save-list' -g '!.savehist' "$@" || ret=$? + # --no-ignore-parent because i have /a/.git which ignores almost everything under it. + command rg -. -z --no-messages -i -M 900 --no-ignore-parent -g '!.git' -g '!auto-save-list' -g '!.savehist' "$@" || ret=$? return $ret } diff --git a/distro-end b/distro-end index 6e7f92a..f2eef43 100755 --- a/distro-end +++ b/distro-end @@ -662,6 +662,22 @@ EOF ;; li) + p build-dep eggdrop + if [[ ! -L ~/eggdrop/eggdrop ]]; then + cd + git clone https://github.com/eggheads/eggdrop eggdrop-src + cd eggdrop-src + ./configure + make config + make + make install + fi + + # dunno if this is really needed. it was part of the documented eggdrop systemd install script + sudo loginctl enable-linger + systemctl --user enable fsysbot + systemctl --user start fsysbot + m /a/h/setup.sh iankelling.org # start mumble only when im going to use it, since i dont use it much diff --git a/eggdrop-upgrade b/eggdrop-upgrade new file mode 100755 index 0000000..31e81d4 --- /dev/null +++ b/eggdrop-upgrade @@ -0,0 +1,33 @@ +#!/bin/bash + +if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi +shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4 +set -eE -o pipefail +trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" exit status: $?, PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR + + +if [[ ! -d ~/eggdrop-src ]]; then + exit 0 +fi +cd ~/eggdrop-src +git fetch -q + +newest_tag=$(git tag | grep ^v|sort -Vr|head -n1) + +this_tag=$(git describe --tags) + +if [[ $newest_tag == "$this_tag" ]]; then + exit 0 +fi + +set -x + +git checkout -q $newest_tag +make clean +./configure +make config +make +make install +systemctl --user stop fsysbot +sleep 10 +systemctl --user start fsysbot diff --git a/filesystem/etc/cron.d/ian b/filesystem/etc/cron.d/ian index bdabe21..7c24b4a 100644 --- a/filesystem/etc/cron.d/ian +++ b/filesystem/etc/cron.d/ian @@ -15,3 +15,5 @@ MAILTO=root 20 5 * * * root prof-backup |& log-once -1 prof-backup 19 * * * * root check-crypttab 4 20 * * 5 iank /usr/local/bin/check-lets-encrypt-ssl-settings +4 21 * * 5 iank /b/ds/auto-commit-changes /a /p +4 24 * * 5 iank failmail /b/ds/eggdrop-upgrade diff --git a/filesystem/usr/local/bin/prof-irc b/filesystem/usr/local/bin/prof-irc new file mode 100755 index 0000000..31c2823 --- /dev/null +++ b/filesystem/usr/local/bin/prof-irc @@ -0,0 +1,13 @@ +#!/bin/bash + +# This, along with changes to emacs init file and prof-remote allows us +# to press alt-c in profanity to send the current text to #fsfsys. +exec emacsclient -s profanity -a "" "$@" + +# Background. I experimented with running 2 xmpp clients, in which case +# I could connect up to a daemon running irc on the local system, which +# I do anyways, and I would not need to run another irc client on the +# main profanity server. Buut, the problem is that messages to a chat +# room don't go to the other client (well, if you reconnect, they will +# display because of mam, but they don't go into the log.) That is no +# good. diff --git a/fsfsys-recent b/fsfsys-recent new file mode 100755 index 0000000..c1b15c9 --- /dev/null +++ b/fsfsys-recent @@ -0,0 +1,36 @@ +#!/bin/bash + +if [[ -e /tmp/fsfsys-recent ]]; then + tmp=$(mktemp) + touch --date="1 minutes ago" "$tmp" + cooldown=false + if [[ /tmp/fsfsys-recent -nt "$tmp" ]]; then + cooldown=true + fi + rm -f "$tmp" + if $cooldown; then + echo "error: wait 1 minute between requests" + exit 0 + fi + + tmp2=$(mktemp) + touch --date="5 minute ago" "$tmp2" + cache=false + if [[ /tmp/fsfsys-recent -nt "$tmp2" ]]; then + cache=true + fi + rm -f "$tmp2" + if $cache; then + cat /tmp/fsfsys-recent + exit 0 + fi +fi + +d='/var/lib/znc/moddata/log/iank/libera/#fsfsys' +date0=$(date +%Y-%m-%d) +date1=$(date +%Y-%m-%d -d yesterday) +f0="$d/$date0.log" +f1="$d/$date1.log" +url=$( { sed "s/^/$date1 /" $f1; sed "s/^/$date0 /" $f0; } | /a/opt/fpaste/fpaste -x 60 |& grep -i '^http' | sed -r 's,/view/,/view/raw/,' ) +notice='This url is not public and this message does not not imply permission to share it publicly. It expires in 60 minutes. Related: the "Public logging" section at https://libera.chat/policies/.' +printf "%s %s\n" "$url" "$notice" | tee /tmp/fsfsys-recent diff --git a/fsfsys-recent.tcl b/fsfsys-recent.tcl new file mode 100644 index 0000000..a1dff26 --- /dev/null +++ b/fsfsys-recent.tcl @@ -0,0 +1,5 @@ +bind pubm * "#fsfsys fsysbot catch me up" fsfsys-recent + +proc fsfsys-recent { nick user handle channel text } { + putserv "PRIVMSG $nick :[exec /b/ds/fsfsys-recent]" +} diff --git a/machine_specific/li/subdir_files/.config/systemd/user/fsysbot.service b/machine_specific/li/subdir_files/.config/systemd/user/fsysbot.service new file mode 100644 index 0000000..b36b6d3 --- /dev/null +++ b/machine_specific/li/subdir_files/.config/systemd/user/fsysbot.service @@ -0,0 +1,15 @@ +### Eggdrop systemd unit, generated by autosystemd + +[Unit] +Description=fsysbot (Eggdrop) +After=default.target + +[Service] +WorkingDirectory=/home/iank/eggdrop +ExecStart=/home/iank/eggdrop/eggdrop eggdrop-fsysbot.conf +ExecReload=/usr/bin/kill -s HUP $MAINPID +Type=forking +Restart=on-abnormal + +[Install] +WantedBy=default.target diff --git a/mail-setup b/mail-setup index e55aa47..e2d02f6 100755 --- a/mail-setup +++ b/mail-setup @@ -1864,8 +1864,8 @@ if mailhost; then # plus debug does not help. # sudo -u radicale radicale -D - # created password file with: - # htpasswd -c /p/c/machine_specific/li/filesystem/etc/caldav-htpasswd + # created radicale password file with: + # htpasswd -c /p/c/machine_specific/li/filesystem/etc/caldav-htpasswd ian # chmod 640 /p/c/machine_specific/li/filesystem/etc/caldav-htpasswd # # setup chgrp www-data in ./conflink diff --git a/pkgs b/pkgs index ac600a6..6a6b962 100644 --- a/pkgs +++ b/pkgs @@ -261,6 +261,8 @@ p3=( swh-plugins tar-doc tcpdump + tcl + tcl-tclreadline telnet tmate transmission-remote-gtk diff --git a/prof-tail b/prof-tail index 8f2d2db..9830747 100644 --- a/prof-tail +++ b/prof-tail @@ -18,6 +18,11 @@ xmpp_users=( jtuttle ) +# start emacs daemon for profanity if it doesnt exist. +if ! pgrep -f '^emacs --daemon=profanity$' &>/dev/null; then + emacs --daemon=profanity &>/dev/null +fi + while true; do midnight=$(date -d '00:00:00 tomorrow' +%s) @@ -27,6 +32,7 @@ while true; do # when this fails, it has PIPESTATUS: 124 0 1 0 0, which seems to end up with 1 as the overall code, which is not what # i expected. todo: investigate if and why that is, and narrow the ||: + # shellcheck disable=SC2046 # intentional timeout --foreground $secs_till_midnight tail -n0 -qF \ $(for u in ${xmpp_users[@]}; do echo $logdir/${u}_at_fsf.org/$log_today; done) 2>/dev/null \ | awk '$3 != "me:" {print $3; fflush()}' | sed -u 's/^/pm /;s/@.*//' ||: & diff --git a/subdir_files/eggdrop/eggdrop-fsysbot.conf b/subdir_files/eggdrop/eggdrop-fsysbot.conf new file mode 100644 index 0000000..d1d879d --- /dev/null +++ b/subdir_files/eggdrop/eggdrop-fsysbot.conf @@ -0,0 +1,460 @@ +#! /path/to/executable/eggdrop +# ^- This should contain a fully qualified path to your Eggdrop executable. + +## This is the basic version of Eggdrop's config file and contains only the +## most commonly used settings for a standard Eggdrop setup. +## PLEASE see eggdrop.conf that ships with Eggdrop for the full documentation +## and list settings you can use here. Or, you can just use eggdrop.conf +## instead! +## +## The pound signs (#) that you see at the beginning of some lines mean that +## the remainder of that line is a comment, or just for your information. By +## adding or deleting pound signs, you can comment or uncomment a setting, +## respectively. +## +## Arguments for a command or setting may be inclosed in <>'s or []'s in the +## example/description. Arguments in <>'s are required, while [] means optional. +## +## More detailed descriptions of all these settings can be found in +## doc/settings/. + +## These are the common modules loaded by eggdrop for an IRC-connected bot. +## For a complete description of each module, please consult eggdrop.conf +loadmodule pbkdf2 ; # Generation 2 userfile encryption +loadmodule blowfish ; # Legacy userfile encryption support +loadmodule channels ; # Channel support +loadmodule server ; # Core server support +loadmodule ctcp ; # CTCP functionality +loadmodule irc ; # Basic IRC functionality +#loadmodule transfer ; # DCC SEND/GET and Userfile transfer +#loadmodule share ; # Userfile sharing +#loadmodule compress ; # Compress userfiles for transfer +#loadmodule filesys ; # File server support +#loadmodule notes ; # Note storing for users +loadmodule console ; # Console setting storage +#loadmodule seen ; # Basic seen functionality +#loadmodule assoc ; # Party line channel naming +loadmodule uptime ; # Centralized uptime stat collection (http://uptime.eggheads.org) +#loadmodule ident ; # Ident support +#loadmodule twitch ; # Twitch gaming service support + + +##### BASIC SETTINGS ##### + +## Set the nick the bot uses on IRC, and on the botnet unless you specify a +## separate botnet-nick, here. +set nick "fsysbot" + +## Set the alternative nick which the bot uses on IRC if the nick specified +## by 'set nick' is unavailable. All '?' characters will be replaced by random +## numbers. +set altnick "fsysbot2" + +## Set what should be displayed in the real-name field for the bot on IRC. +## This can not be blank, it has to contain something. +set realname "/msg fsysbot hello" + +## This setting defines the username the bot uses on IRC. This setting has no +## effect if an ident daemon is running on your bot's machine. See also ident +## module. +set username "iank" + +# Specify here the filename Eggdrop will save its pid to. If no pidfile is +# specified, pid.(botnet-nick) will be used. +#set pidfile "pid.LamestBot" + +## This setting defines which contact person should be shown in .status, +## /msg help, and other places. You really should include this information. +set admin "iank@fsf.org" + +## This setting is used only for info to share with others on your botnet. +## Set this to the IRC network your bot is connected to. +set network "irc.libera.chat" + +# Un-comment the next line and set the list of owners of the bot. +# You NEED to change this setting. +# This is a list of handles -- usernames in the bot. +#set owner "MrLame, MrsLame" + +# This is the bot's server list. The bot will start at the first server listed, +# and cycle through them whenever it gets disconnected. You need to change these +# servers to YOUR network's servers. +# +# The format is: +# server add [port [password]] +# Prefix the port with a plus sign to attempt a SSL connection: +# server add +port [password] +# +# Both the port and password fields are optional. If a port isn't specified, +# the default-port setting will be used. If you want to set a password or use +# SSL, you must specify a port. +# +# This format is new as of version 1.9.0. The previous method using +# set servers {} will still work for now, but is deprecated and will be removed +# in a future release. +server add irc.libera.chat 6667 + +############################################################################ +## Network settings overview +## With the addition of IPv6 and the associated config changes, here are some +## BASIC common networking scenarios, along with the appropriate settings +## needed: +## +## SHELL PROVIDER (MULTIPLE IPs/VHOSTS) +## * set vhost4 or vhost6 to the IP/vhost you want to use +## * do not set nat-ip +## +## HOME COMPUTER/VPS, DIRECT INTERNET CONNECTION (SINGLE IP, NO NAT) +## * do not set vhost4/vhost6 +## * do not set nat-ip +## +## HOME COMPUTER, BEHIND A NAT +## * do not set vhost4/vhost6 +## * set nat-ip to your external IP +## +## And as a general rule, if you're having issues with Eggdrop responding to +## a CTCP chat request, try setting vhost4/6 to your external IP. +## +## Below is a detailed description of each setting, please read them to +## learn more about their function. +############################################################################ + +## If your host has multiple IPv4 addresses, uncomment and set this variable +## to the IP you wish to use for connecting to IRC. +#set vhost4 "virtual.host.com" +#set vhost4 "99.99.0.0" + +# If your host has multiple IPv6 addresses, uncomment and set this variable +# to the IP you wish to use for connecting to IRC. +#set vhost6 "my.ipv6.host.com" +#set vhost6 "2001:db8::c001:b07" + +## If you have a NAT firewall, enter your outside IP here. This IP +## is used for transfers and CTCP replies only, and is different than the +## vhost4/6 settings. You likely still need to set them. +#set nat-ip "127.0.0.1" + +## If you want all dcc file transfers to use a particular portrange either +## because you're behind a firewall, or for other security reasons, set it +## here. +#set reserved-portrange 2010:2020 + +## Prefer IPv6 over IPv4 for connections and dns resolution? +## If the preferred protocol family is not supported, the other one +## will be tried. +set prefer-ipv6 0 + +## If you want to have your Eggdrop messages displayed in a language other +## than English, change this setting to match your preference. An alternative +## would be to set the environment variable EGG_LANG to that value. +## +## Languages included with Eggdrop: Danish, English, French, Finnish, German, +## Italian, Portuguese. +#addlang "english" + +##### LOG FILES ##### + +## See eggdrop.conf for documentation on the logfile flags and settings. + +# This creates a logfile named eggdrop.log that captures items logged at the +# m, c, and o log levels (private msgs/ctcps, commands/errors, and misc +# info) from any channel. +logfile mco * "logs/eggdrop.log" + +# This creates a logfile named lamest.log that captures items logged at the +# j, p, and k log levels (joins/parts/quits/netsplits, public chat, +# kicks/bans/mode changes) on the channel #lamest. +#logfile jpk #lamest "logs/lamest.log" + +## This should be 0 for disk space restricted shells, and 1 if you want to +## generate channel statistics with tools such as pisg. +## If it is 0, eggdrop will delete logfiles older than 2 days. +## If it is 1, eggdrop will keep logging into the specified logfiles forever. +## See eggdrop.conf for more detailed settings. +set log-forever 0 + +## Code to set settings based on the above setting, do not edit this. +if {${log-forever}} { + set switch-logfiles-at 2500 + set keep-all-logs 0 +} + +## "Writing user file..." and "Writing channel file..." messages won't be logged +## anymore if this option is enabled. If you set it to 2, the "Backing up user +## file..." and "Backing up channel file..." messages will also not be logged. +## In addition to this, you can disable the "Switching logfiles..." and the new +## date message at midnight, by setting this to 3. +set quiet-save 0 + +##### FILES AND DIRECTORIES ##### + +# Specify here the filename your userfile should be saved as. +set userfile "fsysbot.user" + +# Specify here where Eggdrop should look for help files. Don't modify this +# setting unless you know what you're doing! +set help-path "help/" + +##### BOTNET/DCC/TELNET ##### + +## If you want to use a different nickname on the botnet than you use on +## IRC (i.e. if you're on an un-trusted botnet), un-comment the next line +## and set it to the nick you would like to use. +#set botnet-nick "LlamaBot" + +# This opens a telnet port by which you and other bots can interact with the +# Eggdrop by telneting in. There are more options for the listen command in +# doc/tcl-commands.doc. Note that if you are running more than one bot on the +# same machine, you will want to space the telnet ports at LEAST 5 apart, +# although 10 is even better. +# +# Valid ports are typically anything between 1025 and 65535 assuming the +# port is not already in use. If you would like the bot to listen for users +# and bots in separate ports, use the following format: +# +# listen 3333 bots +# listen 4444 users +listen 127.0.0.1 2888 users +# +# If you wish to use only one port, use this format: +# +# listen 3333 all +# +# You can setup a SSL port by prepending a plus sign to it: +# +# listen +5555 all +# +# To bind the listening port to a specific IP instead of all available, insert +# a valid IP assigned to the host Eggdrop is running on in front of the port +# (this replaces the listen-addr setting used prior to Eggdrop v1.9) +# +# listen 1.2.3.4 3333 all +# +# You need to un-comment this line and change the port number in order to open +# the listen port. You should not keep this set to 3333. +#listen 3333 all + +##### SSL SETTINGS ##### + +## Settings in this section take effect when eggdrop is compiled with TLS +## support. If you didn't generate SSL keys already, you can type +## 'make sslcert' in your eggdrop source directory. +## +## IMPORTANT: The following two settings MUST be uncommented in order to +## use SSL functionality! +#set ssl-privatekey "eggdrop.key" + +## Specify the filename where your SSL certificate is located. If you +## don't set this, eggdrop will not be able to act as a server in SSL +## connections. Must be in PEM format. +#set ssl-certificate "eggdrop.crt" + +## Specify the location at which CA certificates for verification purposes +## are located. These certificates are trusted. If you don't set this, +## certificate verification will not work. +set ssl-capath "/etc/ssl/" + +## Enable certificate authorization. Set to 1 to allow users and bots to +## identify automatically by their certificate fingerprints. Setting it +## to 2 to will force fingerprint logins. With a value of 2, users without +## a fingerprint set or with a certificate UID not matching their handle +## won't be allowed to login on SSL enabled telnet ports. Fingerprints +## must be set in advance with the .fprint and .chfinger commands. +## NOTE: this setting has no effect on plain-text ports. +#set ssl-cert-auth 0 + +## You can control SSL certificate verification using the following variables. +## All of them are flag-based. You can set them by adding together the numbers +## for all exceptions you want to enable. By default certificate verification +## is disabled and all certificates are assumed to be valid. The numbers are +## the following: +## +## Enable certificate verification - 1 +## Allow self-signed certificates - 2 +## Don't check peer common or alt names - 4 +## Allow expired certificates - 8 +## Allow certificates which are not valid yet - 16 +## Allow revoked certificates - 32 +## A value of 0 disables verification. + +## Control certificate verification for IRC servers +#set ssl-verify-server 0 + +## Control certificate verification for DCC chats (only /dcc chat botnick) +#set ssl-verify-dcc 0 + +## Control certificate verification for linking to hubs +#set ssl-verify-bots 0 + +## Control certificate verification for SSL listening ports. This includes +## leaf bots connecting, users telneting in and /ctcp bot chat. +#set ssl-verify-clients 0 + + +##### COMMON MODULES SETTINGS ##### + +## Below are various settings for the modules included with Eggdrop. +## PLEASE READ AND EDIT THEM CAREFULLY, even if you're an old hand at +## Eggdrop, things change. + +## This path specifies the path were Eggdrop should look for its modules. +## If you run the bot from the compilation directory, you will want to set +## this to "". If you use 'make install' (like all good kiddies do ;), this +## is a fine default. Otherwise, use your head :) +set mod-path "modules/" + +#### CHANNELS MODULE #### + +## Enter here the filename where dynamic channel settings are stored. +set chanfile "fsysbot.chan" + +#### SERVER MODULE #### + +## What is your network? +## If your network is not specifically listed here, please see eggdrop.conf +## for more information on what the best selection is. +## Options are: +## EFnet +## IRCnet +## Undernet +## DALnet +## Libera +## freenode +## QuakeNet +## Rizon +## Twitch (This requires twitch.mod to be loaded as well) +## Other (This is a good, sane option if your network/ircd is not listed here) +set net-type "Libera" + +# This is a Tcl script to be run immediately after connecting to a server. If +# you want to authenticate Eggdrop with NickServ, uncomment and edit the middle +# line below. +bind evnt - init-server evnt:init_server + +proc evnt:init_server {type} { + global botnick + putquick "MODE $botnick +i-ws" +# putserv "PRIVMSG NickServ :IDENTIFY iank cePVe6OmxLXmf42e" +} + +## Set the default port which should be used if none is specified with +## '.jump' or in 'set servers'. +set default-port 6667 + +## This setting allows you to specify the maximum nick-length supported by your +## network. The default setting is 9. The maximum supported length by Eggdrop +## is 32. +#set nick-len 9 + +#### CTCP MODULE #### + +## Set here how the ctcp module should answer ctcps. +## Options are: +## 0 = Normal behavior is used. +## 1 = The bot ignores all ctcps, except for CHAT and PING requests +## by users with the +o flag. +## 2 = Normal behavior is used, however the bot will not answer more +## than X ctcps in Y seconds (defined by 'set flood-ctcp'). +set ctcp-mode 1 + +#### IRC MODULE #### + +## Many takeover attempts occur due to lame users blindly /msg ident'ing to +## the bot and attempting to guess passwords. We now unbind this command by +## default to discourage them. You can enable these commands by commenting the +## following two lines. +unbind msg - ident *msg:ident +unbind msg - addhost *msg:addhost + +#### NOTES MODULE #### + +## Set here the filename where private notes between users are stored. +set notefile "LamestBot.notes" + +##### AUTOSCRIPTS ##### + +# Load this script to enable the autoscripts functionality for Eggdrop. +# Autoscripts are scripts that can be downloaded, installed and configured via +# the partyline. For more information, read doc/AUTOSCRIPTS +#source scripts/autoscripts.tcl + +##### SCRIPTS ##### + +## This is a good place to load scripts to use with your bot. + +## This line loads script.tcl from the scripts directory inside your Eggdrop's +## directory. All scripts should be put there, although you can place them where +## you like as long as you can supply a fully qualified path to them. +## +## source scripts/script.tcl +## The 3 scripts below are default and shouldn't be removed. + +source scripts/alltools.tcl +source scripts/action.fix.tcl +source scripts/dccwhois.tcl + +## This script provides many useful informational functions, like setting +## users' URLs, e-mail address, ICQ numbers, etc. You can modify it to add +## extra entries. +source scripts/userinfo.tcl +loadhelp userinfo.help + +## Use this script for Tcl and Eggdrop backwards compatibility. +## NOTE: This can also cause problems with some newer scripts. +#source scripts/compat.tcl + +## This next line checks if eggdrop is being executed from the source directory, do not remove it +if {[file exists aclocal.m4]} { die {You are attempting to run Eggdrop from the source directory. Please finish installing Eggdrop by running "make install" and run it from the install location.} } + +## A few IRC networks (EFnet and Undernet) have added some simple checks to +## prevent drones from connecting to the IRC network. While these checks are +## fairly trivial, they will prevent your Eggdrop from automatically +## connecting. In an effort to work-around these, we have developed a couple of +## TCL scripts to automate the process. + +if {[info exists net-type]} { + switch -- ${net-type} { + "EFnet" { + # EFnet + source scripts/quotepong.tcl + } + "0" { + # EFnet + source scripts/quotepong.tcl + } + } +} + +source /b/ds/fsfsys-recent.tcl + +# initial setup: +# +# ~/eggdrop/eggdrop -m eggdrop-fsysbot.conf +# # on irc, /msg eggdrop hello +# # on server: +# telnet localhost 2888 +#.dump PRIVMSG nickserv :REGISTER Ujtoobquidliwev fsysbot@iankelling.org +## iank: alternately, read .help msg [17:08] +## probably the more convenient solution +## but it looks like that module is not loaded. +#.dump PRIVMSG nickserv :VERIFY REGISTER fsysbot cePVe6OmxLXmf42e + +# .+chan #fsfsys +# .+chan #test-ignore +# # do testing +# .-chan #test-ignore + +# ./scripts/autobotchk eggdrop-fsysbot.conf -systemd + +# autobotchk 1.11, (C) 1999-2003 Jeff Fisher (guppy@eggheads.org) +# (C) 2004-2022 Eggheads Development Team +# ------------------------------------------------------------ + +# Opening 'eggdrop-fsysbot.conf' for processing ... done +# Scanning the config file ..... done +# Defaulting $botnet-nick to "fsysbot" +# Enabling user lingering... +# Creating systemd directory... +# Created symlink /home/iank/.config/systemd/user/default.target.wants/fsysbot.service → /home/iank/.config/systemd/user/fsysbot.service. +# systemd job successfully installed as 'fsysbot.service'. +# * Use 'systemctl --user fsysbot.service' to control your Eggdrop diff --git a/subdir_files/sieve/lists.sieve b/subdir_files/sieve/lists.sieve index 0b1b315..f6bed70 100644 --- a/subdir_files/sieve/lists.sieve +++ b/subdir_files/sieve/lists.sieve @@ -161,7 +161,6 @@ if anyof ( # header :contains "list-id" "", header :contains "list-id" "", header :contains "list-id" "", - header :contains "list-id" "", header :contains "list-id" "", header :contains "list-id" "", header :contains "list-id" "", diff --git a/subdir_files/sieve/liststest.sieve b/subdir_files/sieve/liststest.sieve index 0b1b315..f6bed70 100644 --- a/subdir_files/sieve/liststest.sieve +++ b/subdir_files/sieve/liststest.sieve @@ -161,7 +161,6 @@ if anyof ( # header :contains "list-id" "", header :contains "list-id" "", header :contains "list-id" "", - header :contains "list-id" "", header :contains "list-id" "", header :contains "list-id" "", header :contains "list-id" "", diff --git a/switch-mail-host b/switch-mail-host index 22e6933..3f299ba 100644 --- a/switch-mail-host +++ b/switch-mail-host @@ -294,7 +294,7 @@ fi # Try to prevent emacs from saving stale data it has in memory to disk. eg: files, recentf list, etc. # But if emacs ignores the signal, let it live. -killall -q emacs ||: +pkill -xf 'emacs( --daemon| -f znc-all)' ||: if [[ -e /p/profanity-here ]]; then systemctl disable --now profanity diff --git a/system-status b/system-status index 3ac05d5..28b3024 100755 --- a/system-status +++ b/system-status @@ -414,20 +414,20 @@ mute() { fi midnight=$(date -d 00:00 +%s) mdiff=$(( EPOCHSECONDS - midnight )) - if $locked && (( mdiff < 6 || mdiff > 21 )); then + if $locked && (( mdiff < 6 *60*60 || mdiff > 21 *60*60 )); then case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in no) # for log purposes - echo unmuted + echo muted pactl set-sink-mute @DEFAULT_SINK@ true ;; esac fi - if ! $locked && (( mdiff > 6 || mdiff < 12 )) && [[ ! -e /tmp/ianknap ]]; then + if ! $locked && (( mdiff > 6 *60*60 || mdiff < 12 *60*60 )) && [[ ! -e /tmp/ianknap ]]; then case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in yes) # for log purposes - echo muted + echo unmuted pactl set-sink-mute @DEFAULT_SINK@ false ;; esac diff --git a/ziva-screen b/ziva-screen index e951311..7ce32c2 100755 --- a/ziva-screen +++ b/ziva-screen @@ -5,17 +5,26 @@ source /usr/local/lib/err [[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" +dest_dir=/d/ziva-log +case $HOSTNAME in + sy) + dest_dir=/t/zlog + ;; +esac + f=/run/user/1000/ziva-tmp.jpg -cd /d/ziva-log +mkdir -p $dest_dir +cd $dest_dir shopt -s nullglob jpgs=( 20*jpg ) if (( ${#jpgs[@]} >= 1 )); then + # shellcheck disable=SC2048 # intentional lastf=$(ls -1 20*jpg | tail -n1) fi ssh bow DISPLAY=:0 scrot -z $f 2>/dev/null || exit 0 -rsync --inplace bow:$f /d/ziva-log 2>/dev/null || exit 0 +rsync --inplace bow:$f $dest_dir 2>/dev/null || exit 0 ssh bow rm -f $f same=false @@ -23,7 +32,7 @@ if [[ $lastf ]]; then # returns 2 on error, but maybe in that case we want to ignore, file the image away # and then it can go away in a subsequent comparison. going with that for now. diff=$(compare -metric MSE $lastf ziva-tmp.jpg /dev/null |& sed 's/[^0-9].*//') ||: - if printf "%s\n" "$diff" | egrep '^[0-9]+$' &>/dev/null && (( diff < 200 )); then + if printf "%s\n" "$diff" | grep -E '^[0-9]+$' &>/dev/null && (( diff < 200 )); then same=true fi fi @@ -31,5 +40,5 @@ fi if $same; then rm -f ziva-tmp.jpg else - mv ziva-tmp.jpg $(date +%F.%R).jpg + mv ziva-tmp.jpg "$(date +%F.%R)".jpg fi