From 8cb57df218d245f589ed358bc12be4043ff3222d Mon Sep 17 00:00:00 2001 From: tavo-wasd Date: Tue, 16 Apr 2024 19:42:48 -0600 Subject: [PATCH] frequently miss this --- scripts/fetch | 91 +++++++------ snippets/blog.txt | 26 ++++ snippets/emailwiz_add_domains.md | 162 +++++++++++++++++++++++ snippets/gen.qr | 8 ++ snippets/groff_bottomnum.ms | 3 + snippets/groff_color.ms | 2 + snippets/groff_eqn.ms | 5 + snippets/groff_font.ms | 2 + snippets/groff_grap.ms | 31 +++++ snippets/groff_rmheadfoot.ms | 9 ++ snippets/groff_tbl.ms | 25 ++++ snippets/groff_var.ms | 4 + snippets/shell_array.sh | 1 + snippets/shell_counter.sh | 3 + snippets/urlutf8 | 217 +++++++++++++++++++++++++++++++ snippets/welcome.txt | 5 + 16 files changed, 551 insertions(+), 43 deletions(-) create mode 100644 snippets/blog.txt create mode 100644 snippets/emailwiz_add_domains.md create mode 100644 snippets/gen.qr create mode 100644 snippets/groff_bottomnum.ms create mode 100644 snippets/groff_color.ms create mode 100644 snippets/groff_eqn.ms create mode 100644 snippets/groff_font.ms create mode 100644 snippets/groff_grap.ms create mode 100644 snippets/groff_rmheadfoot.ms create mode 100644 snippets/groff_tbl.ms create mode 100644 snippets/groff_var.ms create mode 100644 snippets/shell_array.sh create mode 100644 snippets/shell_counter.sh create mode 100644 snippets/urlutf8 create mode 100644 snippets/welcome.txt diff --git a/scripts/fetch b/scripts/fetch index 4b48dea..a9a13b8 100755 --- a/scripts/fetch +++ b/scripts/fetch @@ -4,7 +4,6 @@ # a fetch in pure POSIX shell # -[ "$1" = "" ] && mode="" [ "$1" = "min" ] && mode="min" # supress errors @@ -71,13 +70,13 @@ if [ -e /proc/$$/comm ]; then ## Memory # loop over lines in /proc/meminfo until it reaches MemTotal, # then convert the amount (second word) from KB to MB - while read -r line; do + while read -r line; [ "$mode" != "min" ]; do eq "$line" 'MemTotal*' && set -- $line && break done < /proc/meminfo - mem="$(( $2 / 1000 ))MB" + [ "$mode" != "min" ] && mem="$(( $2 / 1000 ))MB" ## Processor - while read -r line; do + while read -r line; [ "$mode" != "min" ] ; do case $line in vendor_id*) vendor="${line##*: } ";; model\ name*) cpu=${line##*: }; break;; @@ -98,9 +97,9 @@ if [ -e /proc/$$/comm ]; then eq "$version" '*Microsoft*' && ID="fake $ID" ## Motherboard // laptop - read -r model < /sys/devices/virtual/dmi/id/product_name + [ "$mode" != "min" ] && read -r model < /sys/devices/virtual/dmi/id/product_name # invalid model handling - case $model in + [ "$mode" != "min" ] && case $model in # alternate file with slightly different info # on my laptop it has the device model (instead of 'hp notebook') # on my desktop it has the extended motherboard model @@ -227,13 +226,11 @@ elif v=/System/Library/CoreServices/SystemVersion.plist; [ -f "$v" ]; then done < "$v" fi -eq "$0" '*fetish' && printf 'Step on me daddy\n' && exit - # help i dont know if it's a capital consistently eq "$wm" '*[Gg][Nn][Oo][Mm][Ee]*' && wm='foot DE' ## GTK -while read -r line; do +while read -r line; [ "$mode" != "min" ]; do eq "$line" 'gtk-theme*' && gtk=${line##*=} && break done < "${XDG_CONFIG_HOME:=$HOME/.config}/gtk-3.0/settings.ini" @@ -250,47 +247,55 @@ cpu=${cpu%% with*} cpu=${cpu% *-Core*} col() { - printf ' ' - for i in 1 2 3 4 5 6; do - printf '\033[9%sm%s' "$i" "${colourblocks:- ●}" - done - printf '\033[0m\n' +char="●" +printf ' \033[91m%s \033[92m%s \033[93m%s \033[94m%s \033[95m%s \033[96m%s +\033[0m' "$char" "$char" "$char" "$char" "$char" "$char" } - -print() { - [ "$2" ] && printf '\033[1m %b\033[0m %b%s\n' \ - "$1" "$2" -} - - full() { - echo - print DIST "$ID" - print KERN "$kernel" - print PKGS "$pkgs" - print TERM "$term" - print SHLL "${SHELL##*/}" - print WDMG "${wm##*/}" - print THME "${gtk# }" - print HOST "$model" - print PCSR "$vendor$cpu" - print MMRY "$mem" - print UPTM "$up" +printf ' + \033[1mDIST\033[0m %s + \033[1mKERN\033[0m %s + \033[1mPKGS\033[0m %s + \033[1mTERM\033[0m %s + \033[1mSHLL\033[0m %s + \033[1mWDMG\033[0m %s + \033[1mTHME\033[0m %s + \033[1mHOST\033[0m %s + \033[1mPCSR\033[0m %s + \033[1mMMRY\033[0m %s + \033[1mUPTM\033[0m %s +' "$ID" \ + "$kernel" \ + "$pkgs" \ + "$term" \ + "${SHELL##*/}" \ + "${wm##*/}" \ + "${gtk# }" \ + "$model" \ + "$vendor$cpu" \ + "$mem" \ + "$up" col } min() { - echo - print DIST "$ID" - print KERN "$kernel" - print PKGS "$pkgs" - print TERM "$term" - print SHLL "${SHELL##*/}" - print WDMG "${wm##*/}" - print UPTM "$up" +printf ' + \033[1mDIST\033[0m %s + \033[1mKERN\033[0m %s + \033[1mPKGS\033[0m %s + \033[1mTERM\033[0m %s + \033[1mSHLL\033[0m %s + \033[1mWDMG\033[0m %s + \033[1mUPTM\033[0m %s +' "$ID" \ + "$kernel" \ + "$pkgs" \ + "$term" \ + "${SHELL##*/}" \ + "${wm##*/}" \ + "$up" col } -[ "$mode" = "" ] && full -[ "$mode" = "min" ] && min +[ "$mode" = "min" ] && min || full diff --git a/snippets/blog.txt b/snippets/blog.txt new file mode 100644 index 0000000..7d3dd8a --- /dev/null +++ b/snippets/blog.txt @@ -0,0 +1,26 @@ +⠀⠀⢀⣠⠤⠶⠖⠒⠒⠶⠦⠤⣄⠀⠀⠀⣀⡤⠤⠤⠤⠤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⣴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⣦⠞⠁⠀⠀⠀⠀⠀⠀⠉⠳⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⡾⠁⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣀⣀⣘⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⢀⡴⠚⠉⠁⠀⠀⠀⠀⠈⠉⠙⠲⣄⣤⠤⠶⠒⠒⠲⠦⢤⣜⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ███████████ ██ +⠀⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⡄⠀⠀⠀⠀⠀⠀⠀⠉⠳⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ░█░░░███░░░█ ███ +⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⠹⣆⠀⠀⠀⠀⠀⠀⣀⣀⣀⣹⣄⠀⠀⠀⠀⠀⠀⠀⠀ ░ ░███ ░ ██████ █████ █████ ██████ ░░░ █████ +⠀⠀⠀⠀⣠⠞⣉⣡⠤⠴⠿⠗⠳⠶⣬⣙⠓⢦⡈⠙⢿⡀⠀⠀⢀⣼⣿⣿⣿⣿⣿⡿⣷⣤⡀⠀⠀⠀⠀⠀ ░███ ░░░░░███ ░░███ ░░███ ███░░███ ███░░ +⠀⠀⠀⣾⣡⠞⣁⣀⣀⣀⣠⣤⣤⣤⣄⣭⣷⣦⣽⣦⡀⢻⡄⠰⢟⣥⣾⣿⣏⣉⡙⠓⢦⣻⠃⠀⠀⠀⠀⠀ ░███ ███████ ░███ ░███ ░███ ░███ ░░█████ +⠀⠀⠀⠉⠉⠙⠻⢤⣄⣼⣿⣽⣿⠟⠻⣿⠄⠀⠀⢻⡝⢿⡇⣠⣿⣿⣻⣿⠿⣿⡉⠓⠮⣿⠀⠀⠀⠀⠀⠀ ░███ ███░░███ ░░███ ███ ░███ ░███ ░░░░███ +⠀⠀⠀⠀⠀⠀⠙⢦⡈⠛⠿⣾⣿⣶⣾⡿⠀⠀⠀⢀⣳⣘⢻⣇⣿⣿⣽⣿⣶⣾⠃⣀⡴⣿⠀⠀⠀⠀⠀⠀ █████ ░░████████ ░░█████ ░░██████ ██████ +⠀⠀⠀⠀⠀⠀⠀⠀⠙⠲⠤⢄⣈⣉⣙⣓⣒⣒⣚⣉⣥⠟⠀⢯⣉⡉⠉⠉⠛⢉⣉⣡⡾⠁⠀⠀⠀⠀⠀⠀ ░░░░░ ░░░░░░░░ ░░░░░ ░░░░░░ ░░░░░░ +⠀⠀⣠⣤⡤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢈⡿⠋⠀⠀⠀⠀⠈⠻⣍⠉⠀⠺⠿⠋⠙⣦⠀⠀⠀⠀⠀⠀ ███████████ ████ +⠀⣀⣥⣤⠴⠆⠀⠀⠀⠀⠀⠀⠀⣀⣠⠤⠖⠋⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⠀⠀⠀⠀⠀⢸⣧⠀⠀⠀⠀⠀ ░░███░░░░░███░░███ +⠸⢫⡟⠙⣛⠲⠤⣄⣀⣀⠀⠈⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠏⣨⠇⠀⠀⠀⠀ ░███ ░███ ░███ ██████ ███████ +⠀⠀⠻⢦⣈⠓⠶⠤⣄⣉⠉⠉⠛⠒⠲⠦⠤⠤⣤⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣠⠴⢋⡴⠋⠀⠀⠀⠀⠀ ░██████████ ░███ ███░░███ ███░░███ +⠀⠀⠀⠀⠉⠓⠦⣄⡀⠈⠙⠓⠒⠶⠶⠶⠶⠤⣤⣀⣀⣀⣀⣀⣉⣉⣉⣉⣉⣀⣠⠴⠋⣿⠀⠀⠀⠀⠀⠀ ░███░░░░░███ ░███ ░███ ░███░███ ░███ +⠀⠀⠀⠀⠀⠀⠀⠀⠉⠓⠦⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡼⠁⠀⠀⠀⠀⠀⠀ ░███ ░███ ░███ ░███ ░███░███ ░███ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠙⠛⠒⠒⠒⠒⠒⠤⠤⠤⠒⠒⠒⠒⠒⠒⠚⢉⡇⠀⠀⠀⠀⠀⠀⠀ ███████████ █████░░██████ ░░███████ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠴⠚⠛⠳⣤⠞⠁⠀⠀⠀⠀⠀⠀⠀ ░░░░░░░░░░░ ░░░░░ ░░░░░░ ░░░░░███ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⠚⠁⠀⠀⠀⠀⠘⠲⣄⡀⠀⠀⠀⠀⠀⠀ ███ ░███ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⠋⠙⢷⡋⢙⡇⢀⡴⢒⡿⢶⣄⡴⠀⠙⠳⣄⠀⠀⠀⠀ ░░██████ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠈⠛⢻⠛⢉⡴⣋⡴⠟⠁⠀⠀⠀⠀⠈⢧⡀⠀⠀ ░░░░░░ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡄⠀⠘⣶⢋⡞⠁⠀⠀⢀⡴⠂⠀⠀⠀⠀⠹⣄⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠈⠻⢦⡀⠀⣰⠏⠀⠀⢀⡴⠃⢀⡄⠙⣆⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡾⢷⡄⠀⠀⠀⠀⠉⠙⠯⠀⠀⡴⠋⠀⢠⠟⠀⠀⢹⡄ + diff --git a/snippets/emailwiz_add_domains.md b/snippets/emailwiz_add_domains.md new file mode 100644 index 0000000..19baffc --- /dev/null +++ b/snippets/emailwiz_add_domains.md @@ -0,0 +1,162 @@ +# Steps: +Note: +- "$maildomain" = mail.example.org +- "$domain" = example.org +- "$subdom" = mail + +# Run `emailwiz.sh` + +Set it up normally for your first domain, check that it works fine. +Then continue with the next step + +# Generate new certificate + +Not totally necessary for mail to "just work" but it will help, in this case I specified --standalone but do use --nginx or --apache instead, if your email service depends on one of those, if not sure, leave it as standalone. +This is the line from the script: + +```sh +certbot -d "$maildomain" certonly --standalone --register-unsafely-without-email --agree-tos +``` + +Note: Redirect at least your mail subdomain from your OTHER domain(s). Later on you'll have to also add other records for emails to work! See DNS Records step. + +# Dovecot +Dovecot is easier, you should be good by just adding these lines to `/etc/dovecot/dovecot.conf` +Note: Remember to actually generate the keys with certbot, like in the "Generate new certificate" step below. +Note: Uses TLS SNI, according to [Dovecot's docs](https://doc.dovecot.org/configuration_manual/dovecot_ssl_configuration/), it is tested in clients: +- Thunderbird (Linux) +- K-9 on Android (merged Sept 2015 - https://github.com/k9mail/k-9/pull/718) +- Apple Mail (according to https://forums.cpanel.net/threads/mail-ssl-sni.454592/ ) +- Mutt (ticket https://dev.mutt.org/trac/ticket/3923) +- NeoMutt (since 2016-03-07 according to https://www.neomutt.org/feature/tls-sni ) + +``` +# mail.domain.org +local_name mail.domain.org { + ssl_cert = diff --git a/snippets/groff_grap.ms b/snippets/groff_grap.ms new file mode 100644 index 0000000..76f81ee --- /dev/null +++ b/snippets/groff_grap.ms @@ -0,0 +1,31 @@ +.\" Graph +.\" copy "file.tsv" will source data entries +.G1 + +label left "Frequency (Hz)" +label bottom "Time (s)" + +coord x 0,6 y 0,25 + +frame wid 5 +frame top invis +frame right invis + +grid left from 0 to 25 by 5 + +draw solid +0 5.6 +1 10.2 +2 11.4 +3 17.2 +4 22.9 +5 22.2 +6 23.8 + +bullet size 20 at 1,9.8 + +"(1 , 10.2)" size 12 above at 1,11 + +line dashed from 4,0 to 4,22.9 + +.G2 diff --git a/snippets/groff_rmheadfoot.ms b/snippets/groff_rmheadfoot.ms new file mode 100644 index 0000000..7ffea8c --- /dev/null +++ b/snippets/groff_rmheadfoot.ms @@ -0,0 +1,9 @@ +.\" Remove page headers and footers +.\" or customize them this way: +.\" .ds LH Text in left header +.ds LH +.ds CH +.ds RH +.ds LF +.ds CF +.ds RF diff --git a/snippets/groff_tbl.ms b/snippets/groff_tbl.ms new file mode 100644 index 0000000..d3d5cd6 --- /dev/null +++ b/snippets/groff_tbl.ms @@ -0,0 +1,25 @@ +.\" Table +.\" Requires .so utils for auto-numbering +.ad c +.B "Table \\n+[tblnum]:" +Title +.TS +box center tab(|) nospaces decimalpoint(.) ; +cb s ci s +_ _ _ _ +c n l n +c n l n +c c c c +c ^ c c +c c c +. + One | Two + Numbers | 3.14159 | Left-align | 10000.2 + Numbers | 3.14 | Left-align | 100.2 + This | is | \\f[I]centered\\f[P] | text + This | | centered | too +_ + U | | T{ +This entry will be wrapped to fit +T}|V +.TE diff --git a/snippets/groff_var.ms b/snippets/groff_var.ms new file mode 100644 index 0000000..0b2ea82 --- /dev/null +++ b/snippets/groff_var.ms @@ -0,0 +1,4 @@ +.\" Save and print variable +.ds VAR foobar +.LP +\*[VAR] diff --git a/snippets/shell_array.sh b/snippets/shell_array.sh new file mode 100644 index 0000000..58d1af4 --- /dev/null +++ b/snippets/shell_array.sh @@ -0,0 +1 @@ +: "${info:=item1 item2 item3}" diff --git a/snippets/shell_counter.sh b/snippets/shell_counter.sh new file mode 100644 index 0000000..7269588 --- /dev/null +++ b/snippets/shell_counter.sh @@ -0,0 +1,3 @@ +i=0 # Start in 0 +i=$((i+1)) # 0+1 = 1 +echo $i diff --git a/snippets/urlutf8 b/snippets/urlutf8 new file mode 100644 index 0000000..fd3e66c --- /dev/null +++ b/snippets/urlutf8 @@ -0,0 +1,217 @@ +space %20 +! %21 +" %22 +# %23 +$ %24 +% %25 +& %26 +' %27 +( %28 +) %29 +* %2A ++ %2B +, %2C +- %2D +. %2E +/ %2F +0 %30 +1 %31 +2 %32 +3 %33 +4 %34 +5 %35 +6 %36 +7 %37 +8 %38 +9 %39 +: %3A +; %3B +< %3C += %3D +> %3E +? %3F +@ %40 +A %41 +B %42 +C %43 +D %44 +E %45 +F %46 +G %47 +H %48 +I %49 +J %4A +K %4B +L %4C +M %4D +N %4E +O %4F +P %50 +Q %51 +R %52 +S %53 +T %54 +U %55 +V %56 +W %57 +X %58 +Y %59 +Z %5A +[ %5B +\ %5C +] %5D +^ %5E +_ %5F +` %60 +a %61 +b %62 +c %63 +d %64 +e %65 +f %66 +g %67 +h %68 +i %69 +j %6A +k %6B +l %6C +m %6D +n %6E +o %6F +p %70 +q %71 +r %72 +s %73 +t %74 +u %75 +v %76 +w %77 +x %78 +y %79 +z %7A +{ %7B +| %7C +} %7D +~ %7E +€ %E2%82%AC +‚ %E2%80%9A +ƒ %C6%92 +„ %E2%80%9E +… %E2%80%A6 +† %E2%80%A0 +‡ %E2%80%A1 +ˆ %CB%86 +‰ %E2%80%B0 +Š %C5%A0 +‹ %E2%80%B9 +Œ %C5%92 +Ž %C5%BD +‘ %E2%80%98 +’ %E2%80%99 +“ %E2%80%9C +” %E2%80%9D +• %E2%80%A2 +– %E2%80%93 +— %E2%80%94 +˜ %CB%9C +™ %E2%84 +š %C5%A1 +› %E2%80 +œ %C5%93 +ž %C5%BE +Ÿ %C5%B8 +¡ %C2%A1 +¢ %C2%A2 +£ %C2%A3 +¤ %C2%A4 +¥ %C2%A5 +¦ %C2%A6 +§ %C2%A7 +¨ %C2%A8 +© %C2%A9 +ª %C2%AA +« %C2%AB +¬ %C2%AC +­ %C2%AD +® %C2%AE +¯ %C2%AF +° %C2%B0 +± %C2%B1 +² %C2%B2 +³ %C2%B3 +´ %C2%B4 +µ %C2%B5 +¶ %C2%B6 +· %C2%B7 +¸ %C2%B8 +¹ %C2%B9 +º %C2%BA +» %C2%BB +¼ %C2%BC +½ %C2%BD +¾ %C2%BE +¿ %C2%BF +À %C3%80 +Á %C3%81 + %C3%82 +à %C3%83 +Ä %C3%84 +Å %C3%85 +Æ %C3%86 +Ç %C3%87 +È %C3%88 +É %C3%89 +Ê %C3%8A +Ë %C3%8B +Ì %C3%8C +Í %C3%8D +Î %C3%8E +Ï %C3%8F +Ð %C3%90 +Ñ %C3%91 +Ò %C3%92 +Ó %C3%93 +Ô %C3%94 +Õ %C3%95 +Ö %C3%96 +× %C3%97 +Ø %C3%98 +Ù %C3%99 +Ú %C3%9A +Û %C3%9B +Ü %C3%9C +Ý %C3%9D +Þ %C3%9E +ß %C3%9F +à %C3%A0 +á %C3%A1 +â %C3%A2 +ã %C3%A3 +ä %C3%A4 +å %C3%A5 +æ %C3%A6 +ç %C3%A7 +è %C3%A8 +é %C3%A9 +ê %C3%AA +ë %C3%AB +ì %C3%AC +í %C3%AD +î %C3%AE +ï %C3%AF +ð %C3%B0 +ñ %C3%B1 +ò %C3%B2 +ó %C3%B3 +ô %C3%B4 +õ %C3%B5 +ö %C3%B6 +÷ %C3%B7 +ø %C3%B8 +ù %C3%B9 +ú %C3%BA +û %C3%BB +ü %C3%BC +ý %C3%BD +þ %C3%BE +ÿ %C3%BF diff --git a/snippets/welcome.txt b/snippets/welcome.txt new file mode 100644 index 0000000..f34251d --- /dev/null +++ b/snippets/welcome.txt @@ -0,0 +1,5 @@ +__ __ _ _ +\ \ / /__| | ___ ___ _ __ ___ ___| | + \ \ /\ / / _ \ |/ __/ _ \| '_ ` _ \ / _ \ | + \ V V / __/ | (_| (_) | | | | | | __/_| + \_/\_/ \___|_|\___\___/|_| |_| |_|\___(_)