general cleanup

This commit is contained in:
Felix Van der Jeugt 2024-07-24 08:35:41 +02:00
parent ffced8fca4
commit 3ffb35cc2e
No known key found for this signature in database
GPG key ID: 58B209295023754D
25 changed files with 149 additions and 120 deletions

View file

@ -1,6 +0,0 @@
#!/bin/sh
st -e socat tcp-listen:6667,reuseaddr,fork udp:localhost:20595 &
st -e ssh -R 6667:localhost:6667 Hetzner "grep -q '^AllowTcpForwarding yes$' /etc/ssh/sshd_config && grep -q '^GatewayPorts yes$' /etc/ssh/sshd_config && socat udp-listen:20595,reuseaddr,fork tcp:localhost:6667" &
wait

View file

@ -1,7 +0,0 @@
#!/bin/sh
[ "$#" -eq 0 ] && exit
torsocks curl -O "$@"
image="$(basename "$@")"
rifle -fF "$image"
mv "$image" /data/pictures/anselmages/
ln -s ../anselmages/"$image" /data/pictures/background-source/"$image"

View file

@ -25,20 +25,24 @@ mantle)
--exclude '/etc/sudoers.dist' \
--exclude '/etc/kernel.d/post-install/50-grub' \
--exclude '/etc/kernel.d/post-remove/50-grub' \
--exclude '/etc/mumble/mumble-server.ini' \
--exclude '/etc/.pwd.lock' \
--exclude '/etc/gshadow-' \
--exclude '/etc/passwd-' \
--exclude '/etc/shadow-' \
--exclude '/etc/shadow' \
--exclude '/etc/ssh/ssh_*_key' \
--exclude '/etc/tcsd.conf' \
--exclude '/etc/gshadow' \
--exclude '/var/tmp/*' \
--exclude '/var/db/*' \
--exclude '/var/cache' \
--exclude '/var/lib/alsa' \
--exclude '/var/lib/dkms/mok.key' \
--exclude '/var/lib/tor' \
--exclude '/var/lib/random-seed' \
--exclude '/var/lib/seedrng' \
--exclude '/var/lib/tpm' \
--exclude '/var/log/tallylog' \
--exclude '/var/log/btmp' \
--exclude '/var/log/dmesg.log' \
@ -151,7 +155,7 @@ info "Pruning repository"
borg prune \
--list \
--prefix '{hostname}-' \
--glob-archives '{hostname}-*' \
--show-rc \
--keep-daily 7 \
--keep-weekly 4 \

View file

@ -1,6 +0,0 @@
#!/usr/bin/python3
import sys
from clirail.clirail_main import main
main(*sys.argv[1:])

1
local/bin/clirail Symbolic link
View file

@ -0,0 +1 @@
/home/ninewise/.local/pipx/venvs/clirail/bin/clirail

View file

@ -1,2 +0,0 @@
#!/bin/sh
exec qutebrowser --basedir "$HOME/.config/facebrowser" --config-py "$HOME/.config/qutebrowser/config.py" 'https://www.facebookwkhpilnemxj7asaniu7vnjjbiltxjqhye3mhbshg7kx5tfyd.onion/messages'

View file

@ -1,2 +0,0 @@
#!/bin/sh
exec qutebrowser --basedir "$HOME/.config/googlebrowser"

View file

@ -11,7 +11,8 @@ to the current date. Finally, it opens the end of the file in $EDITOR.
Bonus over 'hledger add': interactive matching it easier, and
transaction formatting is retained because it's just a copy.
add_file The transaction is appended to this file.
add_file The transaction is appended to this file. Using -
will output the transaction to stdout instead.
Default (if set): \$LEDGER_ADD_FILE
Default (otherwise): \$LEDGER_FILE
@ -37,18 +38,24 @@ done
shift $((OPTIND - 1))
# fuzzy select a transaction title
selection="$(sed -n 's/....-..-..\( [*!]\)\? //p' "${@:-$LEDGER_FILE}" | sort | uniq | sk)"
selection="$(sed -n 's/....-..-..\( [*!]\)\? //p' "${@:-$LEDGER_FILE}" | sort | uniq | sk | sed 's_/_\\/_g')"
[ -z "$selection" ] && exit 0 # quit if escaped
sed -n "/....-..-..\( [*!]\)\? ${selection}\$/,/^\$/p" "${@:-$LEDGER_FILE}" | # print matching transactions
sed '${/^$/d}' | # remove trailing empty line
sed -n '/^$/{s/.*//;x;d};H;${x;p}' | # remove all before the last empty line
sed "s/^....-..-..\( [*!]\)\?/$(date +'%Y-%m-%d')/" | # replace date with today, remove marker
sponge -a "$add_file" # append to the file, use sponge in case it's also an input file
if [ "$add_file" = '-' ]; then
cat
else
sponge -a "$add_file" # append to the file, use sponge in case it's also an input file
fi
# review change: open end of the file (if I know how)
case "$EDITOR" in
vi*|nvi*) "$EDITOR" +\$ "$add_file" ;;
emacs) "$EDITOR" "$add_file" -f end-of-buffer ;;
*) "$EDITOR" "$add_file" ;;
esac
if [ "$add_file" != '-' ]; then
case "$EDITOR" in
vi*|nvi*) "$EDITOR" +\$ "$add_file" ;;
emacs) "$EDITOR" "$add_file" -f end-of-buffer ;;
*) "$EDITOR" "$add_file" ;;
esac
fi

View file

@ -1,5 +0,0 @@
#!/bin/sh
notmuch address --output=recipients --output=sender --deduplicate=address from:'*'"$*"'*' OR to:'*'"$*"'*' \
| grep -i "$*" \
| grep -v noreply \
| sort | uniq

View file

@ -1,13 +0,0 @@
#!/bin/sh
set -e
for mid in $(notmuch search --output=messages tag:inbox "$@"); do
printf "%s ? " "$(notmuch show "$mid" | sed -n 's/Subject: //p')"
read ans
case "$ans" in
y*)
notmuch show --format=raw "$mid" | bogofilter -Sn
notmuch tag -inbox -unread +spam -- "$mid"
;;
esac
done

54
local/bin/vcard-simplify.py Executable file
View file

@ -0,0 +1,54 @@
#!/usr/bin/env python
import sys
def copy(line):
print(line, end="")
def output(key, value):
print(key, value, sep=":", end="\r\n")
for line in sys.stdin:
key, *value = line.strip().split(":")
value = ":".join(value)
if key == "BEGIN" and value == "VCARD":
copy(line)
elif key == "VERSION":
output("VERSION", "2.1")
elif key == "N":
copy(line)
elif key == "FN":
copy(line)
elif key == "ORG":
pass
elif (key == "EMAIL;TYPE=INTERNET;TYPE=WORK" or
key == "EMAIL;TYPE=INTERNET;TYPE=HOME" or
key == "EMAIL;TYPE=INTERNET;TYPE=OTHER"):
output("EMAIL;X-internet", value)
elif (key == "TEL;TYPE=VOICE" or
key == "TEL;TYPE=CELL" or
key == "TEL;TYPE=WORK" or
key == "TEL;TYPE=HOME" or
key == "TEL;TYPE=OTHER"):
if value.startswith("tel:"):
value = value[4:]
output("TEL;VOICE", value.replace(" ", ""))
elif key == "TEL;TYPE=PAGER":
pass
elif (key == "ADR;TYPE=HOME" or key == "ADR;TYPE=OTHER"):
output("ADR;HOME", value)
elif key == "CATEGORIES":
pass
elif key == "NICKNAME":
pass
elif key.startswith("URL"):
pass
elif key == "BDAY;VALUE=date":
pass
elif key.startswith("NOTE"):
pass
elif key.startswith("TITLE"):
pass
elif key == "END" and value == "VCARD":
copy(line)
else:
raise NotImplementedError(line)