From a5f7167f89c721ea5dee4cb1a825bbcc4a78708c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 22 Apr 2022 11:56:25 -0300 Subject: .gitignore: Add file to ignore everything, so files are added explicitly --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +* -- cgit v1.2.3 From 14533737b200d06280c08c7c3990ad51b00a3f5b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 22 Apr 2022 12:06:22 -0300 Subject: .config/guix/channels.scm: Add file, with "xyx-euandreh" and "nonguix" channel --- .config/guix/channels.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .config/guix/channels.scm diff --git a/.config/guix/channels.scm b/.config/guix/channels.scm new file mode 100644 index 0000000..304db35 --- /dev/null +++ b/.config/guix/channels.scm @@ -0,0 +1,20 @@ +(append + (list + (channel + (name 'xyz-euandreh) + (url "git://euandreh.xyz/package-repository.git/") + (branch "main") + (introduction + (make-channel-introduction + "d749e053e6db365069cb9b2ef47a78b06f9e7361" + (openpgp-fingerprint + "5BDA E9B8 B2F6 C6BC BB0D 6CE5 81F9 0EC3 CD35 6060")))) + (channel + (name 'nonguix) + (url "https://gitlab.com/nonguix/nonguix") + (introduction + (make-channel-introduction + "897c1a470da759236cc11798f4e0a5f7d4d59fbc" + (openpgp-fingerprint + "2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))) + %default-channels) -- cgit v1.2.3 From 24a8b316707caf0a310a94a8fdbc09a080c96b32 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 22 Apr 2022 12:06:37 -0300 Subject: .config/guix/system.scm: Add working system declaration --- .config/guix/system.scm | 102 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .config/guix/system.scm diff --git a/.config/guix/system.scm b/.config/guix/system.scm new file mode 100644 index 0000000..10e36d9 --- /dev/null +++ b/.config/guix/system.scm @@ -0,0 +1,102 @@ +(use-modules + (curth0) + (gnu bootloader) + (gnu bootloader grub) + (gnu packages) + (gnu services base) + (gnu services desktop) + (gnu services security-token) + (gnu services xorg) + (gnu system keyboard) + (gnu system file-systems) + (gnu system mapped-devices) + (guix gexp) + (nongnu packages linux) + (nongnu system linux-initrd)) + +(operating-system + (kernel linux) + (initrd microcode-initrd) + (firmware (list linux-firmware)) + (locale "en_GB.UTF-8") + (timezone "America/Sao_Paulo") + (keyboard-layout + (keyboard-layout "br" #:options '("caps:swapescape" "esperanto:qwerty"))) + (host-name "velhinho") + (users + (append + (let ((user-groups '("wheel" "netdev" "audio" "video"))) + (list + (user-account + (name "andreh") + (comment "EuAndreh") + (group "users") + (supplementary-groups user-groups)) + (user-account + (name "other") + (comment "Other Self") + (group "users") + (supplementary-groups user-groups)))) + %base-user-accounts)) + (packages + (append + (map (compose list specification->package+output symbol->string) + '(nss-certs + i3-wm)) + %base-packages)) + (services + (append + (list + (service bluetooth-service-type) + (service pcscd-service-type) + (service gnome-desktop-service-type) + (set-xorg-configuration + (xorg-configuration + (keyboard-layout keyboard-layout) + (extra-config (list #"- + Section "InputClass" + Identifier "touchpad" + Driver "libinput" + MatchIsTouchpad "on" + Option "Tapping" "on" + EndSection + "#))))) + (modify-services %desktop-services + (guix-service-type config => + (guix-configuration + (inherit config) + (substitute-urls + (append '("https://substitutes.nonguix.org") + %default-substitute-urls)) + (authorized-keys + (append (list (plain-file "non-guix.pub" #"- + (public-key + (ecc + (curve Ed25519) + (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#))) + "#)) + %default-authorized-guix-keys))))))) + (bootloader + (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets (list "/boot/efi")) + (keyboard-layout keyboard-layout))) + (mapped-devices + (list + (mapped-device + (source (uuid "6b0d38a6-d93e-4f8e-a59a-7729f5adf892")) + (target "cryptroot") + (type luks-device-mapping)))) + (file-systems + (append + (list + (file-system + (mount-point "/boot/efi") + (device (uuid "1B26-9F4E" 'fat32)) + (type "vfat")) + (file-system + (mount-point "/") + (device "/dev/mapper/cryptroot") + (type "ext4") + (dependencies mapped-devices))) + %base-file-systems))) -- cgit v1.2.3 From c87672cf2588f08104effd235d06a2e0a2079492 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 22 Apr 2022 12:07:09 -0300 Subject: .config/guix/home.scm: Add working home declaration --- .config/guix/home.scm | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 .config/guix/home.scm diff --git a/.config/guix/home.scm b/.config/guix/home.scm new file mode 100644 index 0000000..a673968 --- /dev/null +++ b/.config/guix/home.scm @@ -0,0 +1,136 @@ +(use-modules + (curth0) + (gnu home services) + (gnu home services shells) + (gnu packages) + (gnu packages mail) + (gnu packages gnupg) + (gnu services) + (guix gexp) + (guix packages) + (guix utils)) + +(define msmtp-non-hardcoded + (package + (inherit msmtp) + (name "msmtp-non-hardcoded") + (arguments + (substitute-keyword-arguments (package-arguments msmtp) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'install-additional-files 'patch-hardcoded-paths + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out"))) + (substitute* (string-append out "/bin/msmtpq") + (("^LOG=.*$") "LOG=${XDG_LOG_HOME:-$HOME/.local/var/log}/msmtpq.log\n") + (("^Q=.*$") "Q=${XDG_DATA_HOME:-$HOME/.local/share}/msmtp/queue\n") + (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) + +(define (xdg-config-home s) + (string-append (getenv "XDG_CONFIG_HOME") "/" s)) + +(define gitconfig (mixed-text-file "gitconfig" #"- + [user] + email = eu@euandre.org + name = EuAndreh + signingkey = 81F90EC3CD356060 + [transfer] + fsckobjects = true + [push] + default = current + [commit] + gpgsign = true + verbose = true + [init] + defaultBranch = main + [sendemail] + assume8bitEncoding = UTF-8 + smtpserveroption = -a + smtpserveroption = euandreh + annotate = yes + confirm = never + smtpserver = "# msmtp-non-hardcoded "/bin/msmtpq\n")) + +(define gpg-agent.conf (mixed-text-file "gpg-agent.conf" #"- + default-cache-ttl 172800 + default-cache-ttl-ssh 172800 + max-cache-ttl 604800 + max-cache-ttl-ssh 604800 + enable-ssh-support + pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) + +(define config-files + `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) + ("git/config" ,gitconfig))) + +(define (dot-config) + (define (prefix-with-config s) + (string-append (substring (getenv "XDG_CONFIG_HOME") + (+ 1 (string-length (getenv "HOME")))) + "/" + s)) + (map (lambda (t) + (list (prefix-with-config (first t)) + (second t))) + config-files)) + +(home-environment + (packages + (append + (map (compose list specification->package+output symbol->string) + '(man-pages + posix-man-pages + + tree + openssh + mailutils + entr + git + git:send-email + tmux + rsync + gnupg + pulseaudio + password-store + playerctl + pinentry-gtk2 + make + fzf + ranger + blueman + ledger + curl + xclip + cloc + strace + file + urlscan + rlwrap + direnv + borg + khal + khard + + shellcheck + clojure + openjdk + + st + i3status + dmenu + + weechat + alot + notmuch + isync + w3m + afew + + firefox)) + (list msmtp-non-hardcoded))) + (services + (list (service home-bash-service-type + (home-bash-configuration + (bashrc + (list (local-file (xdg-config-home "bash/bashrc.sh") "bashrc.sh"))))) + (simple-service 'config-files home-files-service-type (dot-config))))) -- cgit v1.2.3 From eb847a024b813eafe34835974f2e896a21fca04b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 22 Apr 2022 12:10:42 -0300 Subject: .config/: Add configuration files, migrated from "dotfiles" repository --- .config/afew/config | 6 ++ .config/bash/inputrc | 2 + .config/gnupg/gpg.conf | 1 + .config/gnupg/sshcontrol | 1 + .config/hg/hgrc | 2 + .config/i3/config | 157 +++++++++++++++++++++++++++++++++++++++++++++ .config/info/infokey | 7 ++ .config/mailcaps/config | 1 + .config/python/pythonrc.py | 15 +++++ .config/ranger/rc.conf | 1 + .config/sbcl/sbclrc.lisp | 6 ++ .config/ssh/config | 1 + .config/ssh/known_hosts | 74 +++++++++++++++++++++ .config/tmux/tmux.conf | 79 +++++++++++++++++++++++ 14 files changed, 353 insertions(+) create mode 100644 .config/afew/config create mode 100644 .config/bash/inputrc create mode 100644 .config/gnupg/gpg.conf create mode 100644 .config/gnupg/sshcontrol create mode 100644 .config/hg/hgrc create mode 100644 .config/i3/config create mode 100644 .config/info/infokey create mode 100644 .config/mailcaps/config create mode 100644 .config/python/pythonrc.py create mode 100644 .config/ranger/rc.conf create mode 100644 .config/sbcl/sbclrc.lisp create mode 100644 .config/ssh/config create mode 100644 .config/ssh/known_hosts create mode 100644 .config/tmux/tmux.conf diff --git a/.config/afew/config b/.config/afew/config new file mode 100644 index 0000000..94341e9 --- /dev/null +++ b/.config/afew/config @@ -0,0 +1,6 @@ +[SpamFilter] +[KillThreadsFilter] +[ListMailsFilter] +[ArchiveSentMailsFilter] +[MeFilter] +[InboxFilter] diff --git a/.config/bash/inputrc b/.config/bash/inputrc new file mode 100644 index 0000000..f5c7095 --- /dev/null +++ b/.config/bash/inputrc @@ -0,0 +1,2 @@ +"\e[B": history-search-forward +"\e[A": history-search-backward diff --git a/.config/gnupg/gpg.conf b/.config/gnupg/gpg.conf new file mode 100644 index 0000000..d4498fe --- /dev/null +++ b/.config/gnupg/gpg.conf @@ -0,0 +1 @@ +keyserver pool.sks-keyservers.net diff --git a/.config/gnupg/sshcontrol b/.config/gnupg/sshcontrol new file mode 100644 index 0000000..1ae03ed --- /dev/null +++ b/.config/gnupg/sshcontrol @@ -0,0 +1 @@ +750154E135FD7B11FDDF0107CC0904F92EBD2AE4 diff --git a/.config/hg/hgrc b/.config/hg/hgrc new file mode 100644 index 0000000..656f40b --- /dev/null +++ b/.config/hg/hgrc @@ -0,0 +1,2 @@ +[ui] +username = EuAndreh diff --git a/.config/i3/config b/.config/i3/config new file mode 100644 index 0000000..7392d64 --- /dev/null +++ b/.config/i3/config @@ -0,0 +1,157 @@ +set $mod Mod4 + + +# font pango:monospace 8 + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +font pango:DejaVu Sans Mono 8 + +# Start XDG autostart .desktop files using dex. See also +# https://wiki.archlinux.org/index.php/XDG_Autostart +exec --no-startup-id dex --autostart --environment i3 + +# The combination of xss-lock, nm-applet and pactl is a popular choice, so +# they are included here as an example. Modify as you see fit. + +# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the +# screen before suspend. Use loginctl lock-session to lock your screen. +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork + +# NetworkManager is the most popular way to manage wireless networks on Linux, +# and nm-applet is a desktop environment-independent system tray GUI for it. +exec --no-startup-id nm-applet + +# Use pactl to adjust volume in PulseAudio. +set $refresh_i3status killall -SIGUSR1 i3status +bindsym F1 exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym F2 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status +bindsym F3 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status + +bindsym F5 exec --no-startup-id playerctl play-pause && $refresh_i3status + + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +bindsym $mod+Return exec st +bindsym $mod+Shift+q kill +bindsym $mod+p exec --no-startup-id dmenu_run + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# bindsym $mod+h split h # what is this? + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e 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'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + # bindsym Left resize shrink width 10 px or 10 ppt + # bindsym Down resize grow height 10 px or 10 ppt + # bindsym Up resize shrink height 10 px or 10 ppt + # bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Caps_Lock mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + position top + status_command i3status +} + +default_border pixel +default_floating_border pixel diff --git a/.config/info/infokey b/.config/info/infokey new file mode 100644 index 0000000..90edc50 --- /dev/null +++ b/.config/info/infokey @@ -0,0 +1,7 @@ +^e down-line +^y up-line + +#var +link-style=cyan +active-link-style=blue,bold +match-style=underline,bold,bggreen diff --git a/.config/mailcaps/config b/.config/mailcaps/config new file mode 100644 index 0000000..aeea68d --- /dev/null +++ b/.config/mailcaps/config @@ -0,0 +1 @@ +text/html; w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput diff --git a/.config/python/pythonrc.py b/.config/python/pythonrc.py new file mode 100644 index 0000000..1fc3bfe --- /dev/null +++ b/.config/python/pythonrc.py @@ -0,0 +1,15 @@ +import os +import atexit +import readline + +history = os.path.join(os.environ["XDG_STATE_HOME"], "python-history") + +try: + readline.read_history_file(history) +except OSError: + pass + +def write_history(): + readline.write_history_file(history) + +atexit.register(write_history) diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf new file mode 100644 index 0000000..312936e --- /dev/null +++ b/.config/ranger/rc.conf @@ -0,0 +1 @@ +map DD shell mv %s /home/${USER}/.local/share/Trash/files/ \ No newline at end of file diff --git a/.config/sbcl/sbclrc.lisp b/.config/sbcl/sbclrc.lisp new file mode 100644 index 0000000..df7f57a --- /dev/null +++ b/.config/sbcl/sbclrc.lisp @@ -0,0 +1,6 @@ +;;; The following lines added by ql:add-to-init-file: +#-quicklisp +(let ((quicklisp-init (merge-pathnames "dev/quicklisp/setup.lisp" + (user-homedir-pathname)))) + (when (probe-file quicklisp-init) + (load quicklisp-init))) diff --git a/.config/ssh/config b/.config/ssh/config new file mode 100644 index 0000000..8b0f32b --- /dev/null +++ b/.config/ssh/config @@ -0,0 +1 @@ +Include ~/dev/libre/servers/src/infrastructure/ssh.conf diff --git a/.config/ssh/known_hosts b/.config/ssh/known_hosts new file mode 100644 index 0000000..ad6b0b2 --- /dev/null +++ b/.config/ssh/known_hosts @@ -0,0 +1,74 @@ +|1|G2vfdmQ84glwobYXZZ0d+cCMVRE=|DZJYmWjbeP52J4K7+Bsz2e0dgBA= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +|1|yosAhKlbZt51FfD2VvQJiVijSBA=|BFEig1gqq4EwCHEHagEASQZQmNI= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +|1|5yKbUaAB5AFz4MINtTVhVAPwMtU=|LwcI5Z8hXwwKxtkk4KDpeZduyPQ= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +|1|sfEM3JnFec93XEzMf9A6TkthgdI=|oZX7oe9eBKYMrXLcoFydh70my5A= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +|1|F/E3nafzrpMZEzyN8iA++okJ7Q4=|T00Gk7F90YmbaTMSOGjP8yhls94= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMylg2eib0byVT2R7dVFkxdhXO5pvgllnszKhlHiEP15ee8IjMYNPvz2A605hUdIxXtsBgjf+u7jlubh6mbx/YA= +|1|jSpDKjDomux2z3O/ok/UPGGQ8xs=|ZP60naGKQnpK6yHGD+B/+ykB05c= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMylg2eib0byVT2R7dVFkxdhXO5pvgllnszKhlHiEP15ee8IjMYNPvz2A605hUdIxXtsBgjf+u7jlubh6mbx/YA= +|1|PJybLcZRkpN9IyDsqaNjGO6lE5Y=|K0nchvCA7XV91J2X6l0h2DwOmyI= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +|1|zzdSJf8JIMfi5sKbc/mNcBy/RB8=|0GxC/CesxJHcRdt8MuPVjfab06k= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +|1|X5OmtKdXZh2kC//XCXEEOim7tgE=|Rh5ro2oEB4MN8MP6PRbG3QBR0Kk= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +46.101.43.82 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLIGIc5X12Y61eVcKJnNzCvrPeSKgyKgElqGl7QDeGeynE33sRVoNAg9aqkgXdc2MkN+nFhEWELkjPuBKYsyp2I= +hinarioespirita.org,167.99.34.30 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= +pt.hinarioespirita.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= +mtm.hinarioespirita.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= +77.109.148.18 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +35.231.145.151 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +git.sr.ht,173.195.146.142 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +192.168.33.10 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCL+hEiW/Va2L6y5Y4MyxRBXHJw/9bIC02M3wGVe1zaD3DT8wsAUcJ2QO1lJILudvMInx+SaPyJmwBvUn58YR2c= +173.195.146.152 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +2001:1620:2019::218 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +140.82.114.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +140.82.113.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +140.82.113.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +140.82.114.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +2604:bf00:710:0:5054:ff:fe7d:8fa8 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +azusa.runners.sr.ht,2604:bf00:710:0:ae1f:6bff:fead:55a ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPzxK5AM1FdMI9gZVDpw2O5iiS/49QokWpzANFntVt0Qig4qdBt4K7B0O6MrwggLh3A+zBlsXCMoWtvFtPQgLxA= +18.228.52.138 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +18.231.5.6 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +2604:bf00:710:0:5054:ff:fe36:ebc6 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +18.228.67.229 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +hg.sr.ht,2604:bf00:710:0:5054:ff:fe25:1aa6 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL4aNGa+KnvMA0QoWrIVuI2QBU0Q/xX48sMBl3VtP/zPOGMvS50zGVMaA00RSzfcI2X0v/aUTsVm2vBNo/V1gTg= +euandre.org,2a03:b0c0:3:d0::387:b001 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF6wlJqwd7KWLzLovwnwbTmNfO4E4yVDyqxAAlUkn9eDsTtzV1RYNDsaLPWv4mweJqP4crZPFxg40sFVeMDbkC0= +2606:4700:90:0:f22e:fbec:5bed:a9b9 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +46.101.160.115 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF6wlJqwd7KWLzLovwnwbTmNfO4E4yVDyqxAAlUkn9eDsTtzV1RYNDsaLPWv4mweJqP4crZPFxg40sFVeMDbkC0= +173.195.146.249 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPzxK5AM1FdMI9gZVDpw2O5iiS/49QokWpzANFntVt0Qig4qdBt4K7B0O6MrwggLh3A+zBlsXCMoWtvFtPQgLxA= +2604:a880:800:14::32:4000 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK8YTumqLFAL5MJ0AcDtFG9dWfbkJKU7FUDlH0xEgAZvHGU57TBr9DIQy2OHrxCxuhk9bZEUX8+vJiRXE05+Rzs= +2001:19f0:7001:5cec:5400:2ff:feec:9940 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPYRWlGutc+bRJ+N0sXHxhgnDsRvRoauQ92yM1U7N+8a +2001:19f0:6c01:2cf0:5400:2ff:feec:99c5 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMGiiEXB+koPS1vgGkwdExk2Q5fGv3Yc5rf8jVHB2FB7 +45.32.155.96 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN +45.77.65.204 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN +136.244.85.68 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN +199.247.0.136 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +euandreh.xyz ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +136.244.80.130 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +209.250.232.122 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +git.euandreh.xyz ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +80.240.24.148 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +95.179.246.150 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +45.77.52.185 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +199.247.2.245 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +140.82.112.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +104.238.176.223 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +172.65.251.78 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +140.82.112.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +45.32.158.17 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +95.179.253.243 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +95.179.163.103 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +217.69.2.177 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +arrobaponto.org,104.238.167.189 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +104.238.176.81 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +git.arrobaponto.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +173.199.70.52 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +[remembering.euandreh.xyz]:23841 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +167.71.86.194 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCXg/l/grol/OAY95VphKbVn4yXUStSWpxQjnka7PWXzWyForfX+fpmY+p72r1Uimx5oXIFISt8uSZW/tvD61iQ= +[localhost]:10022 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLHACdQJXUj5e4Znyh7KdTjB1RLznSfStRw6cuHZlu8rhANVfkjt300Fum9Jv6yLra6W4v2FLALWfcYpOlUzt9c= +107.191.63.70 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMONpsqwH79f/MsjtsOPitT5C+3hPPJqVh42oHMKOen6 +217.69.11.49 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr +[arrobaponto.org]:23213 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr +anoncvs.netbsd.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA3QiBl8leG9fqIJpKeNov0PKq5YryFFiroMWOPUv4hDFn8R0jC07YVaR/OSBrr37CTmGX5AFceXPzoFnLlwCqWR7rXg4NR75FTlTp9CG9EBAEtU8mee27KDrUFBTZdfVl2+aRYoAI5fTXA+0vpIO68Cq843vRWUZCcwinS4cNLUU= +git.2f30.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSLZ4G5w4NysBUmAHmr6/V9om42IHSUCtqrNdhWoYQ0 +[arrobaponto.org]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 +[199.247.13.53]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 +[2001:19f0:6801:988:5400:3ff:fea1:b566]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 +[gerrit.wikimedia.org]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCF8pwFLehzCXhbF1jfHWtd9d1LFq2NirplEBQYs7AOrGwQ/6ZZI0gvZFYiEiaw1o+F1CMfoHdny1VfWOJF3mJ1y9QMKAacc8/Z3tG39jBKRQCuxmYLO1SWymv7/Uvx9WQlkNRoTdTTa9OJFy6UqvLQEXKYaokfMIUHZ+oVFf1CgQ== +2001:19f0:5:1d65:5400:3ff:fee3:7463 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF2EgU3IgCwv1ynnWfxFm0SHTSoE0AYG3MJT/TpN3pBz diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..705e9a3 --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,79 @@ +# Use personal prefix over "C-b" +unbind C-b +set -g prefix C-v + +# Turn on mouse mode +# https://groups.google.com/forum/#!msg/tmux-users/TRwPgEOVqho/Ck_oth_SDgAJ +# https://github.com/tmux/tmux/blob/310f0a960ca64fa3809545badc629c0c166c6cd2/CHANGES#L12 +set -g mouse on + +# Bind "C-x r" to reload the configuration file +bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded" + +# Holy answer that properly implements copying from tmux! +# https://unix.stackexchange.com/a/349020/276661 +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xclip -selection clipboard -i" \; +bind-key y send-keys -X copy-pipe "xclip -selection clipboard -i" \; display-message "Copied system clipboard! Hooray! Long-live tmux!" + +# Moving around panes +bind-key -n M-h select-pane -L +bind-key -n M-j select-pane -D +bind-key -n M-k select-pane -U +bind-key -n M-l select-pane -R + +# Resizing panes +bind-key -n M-H resize-pane -L 5 +bind-key -n M-J resize-pane -D 5 +bind-key -n M-K resize-pane -U 5 +bind-key -n M-L resize-pane -R 5 + +# Reorder windows +bind-key -n C-S-Left swap-window -t -1\; select-window -t -1 +bind-key -n C-S-Right swap-window -t +1\; select-window -t +1 +# +# To change the number of a window, use: PREFIX-., and pick a new unused number +# + +# Join windows +bind-key -n C-S-M-Left join-pane -s :-0 -t :-1 +bind-key -n C-S-M-Right join-pane -s :-0 -t :+1 + +# "M m" to actually clear the pane history +bind -n M-m send-keys -R \; clear-history + +# Keybinding to activate pane typing sync +# https://stackoverflow.com/questions/25909964/tmux-how-to-toggle-on-and-off-options-with-the-same-key +bind-key b setw synchronize-panes \; display-message "synchronize-panes toggle" + +setw -g mode-keys vi # Move around with vi keys +set-option -g status-key "vi" # Use vi mode for status bar command (like after typing "C-x [" one can search with "/") +set-option -g status-bg "#666666" # Status bar background color +set-option -g status-fg "#aaaaaa" # Status bar foreground color +set-option -g status-left-length 50 # session name in status bar length =[annex]= part +set-option -g history-limit 150000 # How many lines of history to keep +set-option -g status-right "" + +# Set the panes initial index value to 1 instead of 0 +# 0 is too far from ` ;) +set -g base-index 1 +set-window-option -g pane-base-index 1 + +# Automatically set window title +set-window-option -g automatic-rename on +set-option -g set-titles on + +# Set "correct term" +# https://wiki.archlinux.org/index.php/Tmux +set -g default-terminal screen-256color + +# No delay for escape key press +# https://mutelight.org/practical-tmux#faster-command-sequences +set -sg escape-time 0 + +# Display pane numbers for longer +# https://unix.stackexchange.com/questions/307696/how-to-increase-tmux-pane-numbers-display-time-ctrl-b-q +set -g display-panes-time 2500 + +bind-key t resize-pane -x 80 + +bind -n M-r attach-session -t . -c '#{pane_current_path}' \; display-message "CWD for session updated to #{pane_current_path}!" -- cgit v1.2.3 From 2ef2a5e9c70b40eeff90f510a2ff74b5fbcf5327 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 22 Apr 2022 12:29:35 -0300 Subject: .config/guix/home.scm: Add "libfaketime" package --- .config/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/guix/home.scm b/.config/guix/home.scm index a673968..96ba99e 100644 --- a/.config/guix/home.scm +++ b/.config/guix/home.scm @@ -110,6 +110,7 @@ borg khal khard + libfaketime shellcheck clojure -- cgit v1.2.3 From 7cc2c8abfae5a9ba25ff50fc138e3b73f699755e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 22 Apr 2022 12:40:32 -0300 Subject: Include private files as symlinks --- .config/alot/config | 1 + .config/khal/config | 1 + .config/khard/khard.conf | 1 + .config/mbsync/config | 1 + .config/msmtp/config | 1 + .config/notmuch/default/config | 1 + .config/weechat/irc.conf | 1 + Maildir/.notmuch/hooks/post-new | 1 + 8 files changed, 8 insertions(+) create mode 120000 .config/alot/config create mode 120000 .config/khal/config create mode 120000 .config/khard/khard.conf create mode 120000 .config/mbsync/config create mode 120000 .config/msmtp/config create mode 120000 .config/notmuch/default/config create mode 120000 .config/weechat/irc.conf create mode 120000 Maildir/.notmuch/hooks/post-new diff --git a/.config/alot/config b/.config/alot/config new file mode 120000 index 0000000..a92319d --- /dev/null +++ b/.config/alot/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/alot/config \ No newline at end of file diff --git a/.config/khal/config b/.config/khal/config new file mode 120000 index 0000000..dfae173 --- /dev/null +++ b/.config/khal/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/khal/config \ No newline at end of file diff --git a/.config/khard/khard.conf b/.config/khard/khard.conf new file mode 120000 index 0000000..f015b29 --- /dev/null +++ b/.config/khard/khard.conf @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/khard/khard.conf \ No newline at end of file diff --git a/.config/mbsync/config b/.config/mbsync/config new file mode 120000 index 0000000..68a3234 --- /dev/null +++ b/.config/mbsync/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/mbsync/config \ No newline at end of file diff --git a/.config/msmtp/config b/.config/msmtp/config new file mode 120000 index 0000000..45cd0ac --- /dev/null +++ b/.config/msmtp/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/msmtp/config \ No newline at end of file diff --git a/.config/notmuch/default/config b/.config/notmuch/default/config new file mode 120000 index 0000000..3b9d2f4 --- /dev/null +++ b/.config/notmuch/default/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/notmuch/default/config \ No newline at end of file diff --git a/.config/weechat/irc.conf b/.config/weechat/irc.conf new file mode 120000 index 0000000..7dff360 --- /dev/null +++ b/.config/weechat/irc.conf @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/weechat/irc.conf \ No newline at end of file diff --git a/Maildir/.notmuch/hooks/post-new b/Maildir/.notmuch/hooks/post-new new file mode 120000 index 0000000..7992789 --- /dev/null +++ b/Maildir/.notmuch/hooks/post-new @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/notmuch/post-new \ No newline at end of file -- cgit v1.2.3 From 53f7b16b94b826873c96f91cc0ea7aeb3366d96e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 24 Apr 2022 12:43:33 -0300 Subject: .local/bin/rfc: Add script after doing some polishing --- .local/bin/rfc | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100755 .local/bin/rfc diff --git a/.local/bin/rfc b/.local/bin/rfc new file mode 100755 index 0000000..a483595 --- /dev/null +++ b/.local/bin/rfc @@ -0,0 +1,117 @@ +#!/bin/sh +set -eu + +TARBALL_URL='https://www.rfc-editor.org/in-notes/tar/RFC-all.tar.gz' + +usage() { + cat <<-'EOF' + Usage: + rfc [-w] RFC_NUMBER + rfc -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -w Show the path to the RFC file instead of displaying + its contents. + -h, --help show this message + + Lookup the given RFC + in $XDG_DATA_HOME/doc/rfc/ (defaults to ~/.local/share), + and feed it into the $PAGER, akin to doing: + + $ $PAGER $XDG_DATA_HOME/doc/rfc/rfc$RFC_NUMBER.txt + + If the $XDG_DATA_HOME/doc/rfc/ directory doesn't exist, it tries to + create it by downloading the latest RFC tarball [0] and placing all .txt + files there. + EOF + + printf '\n[0]: %s\n' "$TARBALL_URL" +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'wh' flag; do + case "$flag" in + w) + WHERE=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +RFC_NUMBER="${1:-}" +if [ -z "$RFC_NUMBER" ]; then + echo 'Missing argument RFC_NUMBER' >&2 + usage >&2 + exit 2 +fi + +D="${XDG_DATA_HOME:-$HOME/.local/share}/doc/rfc" +if [ ! -e "$D" ]; then + printf 'RFC directory does not exist:\n\t%s/\n\n' "$D" + printf 'Do you want to download the files to create it? [Y/n] ' + read -r yesno + if [ "$yesno" != 'n' ] && [ "$yesno" != 'N' ]; then + CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/rfc-cli" + mkdir -p "$CACHE_DIR" + wget -cO "$CACHE_DIR"/RFC-all.tar.gz "$TARBALL_URL" + rm -rf "$CACHE_DIR/tmp" + mkdir -p "$CACHE_DIR/tmp" + tar \ + -C "$CACHE_DIR/tmp" \ + -xvf "$CACHE_DIR"/RFC-all.tar.gz \ + --wildcards \ + 'rfc*.txt' + mkdir -p "$(dirname "$D")" + mv "$CACHE_DIR/tmp" "$D" + fi +fi + +F="$D/rfc${RFC_NUMBER}.txt" +if [ ! -e "$F" ]; then + printf 'Given RFC_NUMBER "%s" does not exist at:\n%s\n' \ + "$RFC_NUMBER" "$F" >&2 + exit 2 +fi + +if [ "${WHERE:-}" = true ]; then + printf '%s\n' "$F" + exit +fi + +view() { + if [ -t 1 ]; then + ${PAGER:-cat} + else + cat + fi +} + +view < "$F" -- cgit v1.2.3 From a845bfe87d0c69b83fa8441a5bd717e9cff1a8bc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 24 Apr 2022 12:44:57 -0300 Subject: ~/.config/guix/system.scm: Change language to french --- .config/guix/system.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/guix/system.scm b/.config/guix/system.scm index 10e36d9..3bd7235 100644 --- a/.config/guix/system.scm +++ b/.config/guix/system.scm @@ -18,7 +18,7 @@ (kernel linux) (initrd microcode-initrd) (firmware (list linux-firmware)) - (locale "en_GB.UTF-8") + (locale "fr_FR.UTF-8") (timezone "America/Sao_Paulo") (keyboard-layout (keyboard-layout "br" #:options '("caps:swapescape" "esperanto:qwerty"))) -- cgit v1.2.3 From 5a1829fcb372b9ba06423b65f4f6712c230aeac7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 24 Apr 2022 12:45:33 -0300 Subject: ~/.config/guix/home.scm: Add day-to-day packages --- .config/guix/home.scm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.config/guix/home.scm b/.config/guix/home.scm index 96ba99e..6d3b840 100644 --- a/.config/guix/home.scm +++ b/.config/guix/home.scm @@ -94,7 +94,7 @@ password-store playerctl pinentry-gtk2 - make + bmake fzf ranger blueman @@ -111,10 +111,21 @@ khal khard libfaketime - + qrencode + feh + sox + xset + graphviz + moreutils shellcheck + gettext + groff + clojure openjdk + sbcl + perl + perl-mojolicious st i3status @@ -127,6 +138,10 @@ w3m afew + zathura + zathura-djvu + zathura-pdf-poppler + zathura-ps firefox)) (list msmtp-non-hardcoded))) (services -- cgit v1.2.3 From 9ab320e0cb4622d712b5bd64519f460ce1d9ce59 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 24 Apr 2022 12:46:53 -0300 Subject: ~/.config/guix/home.scm: Point ~/.bashrc to ~/.config/bash/rc --- .config/guix/home.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/guix/home.scm b/.config/guix/home.scm index 6d3b840..607a059 100644 --- a/.config/guix/home.scm +++ b/.config/guix/home.scm @@ -148,5 +148,5 @@ (list (service home-bash-service-type (home-bash-configuration (bashrc - (list (local-file (xdg-config-home "bash/bashrc.sh") "bashrc.sh"))))) + (list (plain-file "bashrc.sh" ". $XDG_CONFIG_HOME/bash/rc"))))) (simple-service 'config-files home-files-service-type (dot-config))))) -- cgit v1.2.3 From 032b28d363288f937cf3355d8ab3e578c97a6ed7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 24 Apr 2022 12:49:06 -0300 Subject: ~/.local/bin/backup: Add polished backup script --- .local/bin/backup | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100755 .local/bin/backup diff --git a/.local/bin/backup b/.local/bin/backup new file mode 100755 index 0000000..cd7b5ad --- /dev/null +++ b/.local/bin/backup @@ -0,0 +1,127 @@ +#!/bin/sh +. ~/.bash_profile +set -eu + +usage() { + cat <<-'EOF' + Usage: + backup [-v] [-C COMMENT] ARCHIVE_TAG + backup -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -v enable verbose mode, useful for + interactive sessions + -C COMMENT the comment text to be attached to the archive + -h, --help show this message + + ARCHIVE_TAG the tag used to create the new + backup (default: "cronjob") + + + The repository is expected to have been created with: + + $ borg init -e repokey-blake2 + + The following environment variables are expected to be exported: + + $BORG_PASSCOMMAND + $BORG_REPO + + Password-less SSH access is required, and remote configuration + via $BORG_REMOTE_PATH can be done at will. + + + Examples: + + Run backup from cronjob: + + $ backup cronjob + + Create backup with comment, and verbose mode active: + + $ backup -vC 'The backup has a comment' my-backup + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +VERBOSE_FLAGS='' +COMMENT='' +while getopts 'vC:h' flag; do + case "$flag" in + v) + VERBOSE_FLAGS='--verbose --progress' + ;; + C) + COMMENT="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +ARCHIVE_TAG="${1:-}" +assert_arg "$ARCHIVE_TAG" 'ARCHIVE_TAG' + +set -x + + +finish() { + STATUS=$? + printf '\n>>>\n>>> exit status: %s\n>>>\n\n' "$STATUS" >&2 +} +trap finish EXIT + +borg create \ + $VERBOSE_FLAGS \ + --comment "$COMMENT" \ + --exclude ~/.cache \ + --stats \ + --compression lzma,9 \ + "::{hostname}-{now}-$ARCHIVE_TAG" \ + ~/ ||: + +borg check \ + --verbose + +borg prune \ + --verbose \ + --list \ + --keep-within=6m \ + --keep-weekly=52 \ + --keep-monthly=24 -- cgit v1.2.3 From 5fd29a52fb19d23df65bc91e7309e9a526fc0501 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 24 Apr 2022 12:55:17 -0300 Subject: ~/.local/bin/qr: Add script --- .local/bin/qr | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 .local/bin/qr diff --git a/.local/bin/qr b/.local/bin/qr new file mode 100755 index 0000000..4821a46 --- /dev/null +++ b/.local/bin/qr @@ -0,0 +1,58 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + qr [-s PIXEL_SIZE] + qr -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -s PIXEL_SIZE size of the pixel (default 10) + -h, --help show this help message + + Read data from STDIN and present a QR image with said data. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +PIXEL_SIZE=10 +while getopts 's:h' flag; do + case "$flag" in + s) + PIXEL_SIZE="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +cat | qrencode -s "$PIXEL_SIZE" -o- | feh - -- cgit v1.2.3 From 0de7fbce33d6b9cea59432d3ccbd1184ae3dad53 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 27 Apr 2022 18:26:30 -0300 Subject: .local/bin/backup: Mention $BORG_REMOTE_PATH and .ssh/authorized_keys in the documentation --- .local/bin/backup | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.local/bin/backup b/.local/bin/backup index cd7b5ad..d77425c 100755 --- a/.local/bin/backup +++ b/.local/bin/backup @@ -32,9 +32,10 @@ help() { $BORG_PASSCOMMAND $BORG_REPO + $BORG_REMOTE_PATH - Password-less SSH access is required, and remote configuration - via $BORG_REMOTE_PATH can be done at will. + Password-less SSH access is required, usually done via adding + ~/.ssh/id_rsa.pub to suyin:.ssh/authorized_keys. Examples: -- cgit v1.2.3 From 292afbc80f624ff802832cddca96854dfd0e242b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 4 May 2022 18:38:38 -0300 Subject: ~/.local/bin/xmpp: Add working command! --- .local/bin/xmpp | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 .local/bin/xmpp diff --git a/.local/bin/xmpp b/.local/bin/xmpp new file mode 100755 index 0000000..ed92be8 --- /dev/null +++ b/.local/bin/xmpp @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 + +import os +import sys +import getopt +import logging +import slixmpp + +USAGE = """\ +Usage: + xmpp [-d] [-F FROM_JID] -m MESSAGE TO_JID... + xmpp -h""" + +HELP = """ +Options: + -d run in DEBUG mode + -m MESSAGE the text of the message to be sent + -h, --help show this message + + FROM_JID the address used to send the message from + TO_JID the addresses where to send the message to""" + +class SendMsgBot(slixmpp.ClientXMPP): + def __init__(self, jid, password, on_start): + slixmpp.ClientXMPP.__init__(self, jid, password) + + self.on_start = on_start + self.add_event_handler("session_start", self.start) + + def start(self, event): + self.on_start(self) + self.disconnect(wait=True) + +def main(): + logging.basicConfig(level=logging.INFO) + from_ = "bot@euandreh.xyz" + message = "" + + for s in sys.argv: + if s == "--": + break + elif s == "--help": + print(USAGE) + print(HELP) + sys.exit() + + try: + opts, args = getopt.getopt(sys.argv[1:], 'm:F:dh') + except getopt.GetoptError as err: + print(err, file=sys.stderr) + print(USAGE, file=sys.stderr) + sys.exit(2) + for o, a in opts: + if o == "-m": + message = a + elif o == "-F": + from_ = a + elif o == "-d": + logging.basicConfig(level=logging.DEBUG) + elif o == "-h": + print(USAGE) + print(HELP) + sys.exit() + else: + assert False, "unhandled option" + + if message == "": + print("Missing -m MESSAGE", file=sys.stderr) + print(USAGE, file=sys.stderr) + sys.exit(2) + + if args == []: + args = ["eu@euandreh.xyz"] + + passcmd = "pass show VPS/kuvira/XMPP/" + from_ + " | head -n1 | tr -d '\\n'" + password = os.popen(passcmd).read() + + def on_start(self): + for to in args: + self.send_message(mto=to, mbody=message, mtype='chat') + + xmpp = SendMsgBot(from_, password, on_start) + xmpp.connect() + xmpp.process(forever=False) + +if __name__ == "__main__": + main() -- cgit v1.2.3 From 1ebad2169f10e19512c9d488dcc4051ebccff514 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 4 May 2022 18:57:10 -0300 Subject: ~/.local/bin/msg: Add working version! --- .local/bin/msg | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100755 .local/bin/msg diff --git a/.local/bin/msg b/.local/bin/msg new file mode 100755 index 0000000..b749c63 --- /dev/null +++ b/.local/bin/msg @@ -0,0 +1,88 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + msg -X XMPP_MESSAGE -s -S SOUND_MESSAGE -m EMAIL -D DESKTOP -b + msg -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -X XMPP_MESSAGE send XMPP using the `xmpp` command + -s play ~/Desktop/medium.ogg sound + -S SOUND_MESSAGE say SOUND_MESSAGE using `speak` + -m EMAIL_SUBJECT send email with EMAIL_SUBJECT and empty body + -D DESKTOP_MESSAGE the desktop message for `notify-send` + -b print terminal bell + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +ACTION_DONE=false +while getopts 'X:sS:m:D:bh' flag; do + case "$flag" in + X) + xmpp -m "$OPTARG" + ACTION_DONE=true + ;; + s) + play ~/Desktop/medium.ogg + ACTION_DONE=true + ;; + S) + echo "$OPTARG" | speak -v pt-BR + ACTION_DONE=true + ;; + m) + echo "" | mail \ + -a 'Content-Type: text/plain; charset=UTF-8' \ + -a 'From:bot@euandre.org' \ + -s "$OPTARG" \ + eu@euandre.org ||: + ACTION_DONE=true + ;; + D) + notify-send "$OPTARG" + ACTION_DONE=true + ;; + b) + printf '\a' + ACTION_DONE=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done + +if [ "$ACTION_DONE" = false ]; then + usage + help + exit +fi -- cgit v1.2.3 From a3cd8085a0a1d0a0fb7e05ad45fd61464edec4c5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 4 May 2022 19:46:24 -0300 Subject: ~/.local/bin/xmpp: Do not default TO_JID to eu@euandreh.xyz --- .local/bin/xmpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.local/bin/xmpp b/.local/bin/xmpp index ed92be8..472e9ca 100755 --- a/.local/bin/xmpp +++ b/.local/bin/xmpp @@ -70,7 +70,9 @@ def main(): sys.exit(2) if args == []: - args = ["eu@euandreh.xyz"] + print("Missing TO_JID", file=sys.stderr) + print(USAGE, file=sys.stderr) + sys.exit(2) passcmd = "pass show VPS/kuvira/XMPP/" + from_ + " | head -n1 | tr -d '\\n'" password = os.popen(passcmd).read() -- cgit v1.2.3 From 06ddff4c7041922f70595d836b17f2eb983d3046 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 4 May 2022 20:01:13 -0300 Subject: ~/.local/bin/email: Add working script! I'm on a streak! --- .local/bin/email | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 .local/bin/email diff --git a/.local/bin/email b/.local/bin/email new file mode 100755 index 0000000..0a1fd15 --- /dev/null +++ b/.local/bin/email @@ -0,0 +1,74 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + mail -s SUBJECT ADDRESS... < BODY + mail -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -s SUBJECT the email subject + -h, --help show this message + + ADDRESS the email addresses to send the email to + BODY the text to be sent as the body + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 's:h' flag; do + case "$flag" in + s) + SUBJECT="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + { + printf 'Missing %s.\n' "$2" + printf '\n' + usage + } >&2 + exit 2 + fi +} + +assert_arg "${SUBJECT:-}" '-s SUBJECT' +assert_arg "${1:-}" 'ADDRESS' + +printf 'Subject: %s\n\n%s' \ + "$(echo "$SUBJECT" | tr -d '\n')" \ + "$(cat)" | + msmtpq -a euandreh "$@" -- cgit v1.2.3 From 3ffd4cdbf86ce1c70eeacf1404ca81df2fa6399c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 00:33:26 -0300 Subject: ~/.local/bin/backup: Clean up script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove "borg check" and "borg prune" steps; - stop sourcing ~/.bash_profile; - ignore return code 1 from "borg create" command, as detailed in the documentation [0]: > warning (operation reached its normal end, but there > were warnings – you should check the log, logged as WARNING) [0]: https://borgbackup.readthedocs.io/en/stable/usage/general.html --- .local/bin/backup | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.local/bin/backup b/.local/bin/backup index d77425c..cab37dc 100755 --- a/.local/bin/backup +++ b/.local/bin/backup @@ -1,5 +1,4 @@ #!/bin/sh -. ~/.bash_profile set -eu usage() { @@ -99,8 +98,6 @@ assert_arg() { ARCHIVE_TAG="${1:-}" assert_arg "$ARCHIVE_TAG" 'ARCHIVE_TAG' -set -x - finish() { STATUS=$? @@ -108,21 +105,24 @@ finish() { } trap finish EXIT -borg create \ - $VERBOSE_FLAGS \ - --comment "$COMMENT" \ - --exclude ~/.cache \ - --stats \ - --compression lzma,9 \ - "::{hostname}-{now}-$ARCHIVE_TAG" \ - ~/ ||: - -borg check \ - --verbose - -borg prune \ - --verbose \ - --list \ - --keep-within=6m \ - --keep-weekly=52 \ - --keep-monthly=24 +run() { + borg create \ + $VERBOSE_FLAGS \ + --comment "$COMMENT" \ + --exclude ~/.cache/ \ + --exclude ~/Downloads/ \ + --stats \ + --compression lzma,9 \ + "::{hostname}-{now}-$ARCHIVE_TAG" \ + ~/ + STATUS=$? + + if [ "$STATUS" = 0 ] || [ "$STATUS" = 1 ]; then + echo 'WARNING, but no ERROR.' >&2 + return 0 + else + return "$STATUS" + fi +} + +run || exit $? -- cgit v1.2.3 From 8a5a2c2c0535acd6df4b9fc496f45a3387f387e4 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 00:45:24 -0300 Subject: .local/bin/msg: Fix xmpp - add to address --- .local/bin/msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/msg b/.local/bin/msg index b749c63..bdabfbe 100755 --- a/.local/bin/msg +++ b/.local/bin/msg @@ -42,7 +42,7 @@ ACTION_DONE=false while getopts 'X:sS:m:D:bh' flag; do case "$flag" in X) - xmpp -m "$OPTARG" + xmpp -m "$OPTARG" eu@euandreh.xyz ACTION_DONE=true ;; s) -- cgit v1.2.3 From 71c090766720f5bd54d269c950fe77eff9a6d778 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 00:46:11 -0300 Subject: .local/bin/msg: Play sound by default --- .local/bin/msg | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.local/bin/msg b/.local/bin/msg index bdabfbe..e350998 100755 --- a/.local/bin/msg +++ b/.local/bin/msg @@ -38,6 +38,10 @@ for flag in "$@"; do esac done +sound() { + play ~/Desktop/medium.ogg 2>/dev/null & +} + ACTION_DONE=false while getopts 'X:sS:m:D:bh' flag; do case "$flag" in @@ -46,7 +50,7 @@ while getopts 'X:sS:m:D:bh' flag; do ACTION_DONE=true ;; s) - play ~/Desktop/medium.ogg + sound ACTION_DONE=true ;; S) @@ -82,7 +86,10 @@ while getopts 'X:sS:m:D:bh' flag; do done if [ "$ACTION_DONE" = false ]; then + sound usage help exit fi + +wait -- cgit v1.2.3 From ce7057bbcf15b7756607a2ffd69342d23a444001 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 00:46:38 -0300 Subject: .local/bin/msg: Use `email` command over `mail` --- .local/bin/msg | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.local/bin/msg b/.local/bin/msg index e350998..ff67231 100755 --- a/.local/bin/msg +++ b/.local/bin/msg @@ -58,11 +58,7 @@ while getopts 'X:sS:m:D:bh' flag; do ACTION_DONE=true ;; m) - echo "" | mail \ - -a 'Content-Type: text/plain; charset=UTF-8' \ - -a 'From:bot@euandre.org' \ - -s "$OPTARG" \ - eu@euandre.org ||: + echo "" | email -s "$OPTARG" eu@euandre.org ACTION_DONE=true ;; D) -- cgit v1.2.3 From 1528bb60f48710d2b94d17a786a3b71150aa27e0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 00:47:21 -0300 Subject: .config/tmux/tmux.conf: Source file from $XDG_CONFIG instead of ~/.tmux.conf --- .config/tmux/tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 705e9a3..0eadf7c 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -8,7 +8,7 @@ set -g prefix C-v set -g mouse on # Bind "C-x r" to reload the configuration file -bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded" +bind-key r source-file $XDG_CONFIG_HOME/tmux/tmux.conf \; display-message "$XDG_CONFIG_HOME/tmux.conf reloaded" # Holy answer that properly implements copying from tmux! # https://unix.stackexchange.com/a/349020/276661 -- cgit v1.2.3 From a4c3bbc1092ca04d602b8aaf90172fe23517a774 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 00:48:03 -0300 Subject: .config/tmux/tmux.conf: Run `urlscan` on "C-v u" --- .config/tmux/tmux.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 0eadf7c..dd718ca 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -77,3 +77,5 @@ set -g display-panes-time 2500 bind-key t resize-pane -x 80 bind -n M-r attach-session -t . -c '#{pane_current_path}' \; display-message "CWD for session updated to #{pane_current_path}!" + +bind-key u capture-pane \; save-buffer /tmp/tmux-urlscan-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan < /tmp/tmux-urlscan-buffer"' -- cgit v1.2.3 From 573ef7eae0508fb4f488a6381a6d25ba16ca788a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 00:49:16 -0300 Subject: .config/ssh/config: Remove from Git (now being generated via Guix Home) --- .config/ssh/config | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .config/ssh/config diff --git a/.config/ssh/config b/.config/ssh/config deleted file mode 100644 index 8b0f32b..0000000 --- a/.config/ssh/config +++ /dev/null @@ -1 +0,0 @@ -Include ~/dev/libre/servers/src/infrastructure/ssh.conf -- cgit v1.2.3 From e7660da7657d8f6de6635f3d52a15cfb5e6508ee Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 00:49:43 -0300 Subject: .config/ranger/rc.conf: Use `trash` over manually moving files --- .config/ranger/rc.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index 312936e..ed2b538 100644 --- a/.config/ranger/rc.conf +++ b/.config/ranger/rc.conf @@ -1 +1 @@ -map DD shell mv %s /home/${USER}/.local/share/Trash/files/ \ No newline at end of file +map DD shell trash %s -- cgit v1.2.3 From 83a589473f70eda0f665c2a59fba1fd9311a570b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 01:19:09 -0300 Subject: .local/bin/with-email: Add working version --- .local/bin/with-email | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 .local/bin/with-email diff --git a/.local/bin/with-email b/.local/bin/with-email new file mode 100755 index 0000000..9d6326b --- /dev/null +++ b/.local/bin/with-email @@ -0,0 +1,84 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + with-email [-s SUBJECT] COMMAND... + with-email -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -s SUBJECT set the subject of the email + -h, --help show this message + + COMMAND the command to be wrapped + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +SUBJECT='NO SUBJECT' +while getopts 's:h' flag; do + case "$flag" in + s) + SUBJECT="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +assert_arg "${1:-}" 'COMMAND...' + +now() { + date '+%Y-%m-%dT%H:%M:%S%Z' +} + +OUT="$(mkstemp)" +{ + printf 'Running command: %s\n' "$*" + printf 'Starting at: %s\n' "$(now)" + printf '\n' + + STATUS=0 + "$@" 2>&1 || STATUS=$? + + printf '\n' + printf '\nFinished at: %s\n' "$(now)" +} 2>&1 1>"$OUT" + +email -s "(exit status: $STATUS) - $SUBJECT" eu@euandre.org < "$OUT" -- cgit v1.2.3 From e0f122829efcfad2780a2009e54f2d095dc86565 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 02:16:36 -0300 Subject: .local/bin/msg: Allow $ACTION_DONE to fallthrough to "wait" statement --- .local/bin/msg | 1 - 1 file changed, 1 deletion(-) diff --git a/.local/bin/msg b/.local/bin/msg index ff67231..f3e893e 100755 --- a/.local/bin/msg +++ b/.local/bin/msg @@ -85,7 +85,6 @@ if [ "$ACTION_DONE" = false ]; then sound usage help - exit fi wait -- cgit v1.2.3 From 7b74ea900231ab7713f642c556ee5cb67956e718 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 02:17:29 -0300 Subject: .local/bin/copy: Add working version --- .local/bin/copy | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 .local/bin/copy diff --git a/.local/bin/copy b/.local/bin/copy new file mode 100755 index 0000000..64e1e32 --- /dev/null +++ b/.local/bin/copy @@ -0,0 +1,67 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + copy [-n] < STDIN + copy -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -n remove newlines + -h, --help show this message + + Examples: + + Copy numbers to clipboard: + seq 10 | copy + + Copy string without newline: + echo 'with automatic newline' | copy -n + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +TRIM=false +while getopts 'nh' flag; do + case "$flag" in + n) + TRIM=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ "$TRIM" = true ]; then + cat - | tr -d '\n' | xclip -sel clip +else + cat - | xclip -sel clip +fi -- cgit v1.2.3 From fb44210db42ad2e006f7559d08fa825df4dc1ac3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 02:32:32 -0300 Subject: .local/bin/uuid: Add working version --- .local/bin/uuid | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 .local/bin/uuid diff --git a/.local/bin/uuid b/.local/bin/uuid new file mode 100755 index 0000000..74d0fba --- /dev/null +++ b/.local/bin/uuid @@ -0,0 +1,53 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + uuid + uuid -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Generate UUID from /dev/random. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +od -xN20 /dev/random | + awk 'NR == 1 { OFS="-"; print $2$3,$4,$5,$6,$7$8$9; exit }' -- cgit v1.2.3 From e673362c4db9d048ac8b5fa49860d94e7d910b2d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 02:38:26 -0300 Subject: .local/bin/tmpname: Add working version --- .local/bin/tmpname | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 .local/bin/tmpname diff --git a/.local/bin/tmpname b/.local/bin/tmpname new file mode 100755 index 0000000..d83fc87 --- /dev/null +++ b/.local/bin/tmpname @@ -0,0 +1,52 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + tmpname + tmpname -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Generate a temporary name. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +echo "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)" -- cgit v1.2.3 From 4e518f4560aa75c606a4d5515235ccf7f7c1963a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 02:41:24 -0300 Subject: .local/bin/{mkstemp,mkdtemp}: Add working versions --- .local/bin/mkdtemp | 24 ++++++++++++++++++++++++ .local/bin/mkstemp | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 .local/bin/mkdtemp create mode 100755 .local/bin/mkstemp diff --git a/.local/bin/mkdtemp b/.local/bin/mkdtemp new file mode 100755 index 0000000..9c7ddd8 --- /dev/null +++ b/.local/bin/mkdtemp @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + mkstemp + mkstemp -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Create a new temporary file and echo its name back. + EOF +} + +name="$(tmpname)" +mkdir "$name" +echo "$name" diff --git a/.local/bin/mkstemp b/.local/bin/mkstemp new file mode 100755 index 0000000..ec92c14 --- /dev/null +++ b/.local/bin/mkstemp @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + mkstemp + mkstemp -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Create a new temporary file and echo its name back. + EOF +} + +name="$(tmpname)" +touch "$name" +echo "$name" -- cgit v1.2.3 From 7355acf9003ffde574d76b552e7b44b9d65db003 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 03:02:40 -0300 Subject: .local/bin/gc: Add working version --- .local/bin/gc | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100755 .local/bin/gc diff --git a/.local/bin/gc b/.local/bin/gc new file mode 100755 index 0000000..ec6a8f1 --- /dev/null +++ b/.local/bin/gc @@ -0,0 +1,105 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + gc + gc -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +disk() { + df -h . | + awk 'NR == 2 { printf "%s - %s/%s\n", $4, $3, $2 }' +} + + +gc_guix() { + pass show velhinho/0-andreh-password | sudo -S guix system delete-generations + guix home delete-generations + guix gc -d +} + +gc_nohup() { + find ~/ -type f -name 'nohup.out' -exec rm -vf "{}" \; +} + +gc_trash() { + yes | trash-empty +} + +gc_tmpdir() { + find /tmp/ -type f -atime +10 -exec rm -vf "{}" \; ||: +} + +gc_docker() { + if command -v docker; then + yes | docker system prune -a + docker rmi "$(docker images -a -q)" ||: + docker rm "$(docker ps -a -f status=exited -q)" ||: + docker stop "$(docker ps -a -q)" ||: + docker rm "$(docker ps -a -q)" ||: + yes | docker volume prune + yes | docker container prune + fi +} + +gc_email() { + notmuch search --output=files --exclude=false tag:killed | + xargs -I{} rm -vf "{}" +} + + +BEFORE="$(disk)" +gc_guix +gc_nohup +gc_trash +gc_tmpdir +gc_docker +gc_email +wait +AFTER="$(disk)" + +printf 'Disk space:\n' +printf ' before: %s\n' "$BEFORE" +printf ' after: %s\n' "$AFTER" -- cgit v1.2.3 From 66762aa8f9d0a7e0cc11f7e890c346166b977efd Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 04:52:46 -0300 Subject: .local/bin/color: Add working version --- .local/bin/color | 203 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100755 .local/bin/color diff --git a/.local/bin/color b/.local/bin/color new file mode 100755 index 0000000..b9bc24b --- /dev/null +++ b/.local/bin/color @@ -0,0 +1,203 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + color -c COLOR TEXT + color -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -c COLOR + -h, --help show this message + + + The available colors are: + EOF + list_colors | sed 's/^/ /' +} + + +END="\033[0m" + +black() { + BLACK="\033[0;30m" + printf "${BLACK}${1}${END}" +} + +blackb() { + BLACK_B="\033[1;30m" + printf "${BLACK_B}${1}${END}" +} + +blacki() { + BLACK_I="\033[0;90m" + printf "${BLACK_I}${1}${END}" +} + +white() { + WHITE="\033[0;37m" + printf "${WHITE}${1}${END}" +} + +whiteb() { + WHITE_B="\033[1;37m" + printf "${WHITE_B}${1}${END}" +} + +red() { + RED="\033[0;31m" + printf "${RED}${1}${END}" +} + +redb() { + RED_B="\033[1;31m" + printf "${RED_B}${1}${END}" +} + +green() { + GREEN="\033[0;32m" + printf "${GREEN}${1}${END}" +} + +greenb() { + GREEN_B="\033[1;32m" + printf "${GREEN_B}${1}${END}" +} + +yellow() { + YELLOW="\033[0;33m" + printf "${YELLOW}${1}${END}" +} + +yellowb() { + YELLOW_B="\033[1;33m" + printf "${YELLOW_B}${1}${END}" +} + +blue() { + BLUE="\033[0;34m" + printf "${BLUE}${1}${END}" +} + +blueb() { + BLUE_B="\033[1;34m" + printf "${BLUE_B}${1}${END}" +} + +bluei() { + BLUE_I="\033[0;94m" + printf "${BLUE_I}${1}${END}" +} + +purple() { + PURPLE="\033[0;35m" + printf "${PURPLE}${1}${END}" +} + + +purpleb() { + PURPLE_B="\033[1;35m" + printf "${PURPLE_B}${1}${END}" +} + +lightblue() { + LIGHT_BLUE="\033[0;36m" + printf "${LIGHT_BLUE}${1}${END}" +} + +lightblueb() { + LIGHT_BLUE_B="\033[1;36m" + printf "${LIGHT_BLUE_B}${1}${END}" +} + +COLOR_LIST=' +black +blackb +white +whiteb +red +redb +green +greenb +yellow +yellowb +blue +blueb +purple +purpleb +lightblue +lightblueb +blacki +bluei +' +list_colors() { + for c in $COLOR_LIST; do + printf '%s\n' "$("$c" "$c")" + done +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'c:h' flag; do + case "$flag" in + c) + EXISTS=false + for c in $COLOR_LIST; do + if [ "$OPTARG" = "$c" ]; then + EXISTS=true + break + fi + done + if [ "$EXISTS" = false ]; then + printf 'Invalid color: %s\n' "$OPTARG" >&2 + fi + COLOR_FN="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +TEXT="${1:-}" +assert_arg "$COLOR_FN" '-c COLOR' +assert_arg "$TEXT" 'TEXT' + + +"$COLOR_FN" "$TEXT" -- cgit v1.2.3 From d3d387bf41f98e1e78abcfd756900809fa19e737 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 04:59:20 -0300 Subject: .config/bash/vcs-ps1.sh: Add adapted version, using `color` utility --- .config/bash/vcs-ps1.sh | 158 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 .config/bash/vcs-ps1.sh diff --git a/.config/bash/vcs-ps1.sh b/.config/bash/vcs-ps1.sh new file mode 100644 index 0000000..f2103da --- /dev/null +++ b/.config/bash/vcs-ps1.sh @@ -0,0 +1,158 @@ +#!/bin/sh + +repo_status_git() { + BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" + OUT="$(git status --short --branch --porcelain)" + BRANCH_LINE="$(echo "$OUT" | head -n 1)" + DIFF_LINES="$(echo "$OUT" | tail -n +2)" + + IS_AHEAD=false + IS_BEHIND=false + if echo "$BRANCH_LINE" | grep -q 'ahead'; then + IS_AHEAD=true + fi + if echo "$BRANCH_LINE" | grep -q 'behind'; then + IS_BEHIND=true + fi + + LINE='' + + if [ "$IS_AHEAD" = true ] && [ "$IS_BEHIND" = true ]; then + LINE="^^^ $BRANCH_NAME vvv" + elif [ "$IS_AHEAD" = true ]; then + LINE="^ $BRANCH_NAME ^" + elif [ "$IS_BEHIND" = true ]; then + LINE="v $BRANCH_NAME v" + else + LINE="$BRANCH_NAME" + fi + + HAS_DIFF=false + HAS_UNTRACKED=false + if echo "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then + HAS_DIFF=true + fi + if echo "$DIFF_LINES" | grep -q '^[?][?]'; then + HAS_UNTRACKED=true + fi + + if [ "$HAS_DIFF" = true ]; then + COLOR_FN=redb + LINE="{$LINE}" + elif [ "$IS_AHEAD" = true ] || [ "$IS_BEHIND" = true ]; then + COLOR_FN=bluei + LINE="[$LINE]" + elif [ "$HAS_UNTRACKED" = true ]; then + COLOR_FN=lightblue + LINE="{$LINE}" + else + COLOR_FN=green + LINE="($LINE)" + fi + + color -c "$COLOR_FN" "$LINE" + + BRANCH_COUNT="$(git branch --list | wc -l)" + if [ "$BRANCH_COUNT" -gt 1 ]; then + color -c lightblue "<$BRANCH_COUNT>" + fi + + STASH_COUNT="$(git stash list | wc -l)" + if [ "$STASH_COUNT" != 0 ]; then + color -c red "*$STASH_COUNT" + fi + + color -c blacki " - git/$(git rev-parse HEAD)" +} + +repo_status_fossil() { + BRANCH_NAME="$(fossil branch current)" + + if [ -n "$(fossil extras)" ]; then + HAS_UNTRACKED=1 + fi + + BRANCH_MARKER="$BRANCH_NAME" + + if [ -n "${HAS_UNTRACKED:-}" ]; then + COLOR_FN=lightblue + LINE="($BRANCH_MARKER)" + else + COLOR_FN=green + LINE="($BRANCH_MARKER)" + fi + + color -c "$COLOR_FN" "$LINE" + + color -c blacki " - fossil/$(fossil info | awk '/^checkout:/ { print $2 }')" +} + +repo_status_mercurial() { + BRANCH_NAME="$(hg branch)" +} + +repo_status() { + dir="$(basename "$PWD")" + if [ -d .git ]; then + repo_status_git + elif [ -f "$dir.fossil" ]; then + repo_status_fossil + elif [ -d .hg ]; then + repo_status_mercurial + fi +} + + +error_marker() { + STATUS=$? + if [ "$STATUS" != 0 ]; then + color -c redb " (!! $STATUS !!) " + fi +} + +timestamp() { + color -c blacki '\T' +} + +path() { + color -c yellowb '\w/' +} + +guix_env() { + if [ "$GUIX_ENVIRONMENT" != '' ]; then + printf '\n' + color -c blacki '~> ' + color -c purple 'guix environment ' + printf '(' + color -c blueb "$GUIX_ENVIRONMENT" + printf ')' + fi +} + +in_nix_shell() { + if [ "$IN_NIX_SHELL" != '' ]; then + printf '\n' + color -c blacki '~> ' + color -c purpleb "$IN_NIX_SHELL " + color -c purple 'nix-shell ' + printf '(' + color -c blueb "${name:-}" + printf ')' + fi +} + +PS1='`error_marker`'$(timestamp)' '$(path)' `repo_status``guix_env``in_nix_shell` +$ ' + + +vcs_status() { + git status "$@" +} + +vcs_diff() { + git diff "$@" +} + +vcs_diff_staged() { + git diff --staged "$@" +} -- cgit v1.2.3 From b92cf88765107069a0e019fa64cf9f51a12d9709 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 05:06:14 -0300 Subject: .local/bin/pre: Add working version --- .local/bin/pre | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 .local/bin/pre diff --git a/.local/bin/pre b/.local/bin/pre new file mode 100755 index 0000000..233ac1a --- /dev/null +++ b/.local/bin/pre @@ -0,0 +1,72 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + pre [-c COLOR] PREFIX + pre -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -c COLOR ANSI color to be used on the prefix text + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +COLOR='' +while getopts 'c:h' flag; do + case "$flag" in + c) + COLOR="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +PREFIX="${1:-}" +assert_arg "$PREFIX" 'PREFIX' + +while read -r line; do + if [ -z "$COLOR" ]; then + printf '%s: %s\n' "$PREFIX" "$line" + else + printf '%s: %s\n' "$(color -c "$COLOR" "$PREFIX")" "$line" + fi +done -- cgit v1.2.3 From 4880f2d553ac659cdaa990b79acb09a51bb7a187 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 05:07:28 -0300 Subject: .local/bin/color: Exit when given an invalid color --- .local/bin/color | 1 + 1 file changed, 1 insertion(+) diff --git a/.local/bin/color b/.local/bin/color index b9bc24b..0597278 100755 --- a/.local/bin/color +++ b/.local/bin/color @@ -171,6 +171,7 @@ while getopts 'c:h' flag; do done if [ "$EXISTS" = false ]; then printf 'Invalid color: %s\n' "$OPTARG" >&2 + exit 2 fi COLOR_FN="$OPTARG" ;; -- cgit v1.2.3 From 1cfa0af86cbac869a419027d2c2c935b9e0e95a5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 07:30:51 -0300 Subject: .local/bin/e: Add working version, inspired by vipe --- .local/bin/e | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100755 .local/bin/e diff --git a/.local/bin/e b/.local/bin/e new file mode 100755 index 0000000..76b4899 --- /dev/null +++ b/.local/bin/e @@ -0,0 +1,79 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + e [FILE] + e -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help + + + Flexibly run a text editor, either directly on in a pipe. + + Examples: + + Edit "file.txt": + + $ e file.txt + + Manipulate the content of a pipe midway: + + $ seq 10 | e | grep 5 + + The editor used is either $VISUAL or $EDITOR, with a fallback to + vi in case any of those variables aren't defined. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +CMD="${VISUAL:-${EDITOR:-vi}}" + +if [ ! -t 0 ]; then + F="$(mkstemp)" + cat > "$F" + exec 0&1 + exec 1>/dev/tty + $CMD "$F" + cat "$F" >&3 +else + $CMD "$@" +fi -- cgit v1.2.3 From 223c837990a3fbcb2f2fcbfc8b2b2a2a3a14ad31 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 07:36:53 -0300 Subject: .local/bin/grun: Add working version --- .local/bin/grun | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100755 .local/bin/grun diff --git a/.local/bin/grun b/.local/bin/grun new file mode 100755 index 0000000..5884e9e --- /dev/null +++ b/.local/bin/grun @@ -0,0 +1,102 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + grun [-r RECIPIENT] FILENAME -- COMMAND... + grun -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -r RECIPIENT the recipient to encrypt to. Can be given + multiple for multiple recipients. + -h, --help show this message + + COMMAND A command to be executed, that accepts input + in STDIN and emits result in STDOUT, and emits + errors as non-zero return codes. + FILENAME The GPG-encrypted file to be processed. If it + doesn't exist yet, it will be created. + + Examples: + + Edit "secrets.txt.gpg" using `vipe` and the default recipient: + + $ grun secrets.txt.gpg -- vipe + + Delete lines containing "FIXME" in todos.gpg: + + $ grun -r ABC123DEF321 todos.gpg -- sed '/FIXME/d' + + If COMMAND emits a non-zero return code, the file is left + unmodified. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'rh' flag; do + case "$flag" in + r) + RECIPIENTS_FLAG="${RECIPIENTS_FLAG:-} -r $OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +FILENAME="${1:-}" +assert_arg "$FILENAME" 'FILENAME' +shift + +if [ "${1:-}" != '--' ]; then + printf 'Missing "--" separator\n\n' >&2 + usage >&2 + exit 2 +fi +shift + +assert_arg "${1:-}" 'COMMAND' + + +if [ ! -e "$FILENAME" ]; then + OUT="$(printf '' | "$@")" +else + OUT="$(gpg -dq "$FILENAME" | "$@")" +fi + +echo "$OUT" | gpg -e ${RECIPIENTS_FLAG:--r eu@euandre.org} | sponge "$FILENAME" -- cgit v1.2.3 From b86fb2fdacba5b875f458fe846b6be8a72a794f1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 07:51:19 -0300 Subject: .local/bin/{max,min}: Add working versions --- .local/bin/max | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .local/bin/min | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100755 .local/bin/max create mode 100755 .local/bin/min diff --git a/.local/bin/max b/.local/bin/max new file mode 100755 index 0000000..84585ee --- /dev/null +++ b/.local/bin/max @@ -0,0 +1,61 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + max NUMBER... + max -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Get the maximum number from the given values. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ -z "${1:-}" ]; then + echo 0 + exit +fi + +N="$1" +for n in "$@"; do + N=$((N > n ? N : n)) +done +echo "$N" diff --git a/.local/bin/min b/.local/bin/min new file mode 100755 index 0000000..7868623 --- /dev/null +++ b/.local/bin/min @@ -0,0 +1,61 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + min NUMBER... + min -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Get the minimun number from the given values. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ -z "${1:-}" ]; then + echo 0 + exit +fi + +N="$1" +for n in "$@"; do + N=$((N < n ? N : n)) +done +echo "$N" -- cgit v1.2.3 From 1f6f35e48e33af3bddbfa6643831e5d9aca39250 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 08:58:41 -0300 Subject: .local/bin/without-env: Add working version --- .local/bin/without-env | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100755 .local/bin/without-env diff --git a/.local/bin/without-env b/.local/bin/without-env new file mode 100755 index 0000000..45c41ca --- /dev/null +++ b/.local/bin/without-env @@ -0,0 +1,76 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + without-env ENVVAR PATH -- COMMAND... + without-env [-h] + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Examples: + + Execute "command -V" filtering ~/bin, to get where "w3m" is + in $PATH, other than ~/bin: + $ without-env PATH ~/bin -- command -v w3m + + Compile foo.c, excluding ~/.local/include + from $C_INCLUDE_PATH: + $ without-env C_INCLUDE_PATH ~/.local/include -- cc -co foo.o foo.c + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n' "$2" >&2 + exit 2 + fi +} + +assert_arg "${1:-}" 'ENVVAR' +assert_arg "${2:-}" 'PATH' +assert_arg "${3:-}" '--' + +eval "export $1=\"\$(echo \"\$$1\" | sed \"s|\$2:||g\")\"" +shift # drop $1 +shift # drop $2 +shift # drop -- + +"$@" -- cgit v1.2.3 From 7f8c8dd18604bd04577526197c5e2823bccd6959 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 08:59:04 -0300 Subject: .local/bin/oepn,xdg-open: Add working versions --- .local/bin/open | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++ .local/bin/xdg-open | 1 + 2 files changed, 102 insertions(+) create mode 100755 .local/bin/open create mode 120000 .local/bin/xdg-open diff --git a/.local/bin/open b/.local/bin/open new file mode 100755 index 0000000..04a346b --- /dev/null +++ b/.local/bin/open @@ -0,0 +1,101 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + open FILE... + open -h +EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Examples: + + Open an HTML file on the current $BROWSER: + open index.html + + Open multiple PDF files (with zathura): + open *.pdf +EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ -z "${1:-}" ]; then + usage >&2 + exit 2 +fi + +for f in "$@"; do + case "$f" in + *.ico|*.jpg|*.jpeg|*.png) + feh "$f" + ;; + https://www.youtube.com/watch*) + nohup mpv "$f" 1>&2 2>/dev/null & + ;; + *.flac|*.ogg|*.mkv|*.avi|*.mp4) + nohup mpv "$f" 1>&2 2>/dev/null & + ;; + http*|*.svg|*.html) + "$BROWSER" "$f" + ;; + gopher://*) + amfora "$f" + ;; + gemini://*) + telescope "$f" + ;; + *.pdf|*.djvu|*.ps|*.epub) + nohup zathura "$f" 1>&2 2>/dev/null & + ;; + *.txt) + less "$f" + ;; + *.midi) + timidity "$f" + ;; + mailto:*) + alot compose "$f" + ;; + *) + DIR="$(realpath -- "$(dirname -- "$0")")" + CMD="$(without-env PATH "$DIR" -- command -v xdg-open)" + "$CMD" "$f" + ;; + esac +done diff --git a/.local/bin/xdg-open b/.local/bin/xdg-open new file mode 120000 index 0000000..ce4a72b --- /dev/null +++ b/.local/bin/xdg-open @@ -0,0 +1 @@ +open \ No newline at end of file -- cgit v1.2.3 From 733e5cc55ff84dce739e63ca0eab4ac1d60be243 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 09:05:26 -0300 Subject: .local/bin/print: Add working version --- .local/bin/print | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100755 .local/bin/print diff --git a/.local/bin/print b/.local/bin/print new file mode 100755 index 0000000..735d8ba --- /dev/null +++ b/.local/bin/print @@ -0,0 +1,151 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + print [-d] [-q QUALITY] [FILE...] + print -h +EOF +} + +help() { + cat <<-'EOF' + + Options: + -d print duplex/double-sided + -q QUALITY choose the print quality, either: + low, medium (default) or high. + -h, --help show this message + + Examples: + + Print the given PostScript file with default quality: + $ print f1.ps + + Print multiple PDF files with high quality: + $ print -dq high *.pdf + + Print the file from STDIN, double-sided: + $ print -d < f2.ps + + Print multiple source code files: + $ print src/*.{c,h} +EOF +} + +mkdtemp() { + name="$(echo 'mkstemp(template)' | + m4 -D template="${TMPDIR:-/tmp}/m4-tmpname.")" + rm -f "$name" + mkdir "$name" + echo "$name" +} + +n_pages() { + pdftk "$1" dump_data | awk '/NumberOfPages/ { print $2 }' +} + +main() { + if file -b "$FILE" | grep -q PostScript; then + ps2pdf "$FILE" "$NEWDIR"/in.pdf + elif file -b "$FILE" | grep -q PDF; then + cp "$FILE" "$NEWDIR"/in.pdf + else + enscript -o- "$FILE" | ps2pdf - "$NEWDIR"/in.pdf + fi + cd "$NEWDIR" + + if [ -z "$DUPLEX" ]; then + lp in.pdf + cd - > /dev/null + return + fi + + if [ "$(n_pages in.pdf)" = '1' ]; then + lp in.pdf + return + fi + + pdftk A=in.pdf cat Aodd output odd.pdf + pdftk A=in.pdf cat Aeven output even.pdf + + NODD="$(n_pages odd.pdf)" + NEVEN="$(n_pages even.pdf)" + + printf 'Printing odd pages...\n' >&2 + lp odd.pdf + printf 'Has printing finished yet? Once it does, reload the pages and hit it enter to continue. ' + read -r < /dev/tty + lp even.pdf + + if [ "$NODD" != "$NEVEN" ]; then + printf '\n' | lp + fi + + cd - > /dev/null +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +lpoptions -o PrintQuality=standard +DUPLEX= +while getopts 'dq:h' flag; do + case "$flag" in + d) + DUPLEX=1 + ;; + q) + case "$OPTARG" in + low) + lpoptions -o PrintQuality=draft + ;; + medium) + lpoptions -o PrintQuality=standard + ;; + high) + lpoptions -o PrintQuality=high + ;; + *) + echo "Bad QUALITY option: \"$OPTARG\"" >&2 + exit 2 + ;; + esac + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +NEWDIR="$(mkdtemp)" +if [ -z "${1:-}" ]; then + FILE="$NEWDIR"/STDIN + cat - > "$FILE" + main +else + for f in "$@"; do + FILE="$f" + main + done +fi -- cgit v1.2.3 From 6f76dc46dc74df3f0de2eca433c13765514ec06d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 09:05:43 -0300 Subject: .local/bin/brightness: Add working version --- .local/bin/brightness | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 .local/bin/brightness diff --git a/.local/bin/brightness b/.local/bin/brightness new file mode 100755 index 0000000..8e178ad --- /dev/null +++ b/.local/bin/brightness @@ -0,0 +1,13 @@ +#!/bin/sh +set -eu + +BRIGHTNESS_DIFF="$1" + +DEVICE="$(cat "$XDG_CONFIG_HOME"/backlight-device)" +HANDLER="/sys/class/backlight/$DEVICE" + +OLD_BRIGHTNESS="$(cat "$HANDLER"/brightness)" +MAX_BRIGHTNESS="$(cat "$HANDLER"/max_brightness)" +SUM=$((OLD_BRIGHTNESS + BRIGHTNESS_DIFF)) +NEW_BRIGHTNESS="$(clamp -- "$SUM" 0 "$MAX_BRIGHTNESS")" +echo "$NEW_BRIGHTNESS" > "$HANDLER"/brightness || sudo chmod 666 "$HANDLER/brightness" -- cgit v1.2.3 From 102a21e1aa8bccf6a74f29d838dd058153e11cee Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 09:17:24 -0300 Subject: .local/bin/open: Use "cd + pwd" over "realpath" to preserve symlink in paths --- .local/bin/open | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/open b/.local/bin/open index 04a346b..df1ad56 100755 --- a/.local/bin/open +++ b/.local/bin/open @@ -93,7 +93,7 @@ for f in "$@"; do alot compose "$f" ;; *) - DIR="$(realpath -- "$(dirname -- "$0")")" + DIR="$(cd -- "$(dirname -- "$0")"; pwd)" CMD="$(without-env PATH "$DIR" -- command -v xdg-open)" "$CMD" "$f" ;; -- cgit v1.2.3 From a8b244fd3719e712591e63cb92ddf78cbf519545 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 09:17:46 -0300 Subject: .local/bin/clamp: Add working version --- .local/bin/clamp | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 .local/bin/clamp diff --git a/.local/bin/clamp b/.local/bin/clamp new file mode 100755 index 0000000..a40b823 --- /dev/null +++ b/.local/bin/clamp @@ -0,0 +1,74 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + clamp NUMBER MIN MAX + clamp -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Clamp the NUMBER between MIN and MAX. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +NUMBER="${1:-}" +MIN="${2:-}" +MAX="${3:-}" + +assert_arg "$NUMBER" 'NUMBER' +assert_arg "$MIN" 'MIN' +assert_arg "$MAX" 'MAX' + + +if [ "$MIN" -gt "$MAX" ]; then + printf 'MIN (%s) is greater then MAX (%s).\n' "$MIN" "$MAX" >&2 + exit 2 +fi + +min -- "$(max -- "$NUMBER" "$MIN")" "$MAX" -- cgit v1.2.3 From e62c2752648278b06479aba6b809db5b49488a6b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 09:22:36 -0300 Subject: .config/bash/privrc.sh: Add symlink to private repo --- .config/bash/privrc.sh | 1 + 1 file changed, 1 insertion(+) create mode 120000 .config/bash/privrc.sh diff --git a/.config/bash/privrc.sh b/.config/bash/privrc.sh new file mode 120000 index 0000000..243a4bd --- /dev/null +++ b/.config/bash/privrc.sh @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/privrc.sh \ No newline at end of file -- cgit v1.2.3 From a8bfe784554fd1ffcc022ef02edd5b0c318fd583 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 09:40:10 -0300 Subject: .config/bash/check.sh: Add initial version, with ShellCheck and "set -eu" --- .config/bash/check.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 .config/bash/check.sh diff --git a/.config/bash/check.sh b/.config/bash/check.sh new file mode 100755 index 0000000..7c12dec --- /dev/null +++ b/.config/bash/check.sh @@ -0,0 +1,57 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + check.sh + check.sh -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +shellcheck -xe 1090,1091 \ + "$XDG_CONFIG_HOME"/bash/rc \ + "$XDG_CONFIG_HOME"/bash/vcs-ps1.sh \ + "$XDG_CONFIG_HOME"/bash/check.sh \ + "$XDG_CONFIG_HOME"/bash/privrc.sh + +sh -eu ~/.profile -- cgit v1.2.3 From de8cd48d58e561b2fc43dc9a79bd406619052897 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 09:59:38 -0300 Subject: .config/newsboat/urls: Add link to private repo --- .config/newsboat/urls | 1 + 1 file changed, 1 insertion(+) create mode 120000 .config/newsboat/urls diff --git a/.config/newsboat/urls b/.config/newsboat/urls new file mode 120000 index 0000000..3c453f5 --- /dev/null +++ b/.config/newsboat/urls @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/newsboat/urls \ No newline at end of file -- cgit v1.2.3 From e598c486e317b563fb502ebc7352f71cdc003ffd Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 10:31:44 -0300 Subject: git mv .local/bin/ .usr/bin/ --- .local/bin/backup | 128 ------------------------------- .local/bin/brightness | 13 ---- .local/bin/clamp | 74 ------------------ .local/bin/color | 204 ------------------------------------------------- .local/bin/copy | 67 ---------------- .local/bin/e | 79 ------------------- .local/bin/email | 74 ------------------ .local/bin/gc | 105 ------------------------- .local/bin/grun | 102 ------------------------- .local/bin/max | 61 --------------- .local/bin/min | 61 --------------- .local/bin/mkdtemp | 24 ------ .local/bin/mkstemp | 24 ------ .local/bin/msg | 90 ---------------------- .local/bin/open | 101 ------------------------ .local/bin/pre | 72 ----------------- .local/bin/print | 151 ------------------------------------ .local/bin/qr | 58 -------------- .local/bin/rfc | 117 ---------------------------- .local/bin/tmpname | 52 ------------- .local/bin/uuid | 53 ------------- .local/bin/with-email | 84 -------------------- .local/bin/without-env | 76 ------------------ .local/bin/xdg-open | 1 - .local/bin/xmpp | 89 --------------------- .usr/bin/backup | 128 +++++++++++++++++++++++++++++++ .usr/bin/brightness | 13 ++++ .usr/bin/clamp | 74 ++++++++++++++++++ .usr/bin/color | 204 +++++++++++++++++++++++++++++++++++++++++++++++++ .usr/bin/copy | 67 ++++++++++++++++ .usr/bin/e | 79 +++++++++++++++++++ .usr/bin/email | 74 ++++++++++++++++++ .usr/bin/gc | 105 +++++++++++++++++++++++++ .usr/bin/grun | 102 +++++++++++++++++++++++++ .usr/bin/max | 61 +++++++++++++++ .usr/bin/min | 61 +++++++++++++++ .usr/bin/mkdtemp | 24 ++++++ .usr/bin/mkstemp | 24 ++++++ .usr/bin/msg | 90 ++++++++++++++++++++++ .usr/bin/open | 101 ++++++++++++++++++++++++ .usr/bin/pre | 72 +++++++++++++++++ .usr/bin/print | 151 ++++++++++++++++++++++++++++++++++++ .usr/bin/qr | 58 ++++++++++++++ .usr/bin/rfc | 117 ++++++++++++++++++++++++++++ .usr/bin/tmpname | 52 +++++++++++++ .usr/bin/uuid | 53 +++++++++++++ .usr/bin/with-email | 84 ++++++++++++++++++++ .usr/bin/without-env | 76 ++++++++++++++++++ .usr/bin/xdg-open | 1 + .usr/bin/xmpp | 89 +++++++++++++++++++++ 50 files changed, 1960 insertions(+), 1960 deletions(-) delete mode 100755 .local/bin/backup delete mode 100755 .local/bin/brightness delete mode 100755 .local/bin/clamp delete mode 100755 .local/bin/color delete mode 100755 .local/bin/copy delete mode 100755 .local/bin/e delete mode 100755 .local/bin/email delete mode 100755 .local/bin/gc delete mode 100755 .local/bin/grun delete mode 100755 .local/bin/max delete mode 100755 .local/bin/min delete mode 100755 .local/bin/mkdtemp delete mode 100755 .local/bin/mkstemp delete mode 100755 .local/bin/msg delete mode 100755 .local/bin/open delete mode 100755 .local/bin/pre delete mode 100755 .local/bin/print delete mode 100755 .local/bin/qr delete mode 100755 .local/bin/rfc delete mode 100755 .local/bin/tmpname delete mode 100755 .local/bin/uuid delete mode 100755 .local/bin/with-email delete mode 100755 .local/bin/without-env delete mode 120000 .local/bin/xdg-open delete mode 100755 .local/bin/xmpp create mode 100755 .usr/bin/backup create mode 100755 .usr/bin/brightness create mode 100755 .usr/bin/clamp create mode 100755 .usr/bin/color create mode 100755 .usr/bin/copy create mode 100755 .usr/bin/e create mode 100755 .usr/bin/email create mode 100755 .usr/bin/gc create mode 100755 .usr/bin/grun create mode 100755 .usr/bin/max create mode 100755 .usr/bin/min create mode 100755 .usr/bin/mkdtemp create mode 100755 .usr/bin/mkstemp create mode 100755 .usr/bin/msg create mode 100755 .usr/bin/open create mode 100755 .usr/bin/pre create mode 100755 .usr/bin/print create mode 100755 .usr/bin/qr create mode 100755 .usr/bin/rfc create mode 100755 .usr/bin/tmpname create mode 100755 .usr/bin/uuid create mode 100755 .usr/bin/with-email create mode 100755 .usr/bin/without-env create mode 120000 .usr/bin/xdg-open create mode 100755 .usr/bin/xmpp diff --git a/.local/bin/backup b/.local/bin/backup deleted file mode 100755 index cab37dc..0000000 --- a/.local/bin/backup +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - backup [-v] [-C COMMENT] ARCHIVE_TAG - backup -h - EOF -} - -help() { - cat <<-'EOF' - - - Options: - -v enable verbose mode, useful for - interactive sessions - -C COMMENT the comment text to be attached to the archive - -h, --help show this message - - ARCHIVE_TAG the tag used to create the new - backup (default: "cronjob") - - - The repository is expected to have been created with: - - $ borg init -e repokey-blake2 - - The following environment variables are expected to be exported: - - $BORG_PASSCOMMAND - $BORG_REPO - $BORG_REMOTE_PATH - - Password-less SSH access is required, usually done via adding - ~/.ssh/id_rsa.pub to suyin:.ssh/authorized_keys. - - - Examples: - - Run backup from cronjob: - - $ backup cronjob - - Create backup with comment, and verbose mode active: - - $ backup -vC 'The backup has a comment' my-backup - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -VERBOSE_FLAGS='' -COMMENT='' -while getopts 'vC:h' flag; do - case "$flag" in - v) - VERBOSE_FLAGS='--verbose --progress' - ;; - C) - COMMENT="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -ARCHIVE_TAG="${1:-}" -assert_arg "$ARCHIVE_TAG" 'ARCHIVE_TAG' - - -finish() { - STATUS=$? - printf '\n>>>\n>>> exit status: %s\n>>>\n\n' "$STATUS" >&2 -} -trap finish EXIT - -run() { - borg create \ - $VERBOSE_FLAGS \ - --comment "$COMMENT" \ - --exclude ~/.cache/ \ - --exclude ~/Downloads/ \ - --stats \ - --compression lzma,9 \ - "::{hostname}-{now}-$ARCHIVE_TAG" \ - ~/ - STATUS=$? - - if [ "$STATUS" = 0 ] || [ "$STATUS" = 1 ]; then - echo 'WARNING, but no ERROR.' >&2 - return 0 - else - return "$STATUS" - fi -} - -run || exit $? diff --git a/.local/bin/brightness b/.local/bin/brightness deleted file mode 100755 index 8e178ad..0000000 --- a/.local/bin/brightness +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -eu - -BRIGHTNESS_DIFF="$1" - -DEVICE="$(cat "$XDG_CONFIG_HOME"/backlight-device)" -HANDLER="/sys/class/backlight/$DEVICE" - -OLD_BRIGHTNESS="$(cat "$HANDLER"/brightness)" -MAX_BRIGHTNESS="$(cat "$HANDLER"/max_brightness)" -SUM=$((OLD_BRIGHTNESS + BRIGHTNESS_DIFF)) -NEW_BRIGHTNESS="$(clamp -- "$SUM" 0 "$MAX_BRIGHTNESS")" -echo "$NEW_BRIGHTNESS" > "$HANDLER"/brightness || sudo chmod 666 "$HANDLER/brightness" diff --git a/.local/bin/clamp b/.local/bin/clamp deleted file mode 100755 index a40b823..0000000 --- a/.local/bin/clamp +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - clamp NUMBER MIN MAX - clamp -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Clamp the NUMBER between MIN and MAX. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -NUMBER="${1:-}" -MIN="${2:-}" -MAX="${3:-}" - -assert_arg "$NUMBER" 'NUMBER' -assert_arg "$MIN" 'MIN' -assert_arg "$MAX" 'MAX' - - -if [ "$MIN" -gt "$MAX" ]; then - printf 'MIN (%s) is greater then MAX (%s).\n' "$MIN" "$MAX" >&2 - exit 2 -fi - -min -- "$(max -- "$NUMBER" "$MIN")" "$MAX" diff --git a/.local/bin/color b/.local/bin/color deleted file mode 100755 index 0597278..0000000 --- a/.local/bin/color +++ /dev/null @@ -1,204 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - color -c COLOR TEXT - color -h - EOF -} - -help() { - cat <<-'EOF' - - - Options: - -c COLOR - -h, --help show this message - - - The available colors are: - EOF - list_colors | sed 's/^/ /' -} - - -END="\033[0m" - -black() { - BLACK="\033[0;30m" - printf "${BLACK}${1}${END}" -} - -blackb() { - BLACK_B="\033[1;30m" - printf "${BLACK_B}${1}${END}" -} - -blacki() { - BLACK_I="\033[0;90m" - printf "${BLACK_I}${1}${END}" -} - -white() { - WHITE="\033[0;37m" - printf "${WHITE}${1}${END}" -} - -whiteb() { - WHITE_B="\033[1;37m" - printf "${WHITE_B}${1}${END}" -} - -red() { - RED="\033[0;31m" - printf "${RED}${1}${END}" -} - -redb() { - RED_B="\033[1;31m" - printf "${RED_B}${1}${END}" -} - -green() { - GREEN="\033[0;32m" - printf "${GREEN}${1}${END}" -} - -greenb() { - GREEN_B="\033[1;32m" - printf "${GREEN_B}${1}${END}" -} - -yellow() { - YELLOW="\033[0;33m" - printf "${YELLOW}${1}${END}" -} - -yellowb() { - YELLOW_B="\033[1;33m" - printf "${YELLOW_B}${1}${END}" -} - -blue() { - BLUE="\033[0;34m" - printf "${BLUE}${1}${END}" -} - -blueb() { - BLUE_B="\033[1;34m" - printf "${BLUE_B}${1}${END}" -} - -bluei() { - BLUE_I="\033[0;94m" - printf "${BLUE_I}${1}${END}" -} - -purple() { - PURPLE="\033[0;35m" - printf "${PURPLE}${1}${END}" -} - - -purpleb() { - PURPLE_B="\033[1;35m" - printf "${PURPLE_B}${1}${END}" -} - -lightblue() { - LIGHT_BLUE="\033[0;36m" - printf "${LIGHT_BLUE}${1}${END}" -} - -lightblueb() { - LIGHT_BLUE_B="\033[1;36m" - printf "${LIGHT_BLUE_B}${1}${END}" -} - -COLOR_LIST=' -black -blackb -white -whiteb -red -redb -green -greenb -yellow -yellowb -blue -blueb -purple -purpleb -lightblue -lightblueb -blacki -bluei -' -list_colors() { - for c in $COLOR_LIST; do - printf '%s\n' "$("$c" "$c")" - done -} - - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'c:h' flag; do - case "$flag" in - c) - EXISTS=false - for c in $COLOR_LIST; do - if [ "$OPTARG" = "$c" ]; then - EXISTS=true - break - fi - done - if [ "$EXISTS" = false ]; then - printf 'Invalid color: %s\n' "$OPTARG" >&2 - exit 2 - fi - COLOR_FN="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -TEXT="${1:-}" -assert_arg "$COLOR_FN" '-c COLOR' -assert_arg "$TEXT" 'TEXT' - - -"$COLOR_FN" "$TEXT" diff --git a/.local/bin/copy b/.local/bin/copy deleted file mode 100755 index 64e1e32..0000000 --- a/.local/bin/copy +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - copy [-n] < STDIN - copy -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -n remove newlines - -h, --help show this message - - Examples: - - Copy numbers to clipboard: - seq 10 | copy - - Copy string without newline: - echo 'with automatic newline' | copy -n - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -TRIM=false -while getopts 'nh' flag; do - case "$flag" in - n) - TRIM=true - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -if [ "$TRIM" = true ]; then - cat - | tr -d '\n' | xclip -sel clip -else - cat - | xclip -sel clip -fi diff --git a/.local/bin/e b/.local/bin/e deleted file mode 100755 index 76b4899..0000000 --- a/.local/bin/e +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - e [FILE] - e -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help - - - Flexibly run a text editor, either directly on in a pipe. - - Examples: - - Edit "file.txt": - - $ e file.txt - - Manipulate the content of a pipe midway: - - $ seq 10 | e | grep 5 - - The editor used is either $VISUAL or $EDITOR, with a fallback to - vi in case any of those variables aren't defined. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -CMD="${VISUAL:-${EDITOR:-vi}}" - -if [ ! -t 0 ]; then - F="$(mkstemp)" - cat > "$F" - exec 0&1 - exec 1>/dev/tty - $CMD "$F" - cat "$F" >&3 -else - $CMD "$@" -fi diff --git a/.local/bin/email b/.local/bin/email deleted file mode 100755 index 0a1fd15..0000000 --- a/.local/bin/email +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - mail -s SUBJECT ADDRESS... < BODY - mail -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -s SUBJECT the email subject - -h, --help show this message - - ADDRESS the email addresses to send the email to - BODY the text to be sent as the body - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 's:h' flag; do - case "$flag" in - s) - SUBJECT="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - { - printf 'Missing %s.\n' "$2" - printf '\n' - usage - } >&2 - exit 2 - fi -} - -assert_arg "${SUBJECT:-}" '-s SUBJECT' -assert_arg "${1:-}" 'ADDRESS' - -printf 'Subject: %s\n\n%s' \ - "$(echo "$SUBJECT" | tr -d '\n')" \ - "$(cat)" | - msmtpq -a euandreh "$@" diff --git a/.local/bin/gc b/.local/bin/gc deleted file mode 100755 index ec6a8f1..0000000 --- a/.local/bin/gc +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - gc - gc -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -disk() { - df -h . | - awk 'NR == 2 { printf "%s - %s/%s\n", $4, $3, $2 }' -} - - -gc_guix() { - pass show velhinho/0-andreh-password | sudo -S guix system delete-generations - guix home delete-generations - guix gc -d -} - -gc_nohup() { - find ~/ -type f -name 'nohup.out' -exec rm -vf "{}" \; -} - -gc_trash() { - yes | trash-empty -} - -gc_tmpdir() { - find /tmp/ -type f -atime +10 -exec rm -vf "{}" \; ||: -} - -gc_docker() { - if command -v docker; then - yes | docker system prune -a - docker rmi "$(docker images -a -q)" ||: - docker rm "$(docker ps -a -f status=exited -q)" ||: - docker stop "$(docker ps -a -q)" ||: - docker rm "$(docker ps -a -q)" ||: - yes | docker volume prune - yes | docker container prune - fi -} - -gc_email() { - notmuch search --output=files --exclude=false tag:killed | - xargs -I{} rm -vf "{}" -} - - -BEFORE="$(disk)" -gc_guix -gc_nohup -gc_trash -gc_tmpdir -gc_docker -gc_email -wait -AFTER="$(disk)" - -printf 'Disk space:\n' -printf ' before: %s\n' "$BEFORE" -printf ' after: %s\n' "$AFTER" diff --git a/.local/bin/grun b/.local/bin/grun deleted file mode 100755 index 5884e9e..0000000 --- a/.local/bin/grun +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - grun [-r RECIPIENT] FILENAME -- COMMAND... - grun -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -r RECIPIENT the recipient to encrypt to. Can be given - multiple for multiple recipients. - -h, --help show this message - - COMMAND A command to be executed, that accepts input - in STDIN and emits result in STDOUT, and emits - errors as non-zero return codes. - FILENAME The GPG-encrypted file to be processed. If it - doesn't exist yet, it will be created. - - Examples: - - Edit "secrets.txt.gpg" using `vipe` and the default recipient: - - $ grun secrets.txt.gpg -- vipe - - Delete lines containing "FIXME" in todos.gpg: - - $ grun -r ABC123DEF321 todos.gpg -- sed '/FIXME/d' - - If COMMAND emits a non-zero return code, the file is left - unmodified. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'rh' flag; do - case "$flag" in - r) - RECIPIENTS_FLAG="${RECIPIENTS_FLAG:-} -r $OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -FILENAME="${1:-}" -assert_arg "$FILENAME" 'FILENAME' -shift - -if [ "${1:-}" != '--' ]; then - printf 'Missing "--" separator\n\n' >&2 - usage >&2 - exit 2 -fi -shift - -assert_arg "${1:-}" 'COMMAND' - - -if [ ! -e "$FILENAME" ]; then - OUT="$(printf '' | "$@")" -else - OUT="$(gpg -dq "$FILENAME" | "$@")" -fi - -echo "$OUT" | gpg -e ${RECIPIENTS_FLAG:--r eu@euandre.org} | sponge "$FILENAME" diff --git a/.local/bin/max b/.local/bin/max deleted file mode 100755 index 84585ee..0000000 --- a/.local/bin/max +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - max NUMBER... - max -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Get the maximum number from the given values. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -if [ -z "${1:-}" ]; then - echo 0 - exit -fi - -N="$1" -for n in "$@"; do - N=$((N > n ? N : n)) -done -echo "$N" diff --git a/.local/bin/min b/.local/bin/min deleted file mode 100755 index 7868623..0000000 --- a/.local/bin/min +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - min NUMBER... - min -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Get the minimun number from the given values. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -if [ -z "${1:-}" ]; then - echo 0 - exit -fi - -N="$1" -for n in "$@"; do - N=$((N < n ? N : n)) -done -echo "$N" diff --git a/.local/bin/mkdtemp b/.local/bin/mkdtemp deleted file mode 100755 index 9c7ddd8..0000000 --- a/.local/bin/mkdtemp +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - mkstemp - mkstemp -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Create a new temporary file and echo its name back. - EOF -} - -name="$(tmpname)" -mkdir "$name" -echo "$name" diff --git a/.local/bin/mkstemp b/.local/bin/mkstemp deleted file mode 100755 index ec92c14..0000000 --- a/.local/bin/mkstemp +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - mkstemp - mkstemp -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Create a new temporary file and echo its name back. - EOF -} - -name="$(tmpname)" -touch "$name" -echo "$name" diff --git a/.local/bin/msg b/.local/bin/msg deleted file mode 100755 index f3e893e..0000000 --- a/.local/bin/msg +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - msg -X XMPP_MESSAGE -s -S SOUND_MESSAGE -m EMAIL -D DESKTOP -b - msg -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -X XMPP_MESSAGE send XMPP using the `xmpp` command - -s play ~/Desktop/medium.ogg sound - -S SOUND_MESSAGE say SOUND_MESSAGE using `speak` - -m EMAIL_SUBJECT send email with EMAIL_SUBJECT and empty body - -D DESKTOP_MESSAGE the desktop message for `notify-send` - -b print terminal bell - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -sound() { - play ~/Desktop/medium.ogg 2>/dev/null & -} - -ACTION_DONE=false -while getopts 'X:sS:m:D:bh' flag; do - case "$flag" in - X) - xmpp -m "$OPTARG" eu@euandreh.xyz - ACTION_DONE=true - ;; - s) - sound - ACTION_DONE=true - ;; - S) - echo "$OPTARG" | speak -v pt-BR - ACTION_DONE=true - ;; - m) - echo "" | email -s "$OPTARG" eu@euandre.org - ACTION_DONE=true - ;; - D) - notify-send "$OPTARG" - ACTION_DONE=true - ;; - b) - printf '\a' - ACTION_DONE=true - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done - -if [ "$ACTION_DONE" = false ]; then - sound - usage - help -fi - -wait diff --git a/.local/bin/open b/.local/bin/open deleted file mode 100755 index df1ad56..0000000 --- a/.local/bin/open +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - open FILE... - open -h -EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Examples: - - Open an HTML file on the current $BROWSER: - open index.html - - Open multiple PDF files (with zathura): - open *.pdf -EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -if [ -z "${1:-}" ]; then - usage >&2 - exit 2 -fi - -for f in "$@"; do - case "$f" in - *.ico|*.jpg|*.jpeg|*.png) - feh "$f" - ;; - https://www.youtube.com/watch*) - nohup mpv "$f" 1>&2 2>/dev/null & - ;; - *.flac|*.ogg|*.mkv|*.avi|*.mp4) - nohup mpv "$f" 1>&2 2>/dev/null & - ;; - http*|*.svg|*.html) - "$BROWSER" "$f" - ;; - gopher://*) - amfora "$f" - ;; - gemini://*) - telescope "$f" - ;; - *.pdf|*.djvu|*.ps|*.epub) - nohup zathura "$f" 1>&2 2>/dev/null & - ;; - *.txt) - less "$f" - ;; - *.midi) - timidity "$f" - ;; - mailto:*) - alot compose "$f" - ;; - *) - DIR="$(cd -- "$(dirname -- "$0")"; pwd)" - CMD="$(without-env PATH "$DIR" -- command -v xdg-open)" - "$CMD" "$f" - ;; - esac -done diff --git a/.local/bin/pre b/.local/bin/pre deleted file mode 100755 index 233ac1a..0000000 --- a/.local/bin/pre +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - pre [-c COLOR] PREFIX - pre -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -c COLOR ANSI color to be used on the prefix text - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -COLOR='' -while getopts 'c:h' flag; do - case "$flag" in - c) - COLOR="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -PREFIX="${1:-}" -assert_arg "$PREFIX" 'PREFIX' - -while read -r line; do - if [ -z "$COLOR" ]; then - printf '%s: %s\n' "$PREFIX" "$line" - else - printf '%s: %s\n' "$(color -c "$COLOR" "$PREFIX")" "$line" - fi -done diff --git a/.local/bin/print b/.local/bin/print deleted file mode 100755 index 735d8ba..0000000 --- a/.local/bin/print +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - print [-d] [-q QUALITY] [FILE...] - print -h -EOF -} - -help() { - cat <<-'EOF' - - Options: - -d print duplex/double-sided - -q QUALITY choose the print quality, either: - low, medium (default) or high. - -h, --help show this message - - Examples: - - Print the given PostScript file with default quality: - $ print f1.ps - - Print multiple PDF files with high quality: - $ print -dq high *.pdf - - Print the file from STDIN, double-sided: - $ print -d < f2.ps - - Print multiple source code files: - $ print src/*.{c,h} -EOF -} - -mkdtemp() { - name="$(echo 'mkstemp(template)' | - m4 -D template="${TMPDIR:-/tmp}/m4-tmpname.")" - rm -f "$name" - mkdir "$name" - echo "$name" -} - -n_pages() { - pdftk "$1" dump_data | awk '/NumberOfPages/ { print $2 }' -} - -main() { - if file -b "$FILE" | grep -q PostScript; then - ps2pdf "$FILE" "$NEWDIR"/in.pdf - elif file -b "$FILE" | grep -q PDF; then - cp "$FILE" "$NEWDIR"/in.pdf - else - enscript -o- "$FILE" | ps2pdf - "$NEWDIR"/in.pdf - fi - cd "$NEWDIR" - - if [ -z "$DUPLEX" ]; then - lp in.pdf - cd - > /dev/null - return - fi - - if [ "$(n_pages in.pdf)" = '1' ]; then - lp in.pdf - return - fi - - pdftk A=in.pdf cat Aodd output odd.pdf - pdftk A=in.pdf cat Aeven output even.pdf - - NODD="$(n_pages odd.pdf)" - NEVEN="$(n_pages even.pdf)" - - printf 'Printing odd pages...\n' >&2 - lp odd.pdf - printf 'Has printing finished yet? Once it does, reload the pages and hit it enter to continue. ' - read -r < /dev/tty - lp even.pdf - - if [ "$NODD" != "$NEVEN" ]; then - printf '\n' | lp - fi - - cd - > /dev/null -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -lpoptions -o PrintQuality=standard -DUPLEX= -while getopts 'dq:h' flag; do - case "$flag" in - d) - DUPLEX=1 - ;; - q) - case "$OPTARG" in - low) - lpoptions -o PrintQuality=draft - ;; - medium) - lpoptions -o PrintQuality=standard - ;; - high) - lpoptions -o PrintQuality=high - ;; - *) - echo "Bad QUALITY option: \"$OPTARG\"" >&2 - exit 2 - ;; - esac - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -NEWDIR="$(mkdtemp)" -if [ -z "${1:-}" ]; then - FILE="$NEWDIR"/STDIN - cat - > "$FILE" - main -else - for f in "$@"; do - FILE="$f" - main - done -fi diff --git a/.local/bin/qr b/.local/bin/qr deleted file mode 100755 index 4821a46..0000000 --- a/.local/bin/qr +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - qr [-s PIXEL_SIZE] - qr -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -s PIXEL_SIZE size of the pixel (default 10) - -h, --help show this help message - - Read data from STDIN and present a QR image with said data. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -PIXEL_SIZE=10 -while getopts 's:h' flag; do - case "$flag" in - s) - PIXEL_SIZE="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -cat | qrencode -s "$PIXEL_SIZE" -o- | feh - diff --git a/.local/bin/rfc b/.local/bin/rfc deleted file mode 100755 index a483595..0000000 --- a/.local/bin/rfc +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/sh -set -eu - -TARBALL_URL='https://www.rfc-editor.org/in-notes/tar/RFC-all.tar.gz' - -usage() { - cat <<-'EOF' - Usage: - rfc [-w] RFC_NUMBER - rfc -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -w Show the path to the RFC file instead of displaying - its contents. - -h, --help show this message - - Lookup the given RFC - in $XDG_DATA_HOME/doc/rfc/ (defaults to ~/.local/share), - and feed it into the $PAGER, akin to doing: - - $ $PAGER $XDG_DATA_HOME/doc/rfc/rfc$RFC_NUMBER.txt - - If the $XDG_DATA_HOME/doc/rfc/ directory doesn't exist, it tries to - create it by downloading the latest RFC tarball [0] and placing all .txt - files there. - EOF - - printf '\n[0]: %s\n' "$TARBALL_URL" -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'wh' flag; do - case "$flag" in - w) - WHERE=true - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -RFC_NUMBER="${1:-}" -if [ -z "$RFC_NUMBER" ]; then - echo 'Missing argument RFC_NUMBER' >&2 - usage >&2 - exit 2 -fi - -D="${XDG_DATA_HOME:-$HOME/.local/share}/doc/rfc" -if [ ! -e "$D" ]; then - printf 'RFC directory does not exist:\n\t%s/\n\n' "$D" - printf 'Do you want to download the files to create it? [Y/n] ' - read -r yesno - if [ "$yesno" != 'n' ] && [ "$yesno" != 'N' ]; then - CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/rfc-cli" - mkdir -p "$CACHE_DIR" - wget -cO "$CACHE_DIR"/RFC-all.tar.gz "$TARBALL_URL" - rm -rf "$CACHE_DIR/tmp" - mkdir -p "$CACHE_DIR/tmp" - tar \ - -C "$CACHE_DIR/tmp" \ - -xvf "$CACHE_DIR"/RFC-all.tar.gz \ - --wildcards \ - 'rfc*.txt' - mkdir -p "$(dirname "$D")" - mv "$CACHE_DIR/tmp" "$D" - fi -fi - -F="$D/rfc${RFC_NUMBER}.txt" -if [ ! -e "$F" ]; then - printf 'Given RFC_NUMBER "%s" does not exist at:\n%s\n' \ - "$RFC_NUMBER" "$F" >&2 - exit 2 -fi - -if [ "${WHERE:-}" = true ]; then - printf '%s\n' "$F" - exit -fi - -view() { - if [ -t 1 ]; then - ${PAGER:-cat} - else - cat - fi -} - -view < "$F" diff --git a/.local/bin/tmpname b/.local/bin/tmpname deleted file mode 100755 index d83fc87..0000000 --- a/.local/bin/tmpname +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - tmpname - tmpname -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Generate a temporary name. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -echo "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)" diff --git a/.local/bin/uuid b/.local/bin/uuid deleted file mode 100755 index 74d0fba..0000000 --- a/.local/bin/uuid +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - uuid - uuid -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Generate UUID from /dev/random. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -od -xN20 /dev/random | - awk 'NR == 1 { OFS="-"; print $2$3,$4,$5,$6,$7$8$9; exit }' diff --git a/.local/bin/with-email b/.local/bin/with-email deleted file mode 100755 index 9d6326b..0000000 --- a/.local/bin/with-email +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - with-email [-s SUBJECT] COMMAND... - with-email -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -s SUBJECT set the subject of the email - -h, --help show this message - - COMMAND the command to be wrapped - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -SUBJECT='NO SUBJECT' -while getopts 's:h' flag; do - case "$flag" in - s) - SUBJECT="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -assert_arg "${1:-}" 'COMMAND...' - -now() { - date '+%Y-%m-%dT%H:%M:%S%Z' -} - -OUT="$(mkstemp)" -{ - printf 'Running command: %s\n' "$*" - printf 'Starting at: %s\n' "$(now)" - printf '\n' - - STATUS=0 - "$@" 2>&1 || STATUS=$? - - printf '\n' - printf '\nFinished at: %s\n' "$(now)" -} 2>&1 1>"$OUT" - -email -s "(exit status: $STATUS) - $SUBJECT" eu@euandre.org < "$OUT" diff --git a/.local/bin/without-env b/.local/bin/without-env deleted file mode 100755 index 45c41ca..0000000 --- a/.local/bin/without-env +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - without-env ENVVAR PATH -- COMMAND... - without-env [-h] - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Examples: - - Execute "command -V" filtering ~/bin, to get where "w3m" is - in $PATH, other than ~/bin: - $ without-env PATH ~/bin -- command -v w3m - - Compile foo.c, excluding ~/.local/include - from $C_INCLUDE_PATH: - $ without-env C_INCLUDE_PATH ~/.local/include -- cc -co foo.o foo.c - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n' "$2" >&2 - exit 2 - fi -} - -assert_arg "${1:-}" 'ENVVAR' -assert_arg "${2:-}" 'PATH' -assert_arg "${3:-}" '--' - -eval "export $1=\"\$(echo \"\$$1\" | sed \"s|\$2:||g\")\"" -shift # drop $1 -shift # drop $2 -shift # drop -- - -"$@" diff --git a/.local/bin/xdg-open b/.local/bin/xdg-open deleted file mode 120000 index ce4a72b..0000000 --- a/.local/bin/xdg-open +++ /dev/null @@ -1 +0,0 @@ -open \ No newline at end of file diff --git a/.local/bin/xmpp b/.local/bin/xmpp deleted file mode 100755 index 472e9ca..0000000 --- a/.local/bin/xmpp +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import getopt -import logging -import slixmpp - -USAGE = """\ -Usage: - xmpp [-d] [-F FROM_JID] -m MESSAGE TO_JID... - xmpp -h""" - -HELP = """ -Options: - -d run in DEBUG mode - -m MESSAGE the text of the message to be sent - -h, --help show this message - - FROM_JID the address used to send the message from - TO_JID the addresses where to send the message to""" - -class SendMsgBot(slixmpp.ClientXMPP): - def __init__(self, jid, password, on_start): - slixmpp.ClientXMPP.__init__(self, jid, password) - - self.on_start = on_start - self.add_event_handler("session_start", self.start) - - def start(self, event): - self.on_start(self) - self.disconnect(wait=True) - -def main(): - logging.basicConfig(level=logging.INFO) - from_ = "bot@euandreh.xyz" - message = "" - - for s in sys.argv: - if s == "--": - break - elif s == "--help": - print(USAGE) - print(HELP) - sys.exit() - - try: - opts, args = getopt.getopt(sys.argv[1:], 'm:F:dh') - except getopt.GetoptError as err: - print(err, file=sys.stderr) - print(USAGE, file=sys.stderr) - sys.exit(2) - for o, a in opts: - if o == "-m": - message = a - elif o == "-F": - from_ = a - elif o == "-d": - logging.basicConfig(level=logging.DEBUG) - elif o == "-h": - print(USAGE) - print(HELP) - sys.exit() - else: - assert False, "unhandled option" - - if message == "": - print("Missing -m MESSAGE", file=sys.stderr) - print(USAGE, file=sys.stderr) - sys.exit(2) - - if args == []: - print("Missing TO_JID", file=sys.stderr) - print(USAGE, file=sys.stderr) - sys.exit(2) - - passcmd = "pass show VPS/kuvira/XMPP/" + from_ + " | head -n1 | tr -d '\\n'" - password = os.popen(passcmd).read() - - def on_start(self): - for to in args: - self.send_message(mto=to, mbody=message, mtype='chat') - - xmpp = SendMsgBot(from_, password, on_start) - xmpp.connect() - xmpp.process(forever=False) - -if __name__ == "__main__": - main() diff --git a/.usr/bin/backup b/.usr/bin/backup new file mode 100755 index 0000000..cab37dc --- /dev/null +++ b/.usr/bin/backup @@ -0,0 +1,128 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + backup [-v] [-C COMMENT] ARCHIVE_TAG + backup -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -v enable verbose mode, useful for + interactive sessions + -C COMMENT the comment text to be attached to the archive + -h, --help show this message + + ARCHIVE_TAG the tag used to create the new + backup (default: "cronjob") + + + The repository is expected to have been created with: + + $ borg init -e repokey-blake2 + + The following environment variables are expected to be exported: + + $BORG_PASSCOMMAND + $BORG_REPO + $BORG_REMOTE_PATH + + Password-less SSH access is required, usually done via adding + ~/.ssh/id_rsa.pub to suyin:.ssh/authorized_keys. + + + Examples: + + Run backup from cronjob: + + $ backup cronjob + + Create backup with comment, and verbose mode active: + + $ backup -vC 'The backup has a comment' my-backup + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +VERBOSE_FLAGS='' +COMMENT='' +while getopts 'vC:h' flag; do + case "$flag" in + v) + VERBOSE_FLAGS='--verbose --progress' + ;; + C) + COMMENT="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +ARCHIVE_TAG="${1:-}" +assert_arg "$ARCHIVE_TAG" 'ARCHIVE_TAG' + + +finish() { + STATUS=$? + printf '\n>>>\n>>> exit status: %s\n>>>\n\n' "$STATUS" >&2 +} +trap finish EXIT + +run() { + borg create \ + $VERBOSE_FLAGS \ + --comment "$COMMENT" \ + --exclude ~/.cache/ \ + --exclude ~/Downloads/ \ + --stats \ + --compression lzma,9 \ + "::{hostname}-{now}-$ARCHIVE_TAG" \ + ~/ + STATUS=$? + + if [ "$STATUS" = 0 ] || [ "$STATUS" = 1 ]; then + echo 'WARNING, but no ERROR.' >&2 + return 0 + else + return "$STATUS" + fi +} + +run || exit $? diff --git a/.usr/bin/brightness b/.usr/bin/brightness new file mode 100755 index 0000000..8e178ad --- /dev/null +++ b/.usr/bin/brightness @@ -0,0 +1,13 @@ +#!/bin/sh +set -eu + +BRIGHTNESS_DIFF="$1" + +DEVICE="$(cat "$XDG_CONFIG_HOME"/backlight-device)" +HANDLER="/sys/class/backlight/$DEVICE" + +OLD_BRIGHTNESS="$(cat "$HANDLER"/brightness)" +MAX_BRIGHTNESS="$(cat "$HANDLER"/max_brightness)" +SUM=$((OLD_BRIGHTNESS + BRIGHTNESS_DIFF)) +NEW_BRIGHTNESS="$(clamp -- "$SUM" 0 "$MAX_BRIGHTNESS")" +echo "$NEW_BRIGHTNESS" > "$HANDLER"/brightness || sudo chmod 666 "$HANDLER/brightness" diff --git a/.usr/bin/clamp b/.usr/bin/clamp new file mode 100755 index 0000000..a40b823 --- /dev/null +++ b/.usr/bin/clamp @@ -0,0 +1,74 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + clamp NUMBER MIN MAX + clamp -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Clamp the NUMBER between MIN and MAX. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +NUMBER="${1:-}" +MIN="${2:-}" +MAX="${3:-}" + +assert_arg "$NUMBER" 'NUMBER' +assert_arg "$MIN" 'MIN' +assert_arg "$MAX" 'MAX' + + +if [ "$MIN" -gt "$MAX" ]; then + printf 'MIN (%s) is greater then MAX (%s).\n' "$MIN" "$MAX" >&2 + exit 2 +fi + +min -- "$(max -- "$NUMBER" "$MIN")" "$MAX" diff --git a/.usr/bin/color b/.usr/bin/color new file mode 100755 index 0000000..0597278 --- /dev/null +++ b/.usr/bin/color @@ -0,0 +1,204 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + color -c COLOR TEXT + color -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -c COLOR + -h, --help show this message + + + The available colors are: + EOF + list_colors | sed 's/^/ /' +} + + +END="\033[0m" + +black() { + BLACK="\033[0;30m" + printf "${BLACK}${1}${END}" +} + +blackb() { + BLACK_B="\033[1;30m" + printf "${BLACK_B}${1}${END}" +} + +blacki() { + BLACK_I="\033[0;90m" + printf "${BLACK_I}${1}${END}" +} + +white() { + WHITE="\033[0;37m" + printf "${WHITE}${1}${END}" +} + +whiteb() { + WHITE_B="\033[1;37m" + printf "${WHITE_B}${1}${END}" +} + +red() { + RED="\033[0;31m" + printf "${RED}${1}${END}" +} + +redb() { + RED_B="\033[1;31m" + printf "${RED_B}${1}${END}" +} + +green() { + GREEN="\033[0;32m" + printf "${GREEN}${1}${END}" +} + +greenb() { + GREEN_B="\033[1;32m" + printf "${GREEN_B}${1}${END}" +} + +yellow() { + YELLOW="\033[0;33m" + printf "${YELLOW}${1}${END}" +} + +yellowb() { + YELLOW_B="\033[1;33m" + printf "${YELLOW_B}${1}${END}" +} + +blue() { + BLUE="\033[0;34m" + printf "${BLUE}${1}${END}" +} + +blueb() { + BLUE_B="\033[1;34m" + printf "${BLUE_B}${1}${END}" +} + +bluei() { + BLUE_I="\033[0;94m" + printf "${BLUE_I}${1}${END}" +} + +purple() { + PURPLE="\033[0;35m" + printf "${PURPLE}${1}${END}" +} + + +purpleb() { + PURPLE_B="\033[1;35m" + printf "${PURPLE_B}${1}${END}" +} + +lightblue() { + LIGHT_BLUE="\033[0;36m" + printf "${LIGHT_BLUE}${1}${END}" +} + +lightblueb() { + LIGHT_BLUE_B="\033[1;36m" + printf "${LIGHT_BLUE_B}${1}${END}" +} + +COLOR_LIST=' +black +blackb +white +whiteb +red +redb +green +greenb +yellow +yellowb +blue +blueb +purple +purpleb +lightblue +lightblueb +blacki +bluei +' +list_colors() { + for c in $COLOR_LIST; do + printf '%s\n' "$("$c" "$c")" + done +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'c:h' flag; do + case "$flag" in + c) + EXISTS=false + for c in $COLOR_LIST; do + if [ "$OPTARG" = "$c" ]; then + EXISTS=true + break + fi + done + if [ "$EXISTS" = false ]; then + printf 'Invalid color: %s\n' "$OPTARG" >&2 + exit 2 + fi + COLOR_FN="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +TEXT="${1:-}" +assert_arg "$COLOR_FN" '-c COLOR' +assert_arg "$TEXT" 'TEXT' + + +"$COLOR_FN" "$TEXT" diff --git a/.usr/bin/copy b/.usr/bin/copy new file mode 100755 index 0000000..64e1e32 --- /dev/null +++ b/.usr/bin/copy @@ -0,0 +1,67 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + copy [-n] < STDIN + copy -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -n remove newlines + -h, --help show this message + + Examples: + + Copy numbers to clipboard: + seq 10 | copy + + Copy string without newline: + echo 'with automatic newline' | copy -n + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +TRIM=false +while getopts 'nh' flag; do + case "$flag" in + n) + TRIM=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ "$TRIM" = true ]; then + cat - | tr -d '\n' | xclip -sel clip +else + cat - | xclip -sel clip +fi diff --git a/.usr/bin/e b/.usr/bin/e new file mode 100755 index 0000000..76b4899 --- /dev/null +++ b/.usr/bin/e @@ -0,0 +1,79 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + e [FILE] + e -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help + + + Flexibly run a text editor, either directly on in a pipe. + + Examples: + + Edit "file.txt": + + $ e file.txt + + Manipulate the content of a pipe midway: + + $ seq 10 | e | grep 5 + + The editor used is either $VISUAL or $EDITOR, with a fallback to + vi in case any of those variables aren't defined. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +CMD="${VISUAL:-${EDITOR:-vi}}" + +if [ ! -t 0 ]; then + F="$(mkstemp)" + cat > "$F" + exec 0&1 + exec 1>/dev/tty + $CMD "$F" + cat "$F" >&3 +else + $CMD "$@" +fi diff --git a/.usr/bin/email b/.usr/bin/email new file mode 100755 index 0000000..0a1fd15 --- /dev/null +++ b/.usr/bin/email @@ -0,0 +1,74 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + mail -s SUBJECT ADDRESS... < BODY + mail -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -s SUBJECT the email subject + -h, --help show this message + + ADDRESS the email addresses to send the email to + BODY the text to be sent as the body + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 's:h' flag; do + case "$flag" in + s) + SUBJECT="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + { + printf 'Missing %s.\n' "$2" + printf '\n' + usage + } >&2 + exit 2 + fi +} + +assert_arg "${SUBJECT:-}" '-s SUBJECT' +assert_arg "${1:-}" 'ADDRESS' + +printf 'Subject: %s\n\n%s' \ + "$(echo "$SUBJECT" | tr -d '\n')" \ + "$(cat)" | + msmtpq -a euandreh "$@" diff --git a/.usr/bin/gc b/.usr/bin/gc new file mode 100755 index 0000000..ec6a8f1 --- /dev/null +++ b/.usr/bin/gc @@ -0,0 +1,105 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + gc + gc -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +disk() { + df -h . | + awk 'NR == 2 { printf "%s - %s/%s\n", $4, $3, $2 }' +} + + +gc_guix() { + pass show velhinho/0-andreh-password | sudo -S guix system delete-generations + guix home delete-generations + guix gc -d +} + +gc_nohup() { + find ~/ -type f -name 'nohup.out' -exec rm -vf "{}" \; +} + +gc_trash() { + yes | trash-empty +} + +gc_tmpdir() { + find /tmp/ -type f -atime +10 -exec rm -vf "{}" \; ||: +} + +gc_docker() { + if command -v docker; then + yes | docker system prune -a + docker rmi "$(docker images -a -q)" ||: + docker rm "$(docker ps -a -f status=exited -q)" ||: + docker stop "$(docker ps -a -q)" ||: + docker rm "$(docker ps -a -q)" ||: + yes | docker volume prune + yes | docker container prune + fi +} + +gc_email() { + notmuch search --output=files --exclude=false tag:killed | + xargs -I{} rm -vf "{}" +} + + +BEFORE="$(disk)" +gc_guix +gc_nohup +gc_trash +gc_tmpdir +gc_docker +gc_email +wait +AFTER="$(disk)" + +printf 'Disk space:\n' +printf ' before: %s\n' "$BEFORE" +printf ' after: %s\n' "$AFTER" diff --git a/.usr/bin/grun b/.usr/bin/grun new file mode 100755 index 0000000..5884e9e --- /dev/null +++ b/.usr/bin/grun @@ -0,0 +1,102 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + grun [-r RECIPIENT] FILENAME -- COMMAND... + grun -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -r RECIPIENT the recipient to encrypt to. Can be given + multiple for multiple recipients. + -h, --help show this message + + COMMAND A command to be executed, that accepts input + in STDIN and emits result in STDOUT, and emits + errors as non-zero return codes. + FILENAME The GPG-encrypted file to be processed. If it + doesn't exist yet, it will be created. + + Examples: + + Edit "secrets.txt.gpg" using `vipe` and the default recipient: + + $ grun secrets.txt.gpg -- vipe + + Delete lines containing "FIXME" in todos.gpg: + + $ grun -r ABC123DEF321 todos.gpg -- sed '/FIXME/d' + + If COMMAND emits a non-zero return code, the file is left + unmodified. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'rh' flag; do + case "$flag" in + r) + RECIPIENTS_FLAG="${RECIPIENTS_FLAG:-} -r $OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +FILENAME="${1:-}" +assert_arg "$FILENAME" 'FILENAME' +shift + +if [ "${1:-}" != '--' ]; then + printf 'Missing "--" separator\n\n' >&2 + usage >&2 + exit 2 +fi +shift + +assert_arg "${1:-}" 'COMMAND' + + +if [ ! -e "$FILENAME" ]; then + OUT="$(printf '' | "$@")" +else + OUT="$(gpg -dq "$FILENAME" | "$@")" +fi + +echo "$OUT" | gpg -e ${RECIPIENTS_FLAG:--r eu@euandre.org} | sponge "$FILENAME" diff --git a/.usr/bin/max b/.usr/bin/max new file mode 100755 index 0000000..84585ee --- /dev/null +++ b/.usr/bin/max @@ -0,0 +1,61 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + max NUMBER... + max -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Get the maximum number from the given values. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ -z "${1:-}" ]; then + echo 0 + exit +fi + +N="$1" +for n in "$@"; do + N=$((N > n ? N : n)) +done +echo "$N" diff --git a/.usr/bin/min b/.usr/bin/min new file mode 100755 index 0000000..7868623 --- /dev/null +++ b/.usr/bin/min @@ -0,0 +1,61 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + min NUMBER... + min -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Get the minimun number from the given values. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ -z "${1:-}" ]; then + echo 0 + exit +fi + +N="$1" +for n in "$@"; do + N=$((N < n ? N : n)) +done +echo "$N" diff --git a/.usr/bin/mkdtemp b/.usr/bin/mkdtemp new file mode 100755 index 0000000..9c7ddd8 --- /dev/null +++ b/.usr/bin/mkdtemp @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + mkstemp + mkstemp -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Create a new temporary file and echo its name back. + EOF +} + +name="$(tmpname)" +mkdir "$name" +echo "$name" diff --git a/.usr/bin/mkstemp b/.usr/bin/mkstemp new file mode 100755 index 0000000..ec92c14 --- /dev/null +++ b/.usr/bin/mkstemp @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + mkstemp + mkstemp -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Create a new temporary file and echo its name back. + EOF +} + +name="$(tmpname)" +touch "$name" +echo "$name" diff --git a/.usr/bin/msg b/.usr/bin/msg new file mode 100755 index 0000000..f3e893e --- /dev/null +++ b/.usr/bin/msg @@ -0,0 +1,90 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + msg -X XMPP_MESSAGE -s -S SOUND_MESSAGE -m EMAIL -D DESKTOP -b + msg -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -X XMPP_MESSAGE send XMPP using the `xmpp` command + -s play ~/Desktop/medium.ogg sound + -S SOUND_MESSAGE say SOUND_MESSAGE using `speak` + -m EMAIL_SUBJECT send email with EMAIL_SUBJECT and empty body + -D DESKTOP_MESSAGE the desktop message for `notify-send` + -b print terminal bell + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +sound() { + play ~/Desktop/medium.ogg 2>/dev/null & +} + +ACTION_DONE=false +while getopts 'X:sS:m:D:bh' flag; do + case "$flag" in + X) + xmpp -m "$OPTARG" eu@euandreh.xyz + ACTION_DONE=true + ;; + s) + sound + ACTION_DONE=true + ;; + S) + echo "$OPTARG" | speak -v pt-BR + ACTION_DONE=true + ;; + m) + echo "" | email -s "$OPTARG" eu@euandre.org + ACTION_DONE=true + ;; + D) + notify-send "$OPTARG" + ACTION_DONE=true + ;; + b) + printf '\a' + ACTION_DONE=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done + +if [ "$ACTION_DONE" = false ]; then + sound + usage + help +fi + +wait diff --git a/.usr/bin/open b/.usr/bin/open new file mode 100755 index 0000000..df1ad56 --- /dev/null +++ b/.usr/bin/open @@ -0,0 +1,101 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + open FILE... + open -h +EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Examples: + + Open an HTML file on the current $BROWSER: + open index.html + + Open multiple PDF files (with zathura): + open *.pdf +EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ -z "${1:-}" ]; then + usage >&2 + exit 2 +fi + +for f in "$@"; do + case "$f" in + *.ico|*.jpg|*.jpeg|*.png) + feh "$f" + ;; + https://www.youtube.com/watch*) + nohup mpv "$f" 1>&2 2>/dev/null & + ;; + *.flac|*.ogg|*.mkv|*.avi|*.mp4) + nohup mpv "$f" 1>&2 2>/dev/null & + ;; + http*|*.svg|*.html) + "$BROWSER" "$f" + ;; + gopher://*) + amfora "$f" + ;; + gemini://*) + telescope "$f" + ;; + *.pdf|*.djvu|*.ps|*.epub) + nohup zathura "$f" 1>&2 2>/dev/null & + ;; + *.txt) + less "$f" + ;; + *.midi) + timidity "$f" + ;; + mailto:*) + alot compose "$f" + ;; + *) + DIR="$(cd -- "$(dirname -- "$0")"; pwd)" + CMD="$(without-env PATH "$DIR" -- command -v xdg-open)" + "$CMD" "$f" + ;; + esac +done diff --git a/.usr/bin/pre b/.usr/bin/pre new file mode 100755 index 0000000..233ac1a --- /dev/null +++ b/.usr/bin/pre @@ -0,0 +1,72 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + pre [-c COLOR] PREFIX + pre -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -c COLOR ANSI color to be used on the prefix text + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +COLOR='' +while getopts 'c:h' flag; do + case "$flag" in + c) + COLOR="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +PREFIX="${1:-}" +assert_arg "$PREFIX" 'PREFIX' + +while read -r line; do + if [ -z "$COLOR" ]; then + printf '%s: %s\n' "$PREFIX" "$line" + else + printf '%s: %s\n' "$(color -c "$COLOR" "$PREFIX")" "$line" + fi +done diff --git a/.usr/bin/print b/.usr/bin/print new file mode 100755 index 0000000..735d8ba --- /dev/null +++ b/.usr/bin/print @@ -0,0 +1,151 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + print [-d] [-q QUALITY] [FILE...] + print -h +EOF +} + +help() { + cat <<-'EOF' + + Options: + -d print duplex/double-sided + -q QUALITY choose the print quality, either: + low, medium (default) or high. + -h, --help show this message + + Examples: + + Print the given PostScript file with default quality: + $ print f1.ps + + Print multiple PDF files with high quality: + $ print -dq high *.pdf + + Print the file from STDIN, double-sided: + $ print -d < f2.ps + + Print multiple source code files: + $ print src/*.{c,h} +EOF +} + +mkdtemp() { + name="$(echo 'mkstemp(template)' | + m4 -D template="${TMPDIR:-/tmp}/m4-tmpname.")" + rm -f "$name" + mkdir "$name" + echo "$name" +} + +n_pages() { + pdftk "$1" dump_data | awk '/NumberOfPages/ { print $2 }' +} + +main() { + if file -b "$FILE" | grep -q PostScript; then + ps2pdf "$FILE" "$NEWDIR"/in.pdf + elif file -b "$FILE" | grep -q PDF; then + cp "$FILE" "$NEWDIR"/in.pdf + else + enscript -o- "$FILE" | ps2pdf - "$NEWDIR"/in.pdf + fi + cd "$NEWDIR" + + if [ -z "$DUPLEX" ]; then + lp in.pdf + cd - > /dev/null + return + fi + + if [ "$(n_pages in.pdf)" = '1' ]; then + lp in.pdf + return + fi + + pdftk A=in.pdf cat Aodd output odd.pdf + pdftk A=in.pdf cat Aeven output even.pdf + + NODD="$(n_pages odd.pdf)" + NEVEN="$(n_pages even.pdf)" + + printf 'Printing odd pages...\n' >&2 + lp odd.pdf + printf 'Has printing finished yet? Once it does, reload the pages and hit it enter to continue. ' + read -r < /dev/tty + lp even.pdf + + if [ "$NODD" != "$NEVEN" ]; then + printf '\n' | lp + fi + + cd - > /dev/null +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +lpoptions -o PrintQuality=standard +DUPLEX= +while getopts 'dq:h' flag; do + case "$flag" in + d) + DUPLEX=1 + ;; + q) + case "$OPTARG" in + low) + lpoptions -o PrintQuality=draft + ;; + medium) + lpoptions -o PrintQuality=standard + ;; + high) + lpoptions -o PrintQuality=high + ;; + *) + echo "Bad QUALITY option: \"$OPTARG\"" >&2 + exit 2 + ;; + esac + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +NEWDIR="$(mkdtemp)" +if [ -z "${1:-}" ]; then + FILE="$NEWDIR"/STDIN + cat - > "$FILE" + main +else + for f in "$@"; do + FILE="$f" + main + done +fi diff --git a/.usr/bin/qr b/.usr/bin/qr new file mode 100755 index 0000000..4821a46 --- /dev/null +++ b/.usr/bin/qr @@ -0,0 +1,58 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + qr [-s PIXEL_SIZE] + qr -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -s PIXEL_SIZE size of the pixel (default 10) + -h, --help show this help message + + Read data from STDIN and present a QR image with said data. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +PIXEL_SIZE=10 +while getopts 's:h' flag; do + case "$flag" in + s) + PIXEL_SIZE="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +cat | qrencode -s "$PIXEL_SIZE" -o- | feh - diff --git a/.usr/bin/rfc b/.usr/bin/rfc new file mode 100755 index 0000000..a483595 --- /dev/null +++ b/.usr/bin/rfc @@ -0,0 +1,117 @@ +#!/bin/sh +set -eu + +TARBALL_URL='https://www.rfc-editor.org/in-notes/tar/RFC-all.tar.gz' + +usage() { + cat <<-'EOF' + Usage: + rfc [-w] RFC_NUMBER + rfc -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -w Show the path to the RFC file instead of displaying + its contents. + -h, --help show this message + + Lookup the given RFC + in $XDG_DATA_HOME/doc/rfc/ (defaults to ~/.local/share), + and feed it into the $PAGER, akin to doing: + + $ $PAGER $XDG_DATA_HOME/doc/rfc/rfc$RFC_NUMBER.txt + + If the $XDG_DATA_HOME/doc/rfc/ directory doesn't exist, it tries to + create it by downloading the latest RFC tarball [0] and placing all .txt + files there. + EOF + + printf '\n[0]: %s\n' "$TARBALL_URL" +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'wh' flag; do + case "$flag" in + w) + WHERE=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +RFC_NUMBER="${1:-}" +if [ -z "$RFC_NUMBER" ]; then + echo 'Missing argument RFC_NUMBER' >&2 + usage >&2 + exit 2 +fi + +D="${XDG_DATA_HOME:-$HOME/.local/share}/doc/rfc" +if [ ! -e "$D" ]; then + printf 'RFC directory does not exist:\n\t%s/\n\n' "$D" + printf 'Do you want to download the files to create it? [Y/n] ' + read -r yesno + if [ "$yesno" != 'n' ] && [ "$yesno" != 'N' ]; then + CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/rfc-cli" + mkdir -p "$CACHE_DIR" + wget -cO "$CACHE_DIR"/RFC-all.tar.gz "$TARBALL_URL" + rm -rf "$CACHE_DIR/tmp" + mkdir -p "$CACHE_DIR/tmp" + tar \ + -C "$CACHE_DIR/tmp" \ + -xvf "$CACHE_DIR"/RFC-all.tar.gz \ + --wildcards \ + 'rfc*.txt' + mkdir -p "$(dirname "$D")" + mv "$CACHE_DIR/tmp" "$D" + fi +fi + +F="$D/rfc${RFC_NUMBER}.txt" +if [ ! -e "$F" ]; then + printf 'Given RFC_NUMBER "%s" does not exist at:\n%s\n' \ + "$RFC_NUMBER" "$F" >&2 + exit 2 +fi + +if [ "${WHERE:-}" = true ]; then + printf '%s\n' "$F" + exit +fi + +view() { + if [ -t 1 ]; then + ${PAGER:-cat} + else + cat + fi +} + +view < "$F" diff --git a/.usr/bin/tmpname b/.usr/bin/tmpname new file mode 100755 index 0000000..d83fc87 --- /dev/null +++ b/.usr/bin/tmpname @@ -0,0 +1,52 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + tmpname + tmpname -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Generate a temporary name. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +echo "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)" diff --git a/.usr/bin/uuid b/.usr/bin/uuid new file mode 100755 index 0000000..74d0fba --- /dev/null +++ b/.usr/bin/uuid @@ -0,0 +1,53 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + uuid + uuid -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Generate UUID from /dev/random. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +od -xN20 /dev/random | + awk 'NR == 1 { OFS="-"; print $2$3,$4,$5,$6,$7$8$9; exit }' diff --git a/.usr/bin/with-email b/.usr/bin/with-email new file mode 100755 index 0000000..9d6326b --- /dev/null +++ b/.usr/bin/with-email @@ -0,0 +1,84 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + with-email [-s SUBJECT] COMMAND... + with-email -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -s SUBJECT set the subject of the email + -h, --help show this message + + COMMAND the command to be wrapped + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +SUBJECT='NO SUBJECT' +while getopts 's:h' flag; do + case "$flag" in + s) + SUBJECT="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +assert_arg "${1:-}" 'COMMAND...' + +now() { + date '+%Y-%m-%dT%H:%M:%S%Z' +} + +OUT="$(mkstemp)" +{ + printf 'Running command: %s\n' "$*" + printf 'Starting at: %s\n' "$(now)" + printf '\n' + + STATUS=0 + "$@" 2>&1 || STATUS=$? + + printf '\n' + printf '\nFinished at: %s\n' "$(now)" +} 2>&1 1>"$OUT" + +email -s "(exit status: $STATUS) - $SUBJECT" eu@euandre.org < "$OUT" diff --git a/.usr/bin/without-env b/.usr/bin/without-env new file mode 100755 index 0000000..45c41ca --- /dev/null +++ b/.usr/bin/without-env @@ -0,0 +1,76 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + without-env ENVVAR PATH -- COMMAND... + without-env [-h] + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Examples: + + Execute "command -V" filtering ~/bin, to get where "w3m" is + in $PATH, other than ~/bin: + $ without-env PATH ~/bin -- command -v w3m + + Compile foo.c, excluding ~/.local/include + from $C_INCLUDE_PATH: + $ without-env C_INCLUDE_PATH ~/.local/include -- cc -co foo.o foo.c + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n' "$2" >&2 + exit 2 + fi +} + +assert_arg "${1:-}" 'ENVVAR' +assert_arg "${2:-}" 'PATH' +assert_arg "${3:-}" '--' + +eval "export $1=\"\$(echo \"\$$1\" | sed \"s|\$2:||g\")\"" +shift # drop $1 +shift # drop $2 +shift # drop -- + +"$@" diff --git a/.usr/bin/xdg-open b/.usr/bin/xdg-open new file mode 120000 index 0000000..ce4a72b --- /dev/null +++ b/.usr/bin/xdg-open @@ -0,0 +1 @@ +open \ No newline at end of file diff --git a/.usr/bin/xmpp b/.usr/bin/xmpp new file mode 100755 index 0000000..472e9ca --- /dev/null +++ b/.usr/bin/xmpp @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 + +import os +import sys +import getopt +import logging +import slixmpp + +USAGE = """\ +Usage: + xmpp [-d] [-F FROM_JID] -m MESSAGE TO_JID... + xmpp -h""" + +HELP = """ +Options: + -d run in DEBUG mode + -m MESSAGE the text of the message to be sent + -h, --help show this message + + FROM_JID the address used to send the message from + TO_JID the addresses where to send the message to""" + +class SendMsgBot(slixmpp.ClientXMPP): + def __init__(self, jid, password, on_start): + slixmpp.ClientXMPP.__init__(self, jid, password) + + self.on_start = on_start + self.add_event_handler("session_start", self.start) + + def start(self, event): + self.on_start(self) + self.disconnect(wait=True) + +def main(): + logging.basicConfig(level=logging.INFO) + from_ = "bot@euandreh.xyz" + message = "" + + for s in sys.argv: + if s == "--": + break + elif s == "--help": + print(USAGE) + print(HELP) + sys.exit() + + try: + opts, args = getopt.getopt(sys.argv[1:], 'm:F:dh') + except getopt.GetoptError as err: + print(err, file=sys.stderr) + print(USAGE, file=sys.stderr) + sys.exit(2) + for o, a in opts: + if o == "-m": + message = a + elif o == "-F": + from_ = a + elif o == "-d": + logging.basicConfig(level=logging.DEBUG) + elif o == "-h": + print(USAGE) + print(HELP) + sys.exit() + else: + assert False, "unhandled option" + + if message == "": + print("Missing -m MESSAGE", file=sys.stderr) + print(USAGE, file=sys.stderr) + sys.exit(2) + + if args == []: + print("Missing TO_JID", file=sys.stderr) + print(USAGE, file=sys.stderr) + sys.exit(2) + + passcmd = "pass show VPS/kuvira/XMPP/" + from_ + " | head -n1 | tr -d '\\n'" + password = os.popen(passcmd).read() + + def on_start(self): + for to in args: + self.send_message(mto=to, mbody=message, mtype='chat') + + xmpp = SendMsgBot(from_, password, on_start) + xmpp.connect() + xmpp.process(forever=False) + +if __name__ == "__main__": + main() -- cgit v1.2.3 From ac86f15ca8ff0c15f4bb7df0a46cabdd166a6e59 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 10:36:37 -0300 Subject: git mv .config .usr/etc --- .config/afew/config | 6 -- .config/alot/config | 1 - .config/bash/check.sh | 57 --------------- .config/bash/inputrc | 2 - .config/bash/privrc.sh | 1 - .config/bash/vcs-ps1.sh | 158 ---------------------------------------- .config/gnupg/gpg.conf | 1 - .config/gnupg/sshcontrol | 1 - .config/guix/channels.scm | 20 ----- .config/guix/home.scm | 152 -------------------------------------- .config/guix/system.scm | 102 -------------------------- .config/hg/hgrc | 2 - .config/i3/config | 157 --------------------------------------- .config/info/infokey | 7 -- .config/khal/config | 1 - .config/khard/khard.conf | 1 - .config/mailcaps/config | 1 - .config/mbsync/config | 1 - .config/msmtp/config | 1 - .config/newsboat/urls | 1 - .config/notmuch/default/config | 1 - .config/python/pythonrc.py | 15 ---- .config/ranger/rc.conf | 1 - .config/sbcl/sbclrc.lisp | 6 -- .config/ssh/known_hosts | 74 ------------------- .config/tmux/tmux.conf | 81 -------------------- .config/weechat/irc.conf | 1 - .usr/etc/afew/config | 6 ++ .usr/etc/alot/config | 1 + .usr/etc/bash/check.sh | 57 +++++++++++++++ .usr/etc/bash/inputrc | 2 + .usr/etc/bash/privrc.sh | 1 + .usr/etc/bash/vcs-ps1.sh | 158 ++++++++++++++++++++++++++++++++++++++++ .usr/etc/gnupg/gpg.conf | 1 + .usr/etc/gnupg/sshcontrol | 1 + .usr/etc/guix/channels.scm | 20 +++++ .usr/etc/guix/home.scm | 152 ++++++++++++++++++++++++++++++++++++++ .usr/etc/guix/system.scm | 102 ++++++++++++++++++++++++++ .usr/etc/hg/hgrc | 2 + .usr/etc/i3/config | 157 +++++++++++++++++++++++++++++++++++++++ .usr/etc/info/infokey | 7 ++ .usr/etc/khal/config | 1 + .usr/etc/khard/khard.conf | 1 + .usr/etc/mailcaps/config | 1 + .usr/etc/mbsync/config | 1 + .usr/etc/msmtp/config | 1 + .usr/etc/newsboat/urls | 1 + .usr/etc/notmuch/default/config | 1 + .usr/etc/python/pythonrc.py | 15 ++++ .usr/etc/ranger/rc.conf | 1 + .usr/etc/sbcl/sbclrc.lisp | 6 ++ .usr/etc/ssh/known_hosts | 74 +++++++++++++++++++ .usr/etc/tmux/tmux.conf | 81 ++++++++++++++++++++ .usr/etc/weechat/irc.conf | 1 + 54 files changed, 852 insertions(+), 852 deletions(-) delete mode 100644 .config/afew/config delete mode 120000 .config/alot/config delete mode 100755 .config/bash/check.sh delete mode 100644 .config/bash/inputrc delete mode 120000 .config/bash/privrc.sh delete mode 100644 .config/bash/vcs-ps1.sh delete mode 100644 .config/gnupg/gpg.conf delete mode 100644 .config/gnupg/sshcontrol delete mode 100644 .config/guix/channels.scm delete mode 100644 .config/guix/home.scm delete mode 100644 .config/guix/system.scm delete mode 100644 .config/hg/hgrc delete mode 100644 .config/i3/config delete mode 100644 .config/info/infokey delete mode 120000 .config/khal/config delete mode 120000 .config/khard/khard.conf delete mode 100644 .config/mailcaps/config delete mode 120000 .config/mbsync/config delete mode 120000 .config/msmtp/config delete mode 120000 .config/newsboat/urls delete mode 120000 .config/notmuch/default/config delete mode 100644 .config/python/pythonrc.py delete mode 100644 .config/ranger/rc.conf delete mode 100644 .config/sbcl/sbclrc.lisp delete mode 100644 .config/ssh/known_hosts delete mode 100644 .config/tmux/tmux.conf delete mode 120000 .config/weechat/irc.conf create mode 100644 .usr/etc/afew/config create mode 120000 .usr/etc/alot/config create mode 100755 .usr/etc/bash/check.sh create mode 100644 .usr/etc/bash/inputrc create mode 120000 .usr/etc/bash/privrc.sh create mode 100644 .usr/etc/bash/vcs-ps1.sh create mode 100644 .usr/etc/gnupg/gpg.conf create mode 100644 .usr/etc/gnupg/sshcontrol create mode 100644 .usr/etc/guix/channels.scm create mode 100644 .usr/etc/guix/home.scm create mode 100644 .usr/etc/guix/system.scm create mode 100644 .usr/etc/hg/hgrc create mode 100644 .usr/etc/i3/config create mode 100644 .usr/etc/info/infokey create mode 120000 .usr/etc/khal/config create mode 120000 .usr/etc/khard/khard.conf create mode 100644 .usr/etc/mailcaps/config create mode 120000 .usr/etc/mbsync/config create mode 120000 .usr/etc/msmtp/config create mode 120000 .usr/etc/newsboat/urls create mode 120000 .usr/etc/notmuch/default/config create mode 100644 .usr/etc/python/pythonrc.py create mode 100644 .usr/etc/ranger/rc.conf create mode 100644 .usr/etc/sbcl/sbclrc.lisp create mode 100644 .usr/etc/ssh/known_hosts create mode 100644 .usr/etc/tmux/tmux.conf create mode 120000 .usr/etc/weechat/irc.conf diff --git a/.config/afew/config b/.config/afew/config deleted file mode 100644 index 94341e9..0000000 --- a/.config/afew/config +++ /dev/null @@ -1,6 +0,0 @@ -[SpamFilter] -[KillThreadsFilter] -[ListMailsFilter] -[ArchiveSentMailsFilter] -[MeFilter] -[InboxFilter] diff --git a/.config/alot/config b/.config/alot/config deleted file mode 120000 index a92319d..0000000 --- a/.config/alot/config +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/alot/config \ No newline at end of file diff --git a/.config/bash/check.sh b/.config/bash/check.sh deleted file mode 100755 index 7c12dec..0000000 --- a/.config/bash/check.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - check.sh - check.sh -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -shellcheck -xe 1090,1091 \ - "$XDG_CONFIG_HOME"/bash/rc \ - "$XDG_CONFIG_HOME"/bash/vcs-ps1.sh \ - "$XDG_CONFIG_HOME"/bash/check.sh \ - "$XDG_CONFIG_HOME"/bash/privrc.sh - -sh -eu ~/.profile diff --git a/.config/bash/inputrc b/.config/bash/inputrc deleted file mode 100644 index f5c7095..0000000 --- a/.config/bash/inputrc +++ /dev/null @@ -1,2 +0,0 @@ -"\e[B": history-search-forward -"\e[A": history-search-backward diff --git a/.config/bash/privrc.sh b/.config/bash/privrc.sh deleted file mode 120000 index 243a4bd..0000000 --- a/.config/bash/privrc.sh +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/privrc.sh \ No newline at end of file diff --git a/.config/bash/vcs-ps1.sh b/.config/bash/vcs-ps1.sh deleted file mode 100644 index f2103da..0000000 --- a/.config/bash/vcs-ps1.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/sh - -repo_status_git() { - BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" - OUT="$(git status --short --branch --porcelain)" - BRANCH_LINE="$(echo "$OUT" | head -n 1)" - DIFF_LINES="$(echo "$OUT" | tail -n +2)" - - IS_AHEAD=false - IS_BEHIND=false - if echo "$BRANCH_LINE" | grep -q 'ahead'; then - IS_AHEAD=true - fi - if echo "$BRANCH_LINE" | grep -q 'behind'; then - IS_BEHIND=true - fi - - LINE='' - - if [ "$IS_AHEAD" = true ] && [ "$IS_BEHIND" = true ]; then - LINE="^^^ $BRANCH_NAME vvv" - elif [ "$IS_AHEAD" = true ]; then - LINE="^ $BRANCH_NAME ^" - elif [ "$IS_BEHIND" = true ]; then - LINE="v $BRANCH_NAME v" - else - LINE="$BRANCH_NAME" - fi - - HAS_DIFF=false - HAS_UNTRACKED=false - if echo "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then - HAS_DIFF=true - fi - if echo "$DIFF_LINES" | grep -q '^[?][?]'; then - HAS_UNTRACKED=true - fi - - if [ "$HAS_DIFF" = true ]; then - COLOR_FN=redb - LINE="{$LINE}" - elif [ "$IS_AHEAD" = true ] || [ "$IS_BEHIND" = true ]; then - COLOR_FN=bluei - LINE="[$LINE]" - elif [ "$HAS_UNTRACKED" = true ]; then - COLOR_FN=lightblue - LINE="{$LINE}" - else - COLOR_FN=green - LINE="($LINE)" - fi - - color -c "$COLOR_FN" "$LINE" - - BRANCH_COUNT="$(git branch --list | wc -l)" - if [ "$BRANCH_COUNT" -gt 1 ]; then - color -c lightblue "<$BRANCH_COUNT>" - fi - - STASH_COUNT="$(git stash list | wc -l)" - if [ "$STASH_COUNT" != 0 ]; then - color -c red "*$STASH_COUNT" - fi - - color -c blacki " - git/$(git rev-parse HEAD)" -} - -repo_status_fossil() { - BRANCH_NAME="$(fossil branch current)" - - if [ -n "$(fossil extras)" ]; then - HAS_UNTRACKED=1 - fi - - BRANCH_MARKER="$BRANCH_NAME" - - if [ -n "${HAS_UNTRACKED:-}" ]; then - COLOR_FN=lightblue - LINE="($BRANCH_MARKER)" - else - COLOR_FN=green - LINE="($BRANCH_MARKER)" - fi - - color -c "$COLOR_FN" "$LINE" - - color -c blacki " - fossil/$(fossil info | awk '/^checkout:/ { print $2 }')" -} - -repo_status_mercurial() { - BRANCH_NAME="$(hg branch)" -} - -repo_status() { - dir="$(basename "$PWD")" - if [ -d .git ]; then - repo_status_git - elif [ -f "$dir.fossil" ]; then - repo_status_fossil - elif [ -d .hg ]; then - repo_status_mercurial - fi -} - - -error_marker() { - STATUS=$? - if [ "$STATUS" != 0 ]; then - color -c redb " (!! $STATUS !!) " - fi -} - -timestamp() { - color -c blacki '\T' -} - -path() { - color -c yellowb '\w/' -} - -guix_env() { - if [ "$GUIX_ENVIRONMENT" != '' ]; then - printf '\n' - color -c blacki '~> ' - color -c purple 'guix environment ' - printf '(' - color -c blueb "$GUIX_ENVIRONMENT" - printf ')' - fi -} - -in_nix_shell() { - if [ "$IN_NIX_SHELL" != '' ]; then - printf '\n' - color -c blacki '~> ' - color -c purpleb "$IN_NIX_SHELL " - color -c purple 'nix-shell ' - printf '(' - color -c blueb "${name:-}" - printf ')' - fi -} - -PS1='`error_marker`'$(timestamp)' '$(path)' `repo_status``guix_env``in_nix_shell` -$ ' - - -vcs_status() { - git status "$@" -} - -vcs_diff() { - git diff "$@" -} - -vcs_diff_staged() { - git diff --staged "$@" -} diff --git a/.config/gnupg/gpg.conf b/.config/gnupg/gpg.conf deleted file mode 100644 index d4498fe..0000000 --- a/.config/gnupg/gpg.conf +++ /dev/null @@ -1 +0,0 @@ -keyserver pool.sks-keyservers.net diff --git a/.config/gnupg/sshcontrol b/.config/gnupg/sshcontrol deleted file mode 100644 index 1ae03ed..0000000 --- a/.config/gnupg/sshcontrol +++ /dev/null @@ -1 +0,0 @@ -750154E135FD7B11FDDF0107CC0904F92EBD2AE4 diff --git a/.config/guix/channels.scm b/.config/guix/channels.scm deleted file mode 100644 index 304db35..0000000 --- a/.config/guix/channels.scm +++ /dev/null @@ -1,20 +0,0 @@ -(append - (list - (channel - (name 'xyz-euandreh) - (url "git://euandreh.xyz/package-repository.git/") - (branch "main") - (introduction - (make-channel-introduction - "d749e053e6db365069cb9b2ef47a78b06f9e7361" - (openpgp-fingerprint - "5BDA E9B8 B2F6 C6BC BB0D 6CE5 81F9 0EC3 CD35 6060")))) - (channel - (name 'nonguix) - (url "https://gitlab.com/nonguix/nonguix") - (introduction - (make-channel-introduction - "897c1a470da759236cc11798f4e0a5f7d4d59fbc" - (openpgp-fingerprint - "2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))) - %default-channels) diff --git a/.config/guix/home.scm b/.config/guix/home.scm deleted file mode 100644 index 607a059..0000000 --- a/.config/guix/home.scm +++ /dev/null @@ -1,152 +0,0 @@ -(use-modules - (curth0) - (gnu home services) - (gnu home services shells) - (gnu packages) - (gnu packages mail) - (gnu packages gnupg) - (gnu services) - (guix gexp) - (guix packages) - (guix utils)) - -(define msmtp-non-hardcoded - (package - (inherit msmtp) - (name "msmtp-non-hardcoded") - (arguments - (substitute-keyword-arguments (package-arguments msmtp) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'install-additional-files 'patch-hardcoded-paths - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out"))) - (substitute* (string-append out "/bin/msmtpq") - (("^LOG=.*$") "LOG=${XDG_LOG_HOME:-$HOME/.local/var/log}/msmtpq.log\n") - (("^Q=.*$") "Q=${XDG_DATA_HOME:-$HOME/.local/share}/msmtp/queue\n") - (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) - -(define (xdg-config-home s) - (string-append (getenv "XDG_CONFIG_HOME") "/" s)) - -(define gitconfig (mixed-text-file "gitconfig" #"- - [user] - email = eu@euandre.org - name = EuAndreh - signingkey = 81F90EC3CD356060 - [transfer] - fsckobjects = true - [push] - default = current - [commit] - gpgsign = true - verbose = true - [init] - defaultBranch = main - [sendemail] - assume8bitEncoding = UTF-8 - smtpserveroption = -a - smtpserveroption = euandreh - annotate = yes - confirm = never - smtpserver = "# msmtp-non-hardcoded "/bin/msmtpq\n")) - -(define gpg-agent.conf (mixed-text-file "gpg-agent.conf" #"- - default-cache-ttl 172800 - default-cache-ttl-ssh 172800 - max-cache-ttl 604800 - max-cache-ttl-ssh 604800 - enable-ssh-support - pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) - -(define config-files - `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) - ("git/config" ,gitconfig))) - -(define (dot-config) - (define (prefix-with-config s) - (string-append (substring (getenv "XDG_CONFIG_HOME") - (+ 1 (string-length (getenv "HOME")))) - "/" - s)) - (map (lambda (t) - (list (prefix-with-config (first t)) - (second t))) - config-files)) - -(home-environment - (packages - (append - (map (compose list specification->package+output symbol->string) - '(man-pages - posix-man-pages - - tree - openssh - mailutils - entr - git - git:send-email - tmux - rsync - gnupg - pulseaudio - password-store - playerctl - pinentry-gtk2 - bmake - fzf - ranger - blueman - ledger - curl - xclip - cloc - strace - file - urlscan - rlwrap - direnv - borg - khal - khard - libfaketime - qrencode - feh - sox - xset - graphviz - moreutils - shellcheck - gettext - groff - - clojure - openjdk - sbcl - perl - perl-mojolicious - - st - i3status - dmenu - - weechat - alot - notmuch - isync - w3m - afew - - zathura - zathura-djvu - zathura-pdf-poppler - zathura-ps - firefox)) - (list msmtp-non-hardcoded))) - (services - (list (service home-bash-service-type - (home-bash-configuration - (bashrc - (list (plain-file "bashrc.sh" ". $XDG_CONFIG_HOME/bash/rc"))))) - (simple-service 'config-files home-files-service-type (dot-config))))) diff --git a/.config/guix/system.scm b/.config/guix/system.scm deleted file mode 100644 index 3bd7235..0000000 --- a/.config/guix/system.scm +++ /dev/null @@ -1,102 +0,0 @@ -(use-modules - (curth0) - (gnu bootloader) - (gnu bootloader grub) - (gnu packages) - (gnu services base) - (gnu services desktop) - (gnu services security-token) - (gnu services xorg) - (gnu system keyboard) - (gnu system file-systems) - (gnu system mapped-devices) - (guix gexp) - (nongnu packages linux) - (nongnu system linux-initrd)) - -(operating-system - (kernel linux) - (initrd microcode-initrd) - (firmware (list linux-firmware)) - (locale "fr_FR.UTF-8") - (timezone "America/Sao_Paulo") - (keyboard-layout - (keyboard-layout "br" #:options '("caps:swapescape" "esperanto:qwerty"))) - (host-name "velhinho") - (users - (append - (let ((user-groups '("wheel" "netdev" "audio" "video"))) - (list - (user-account - (name "andreh") - (comment "EuAndreh") - (group "users") - (supplementary-groups user-groups)) - (user-account - (name "other") - (comment "Other Self") - (group "users") - (supplementary-groups user-groups)))) - %base-user-accounts)) - (packages - (append - (map (compose list specification->package+output symbol->string) - '(nss-certs - i3-wm)) - %base-packages)) - (services - (append - (list - (service bluetooth-service-type) - (service pcscd-service-type) - (service gnome-desktop-service-type) - (set-xorg-configuration - (xorg-configuration - (keyboard-layout keyboard-layout) - (extra-config (list #"- - Section "InputClass" - Identifier "touchpad" - Driver "libinput" - MatchIsTouchpad "on" - Option "Tapping" "on" - EndSection - "#))))) - (modify-services %desktop-services - (guix-service-type config => - (guix-configuration - (inherit config) - (substitute-urls - (append '("https://substitutes.nonguix.org") - %default-substitute-urls)) - (authorized-keys - (append (list (plain-file "non-guix.pub" #"- - (public-key - (ecc - (curve Ed25519) - (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#))) - "#)) - %default-authorized-guix-keys))))))) - (bootloader - (bootloader-configuration - (bootloader grub-efi-bootloader) - (targets (list "/boot/efi")) - (keyboard-layout keyboard-layout))) - (mapped-devices - (list - (mapped-device - (source (uuid "6b0d38a6-d93e-4f8e-a59a-7729f5adf892")) - (target "cryptroot") - (type luks-device-mapping)))) - (file-systems - (append - (list - (file-system - (mount-point "/boot/efi") - (device (uuid "1B26-9F4E" 'fat32)) - (type "vfat")) - (file-system - (mount-point "/") - (device "/dev/mapper/cryptroot") - (type "ext4") - (dependencies mapped-devices))) - %base-file-systems))) diff --git a/.config/hg/hgrc b/.config/hg/hgrc deleted file mode 100644 index 656f40b..0000000 --- a/.config/hg/hgrc +++ /dev/null @@ -1,2 +0,0 @@ -[ui] -username = EuAndreh diff --git a/.config/i3/config b/.config/i3/config deleted file mode 100644 index 7392d64..0000000 --- a/.config/i3/config +++ /dev/null @@ -1,157 +0,0 @@ -set $mod Mod4 - - -# font pango:monospace 8 - -# This font is widely installed, provides lots of unicode glyphs, right-to-left -# text rendering and scalability on retina/hidpi displays (thanks to pango). -font pango:DejaVu Sans Mono 8 - -# Start XDG autostart .desktop files using dex. See also -# https://wiki.archlinux.org/index.php/XDG_Autostart -exec --no-startup-id dex --autostart --environment i3 - -# The combination of xss-lock, nm-applet and pactl is a popular choice, so -# they are included here as an example. Modify as you see fit. - -# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the -# screen before suspend. Use loginctl lock-session to lock your screen. -exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork - -# NetworkManager is the most popular way to manage wireless networks on Linux, -# and nm-applet is a desktop environment-independent system tray GUI for it. -exec --no-startup-id nm-applet - -# Use pactl to adjust volume in PulseAudio. -set $refresh_i3status killall -SIGUSR1 i3status -bindsym F1 exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status -bindsym F2 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status -bindsym F3 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status - -bindsym F5 exec --no-startup-id playerctl play-pause && $refresh_i3status - - -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -bindsym $mod+Return exec st -bindsym $mod+Shift+q kill -bindsym $mod+p exec --no-startup-id dmenu_run - -# change focus -bindsym $mod+h focus left -bindsym $mod+j focus down -bindsym $mod+k focus up -bindsym $mod+l focus right - -# move focused window -bindsym $mod+Shift+h move left -bindsym $mod+Shift+j move down -bindsym $mod+Shift+k move up -bindsym $mod+Shift+l move right - -# bindsym $mod+h split h # what is this? - -# split in vertical orientation -bindsym $mod+v split v - -# enter fullscreen mode for the focused container -bindsym $mod+f fullscreen toggle - -# change container layout (stacked, tabbed, toggle split) -bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+e layout toggle split - -# toggle tiling / floating -bindsym $mod+Shift+space floating toggle - -# change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle - -# focus the parent container -bindsym $mod+a focus parent - -# focus the child container -bindsym $mod+d focus child - -# Define names for default workspaces for which we configure key bindings later on. -# We use variables to avoid repeating the names in multiple places. -set $ws1 "1" -set $ws2 "2" -set $ws3 "3" -set $ws4 "4" -set $ws5 "5" -set $ws6 "6" -set $ws7 "7" -set $ws8 "8" -set $ws9 "9" -set $ws10 "10" - -# switch to workspace -bindsym $mod+1 workspace number $ws1 -bindsym $mod+2 workspace number $ws2 -bindsym $mod+3 workspace number $ws3 -bindsym $mod+4 workspace number $ws4 -bindsym $mod+5 workspace number $ws5 -bindsym $mod+6 workspace number $ws6 -bindsym $mod+7 workspace number $ws7 -bindsym $mod+8 workspace number $ws8 -bindsym $mod+9 workspace number $ws9 -bindsym $mod+0 workspace number $ws10 - -# move focused container to workspace -bindsym $mod+Shift+1 move container to workspace number $ws1 -bindsym $mod+Shift+2 move container to workspace number $ws2 -bindsym $mod+Shift+3 move container to workspace number $ws3 -bindsym $mod+Shift+4 move container to workspace number $ws4 -bindsym $mod+Shift+5 move container to workspace number $ws5 -bindsym $mod+Shift+6 move container to workspace number $ws6 -bindsym $mod+Shift+7 move container to workspace number $ws7 -bindsym $mod+Shift+8 move container to workspace number $ws8 -bindsym $mod+Shift+9 move container to workspace number $ws9 -bindsym $mod+Shift+0 move container to workspace number $ws10 - -# reload the configuration file -bindsym $mod+Shift+c reload -# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -bindsym $mod+Shift+r restart -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+e 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'" - -# resize window (you can also use the mouse for that) -mode "resize" { - # These bindings trigger as soon as you enter the resize mode - - # Pressing left will shrink the window’s width. - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - bindsym h resize shrink width 10 px or 10 ppt - bindsym j resize grow height 10 px or 10 ppt - bindsym k resize shrink height 10 px or 10 ppt - bindsym l resize grow width 10 px or 10 ppt - - # same bindings, but for the arrow keys - # bindsym Left resize shrink width 10 px or 10 ppt - # bindsym Down resize grow height 10 px or 10 ppt - # bindsym Up resize shrink height 10 px or 10 ppt - # bindsym Right resize grow width 10 px or 10 ppt - - # back to normal: Enter or Escape or $mod+r - bindsym Return mode "default" - bindsym Caps_Lock mode "default" - bindsym $mod+r mode "default" -} - -bindsym $mod+r mode "resize" - -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) -bar { - position top - status_command i3status -} - -default_border pixel -default_floating_border pixel diff --git a/.config/info/infokey b/.config/info/infokey deleted file mode 100644 index 90edc50..0000000 --- a/.config/info/infokey +++ /dev/null @@ -1,7 +0,0 @@ -^e down-line -^y up-line - -#var -link-style=cyan -active-link-style=blue,bold -match-style=underline,bold,bggreen diff --git a/.config/khal/config b/.config/khal/config deleted file mode 120000 index dfae173..0000000 --- a/.config/khal/config +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/khal/config \ No newline at end of file diff --git a/.config/khard/khard.conf b/.config/khard/khard.conf deleted file mode 120000 index f015b29..0000000 --- a/.config/khard/khard.conf +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/khard/khard.conf \ No newline at end of file diff --git a/.config/mailcaps/config b/.config/mailcaps/config deleted file mode 100644 index aeea68d..0000000 --- a/.config/mailcaps/config +++ /dev/null @@ -1 +0,0 @@ -text/html; w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput diff --git a/.config/mbsync/config b/.config/mbsync/config deleted file mode 120000 index 68a3234..0000000 --- a/.config/mbsync/config +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/mbsync/config \ No newline at end of file diff --git a/.config/msmtp/config b/.config/msmtp/config deleted file mode 120000 index 45cd0ac..0000000 --- a/.config/msmtp/config +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/msmtp/config \ No newline at end of file diff --git a/.config/newsboat/urls b/.config/newsboat/urls deleted file mode 120000 index 3c453f5..0000000 --- a/.config/newsboat/urls +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/newsboat/urls \ No newline at end of file diff --git a/.config/notmuch/default/config b/.config/notmuch/default/config deleted file mode 120000 index 3b9d2f4..0000000 --- a/.config/notmuch/default/config +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/notmuch/default/config \ No newline at end of file diff --git a/.config/python/pythonrc.py b/.config/python/pythonrc.py deleted file mode 100644 index 1fc3bfe..0000000 --- a/.config/python/pythonrc.py +++ /dev/null @@ -1,15 +0,0 @@ -import os -import atexit -import readline - -history = os.path.join(os.environ["XDG_STATE_HOME"], "python-history") - -try: - readline.read_history_file(history) -except OSError: - pass - -def write_history(): - readline.write_history_file(history) - -atexit.register(write_history) diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf deleted file mode 100644 index ed2b538..0000000 --- a/.config/ranger/rc.conf +++ /dev/null @@ -1 +0,0 @@ -map DD shell trash %s diff --git a/.config/sbcl/sbclrc.lisp b/.config/sbcl/sbclrc.lisp deleted file mode 100644 index df7f57a..0000000 --- a/.config/sbcl/sbclrc.lisp +++ /dev/null @@ -1,6 +0,0 @@ -;;; The following lines added by ql:add-to-init-file: -#-quicklisp -(let ((quicklisp-init (merge-pathnames "dev/quicklisp/setup.lisp" - (user-homedir-pathname)))) - (when (probe-file quicklisp-init) - (load quicklisp-init))) diff --git a/.config/ssh/known_hosts b/.config/ssh/known_hosts deleted file mode 100644 index ad6b0b2..0000000 --- a/.config/ssh/known_hosts +++ /dev/null @@ -1,74 +0,0 @@ -|1|G2vfdmQ84glwobYXZZ0d+cCMVRE=|DZJYmWjbeP52J4K7+Bsz2e0dgBA= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= -|1|yosAhKlbZt51FfD2VvQJiVijSBA=|BFEig1gqq4EwCHEHagEASQZQmNI= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= -|1|5yKbUaAB5AFz4MINtTVhVAPwMtU=|LwcI5Z8hXwwKxtkk4KDpeZduyPQ= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -|1|sfEM3JnFec93XEzMf9A6TkthgdI=|oZX7oe9eBKYMrXLcoFydh70my5A= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -|1|F/E3nafzrpMZEzyN8iA++okJ7Q4=|T00Gk7F90YmbaTMSOGjP8yhls94= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMylg2eib0byVT2R7dVFkxdhXO5pvgllnszKhlHiEP15ee8IjMYNPvz2A605hUdIxXtsBgjf+u7jlubh6mbx/YA= -|1|jSpDKjDomux2z3O/ok/UPGGQ8xs=|ZP60naGKQnpK6yHGD+B/+ykB05c= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMylg2eib0byVT2R7dVFkxdhXO5pvgllnszKhlHiEP15ee8IjMYNPvz2A605hUdIxXtsBgjf+u7jlubh6mbx/YA= -|1|PJybLcZRkpN9IyDsqaNjGO6lE5Y=|K0nchvCA7XV91J2X6l0h2DwOmyI= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -|1|zzdSJf8JIMfi5sKbc/mNcBy/RB8=|0GxC/CesxJHcRdt8MuPVjfab06k= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 -|1|X5OmtKdXZh2kC//XCXEEOim7tgE=|Rh5ro2oEB4MN8MP6PRbG3QBR0Kk= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 -46.101.43.82 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLIGIc5X12Y61eVcKJnNzCvrPeSKgyKgElqGl7QDeGeynE33sRVoNAg9aqkgXdc2MkN+nFhEWELkjPuBKYsyp2I= -hinarioespirita.org,167.99.34.30 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= -pt.hinarioespirita.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= -mtm.hinarioespirita.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= -77.109.148.18 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 -35.231.145.151 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= -git.sr.ht,173.195.146.142 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= -192.168.33.10 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCL+hEiW/Va2L6y5Y4MyxRBXHJw/9bIC02M3wGVe1zaD3DT8wsAUcJ2QO1lJILudvMInx+SaPyJmwBvUn58YR2c= -173.195.146.152 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= -2001:1620:2019::218 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 -140.82.114.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -140.82.113.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -140.82.113.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -140.82.114.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -2604:bf00:710:0:5054:ff:fe7d:8fa8 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= -azusa.runners.sr.ht,2604:bf00:710:0:ae1f:6bff:fead:55a ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPzxK5AM1FdMI9gZVDpw2O5iiS/49QokWpzANFntVt0Qig4qdBt4K7B0O6MrwggLh3A+zBlsXCMoWtvFtPQgLxA= -18.228.52.138 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -18.231.5.6 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -2604:bf00:710:0:5054:ff:fe36:ebc6 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= -18.228.67.229 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -hg.sr.ht,2604:bf00:710:0:5054:ff:fe25:1aa6 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL4aNGa+KnvMA0QoWrIVuI2QBU0Q/xX48sMBl3VtP/zPOGMvS50zGVMaA00RSzfcI2X0v/aUTsVm2vBNo/V1gTg= -euandre.org,2a03:b0c0:3:d0::387:b001 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF6wlJqwd7KWLzLovwnwbTmNfO4E4yVDyqxAAlUkn9eDsTtzV1RYNDsaLPWv4mweJqP4crZPFxg40sFVeMDbkC0= -2606:4700:90:0:f22e:fbec:5bed:a9b9 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= -46.101.160.115 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF6wlJqwd7KWLzLovwnwbTmNfO4E4yVDyqxAAlUkn9eDsTtzV1RYNDsaLPWv4mweJqP4crZPFxg40sFVeMDbkC0= -173.195.146.249 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPzxK5AM1FdMI9gZVDpw2O5iiS/49QokWpzANFntVt0Qig4qdBt4K7B0O6MrwggLh3A+zBlsXCMoWtvFtPQgLxA= -2604:a880:800:14::32:4000 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK8YTumqLFAL5MJ0AcDtFG9dWfbkJKU7FUDlH0xEgAZvHGU57TBr9DIQy2OHrxCxuhk9bZEUX8+vJiRXE05+Rzs= -2001:19f0:7001:5cec:5400:2ff:feec:9940 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPYRWlGutc+bRJ+N0sXHxhgnDsRvRoauQ92yM1U7N+8a -2001:19f0:6c01:2cf0:5400:2ff:feec:99c5 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMGiiEXB+koPS1vgGkwdExk2Q5fGv3Yc5rf8jVHB2FB7 -45.32.155.96 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN -45.77.65.204 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN -136.244.85.68 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN -199.247.0.136 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -euandreh.xyz ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -136.244.80.130 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -209.250.232.122 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -git.euandreh.xyz ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -80.240.24.148 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -95.179.246.150 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -45.77.52.185 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -199.247.2.245 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -140.82.112.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -104.238.176.223 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -172.65.251.78 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= -140.82.112.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -45.32.158.17 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -95.179.253.243 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -95.179.163.103 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -217.69.2.177 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -arrobaponto.org,104.238.167.189 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -104.238.176.81 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -git.arrobaponto.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -173.199.70.52 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -[remembering.euandreh.xyz]:23841 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -167.71.86.194 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCXg/l/grol/OAY95VphKbVn4yXUStSWpxQjnka7PWXzWyForfX+fpmY+p72r1Uimx5oXIFISt8uSZW/tvD61iQ= -[localhost]:10022 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLHACdQJXUj5e4Znyh7KdTjB1RLznSfStRw6cuHZlu8rhANVfkjt300Fum9Jv6yLra6W4v2FLALWfcYpOlUzt9c= -107.191.63.70 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMONpsqwH79f/MsjtsOPitT5C+3hPPJqVh42oHMKOen6 -217.69.11.49 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr -[arrobaponto.org]:23213 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr -anoncvs.netbsd.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA3QiBl8leG9fqIJpKeNov0PKq5YryFFiroMWOPUv4hDFn8R0jC07YVaR/OSBrr37CTmGX5AFceXPzoFnLlwCqWR7rXg4NR75FTlTp9CG9EBAEtU8mee27KDrUFBTZdfVl2+aRYoAI5fTXA+0vpIO68Cq843vRWUZCcwinS4cNLUU= -git.2f30.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSLZ4G5w4NysBUmAHmr6/V9om42IHSUCtqrNdhWoYQ0 -[arrobaponto.org]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 -[199.247.13.53]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 -[2001:19f0:6801:988:5400:3ff:fea1:b566]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 -[gerrit.wikimedia.org]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCF8pwFLehzCXhbF1jfHWtd9d1LFq2NirplEBQYs7AOrGwQ/6ZZI0gvZFYiEiaw1o+F1CMfoHdny1VfWOJF3mJ1y9QMKAacc8/Z3tG39jBKRQCuxmYLO1SWymv7/Uvx9WQlkNRoTdTTa9OJFy6UqvLQEXKYaokfMIUHZ+oVFf1CgQ== -2001:19f0:5:1d65:5400:3ff:fee3:7463 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF2EgU3IgCwv1ynnWfxFm0SHTSoE0AYG3MJT/TpN3pBz diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf deleted file mode 100644 index dd718ca..0000000 --- a/.config/tmux/tmux.conf +++ /dev/null @@ -1,81 +0,0 @@ -# Use personal prefix over "C-b" -unbind C-b -set -g prefix C-v - -# Turn on mouse mode -# https://groups.google.com/forum/#!msg/tmux-users/TRwPgEOVqho/Ck_oth_SDgAJ -# https://github.com/tmux/tmux/blob/310f0a960ca64fa3809545badc629c0c166c6cd2/CHANGES#L12 -set -g mouse on - -# Bind "C-x r" to reload the configuration file -bind-key r source-file $XDG_CONFIG_HOME/tmux/tmux.conf \; display-message "$XDG_CONFIG_HOME/tmux.conf reloaded" - -# Holy answer that properly implements copying from tmux! -# https://unix.stackexchange.com/a/349020/276661 -bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xclip -selection clipboard -i" \; -bind-key y send-keys -X copy-pipe "xclip -selection clipboard -i" \; display-message "Copied system clipboard! Hooray! Long-live tmux!" - -# Moving around panes -bind-key -n M-h select-pane -L -bind-key -n M-j select-pane -D -bind-key -n M-k select-pane -U -bind-key -n M-l select-pane -R - -# Resizing panes -bind-key -n M-H resize-pane -L 5 -bind-key -n M-J resize-pane -D 5 -bind-key -n M-K resize-pane -U 5 -bind-key -n M-L resize-pane -R 5 - -# Reorder windows -bind-key -n C-S-Left swap-window -t -1\; select-window -t -1 -bind-key -n C-S-Right swap-window -t +1\; select-window -t +1 -# -# To change the number of a window, use: PREFIX-., and pick a new unused number -# - -# Join windows -bind-key -n C-S-M-Left join-pane -s :-0 -t :-1 -bind-key -n C-S-M-Right join-pane -s :-0 -t :+1 - -# "M m" to actually clear the pane history -bind -n M-m send-keys -R \; clear-history - -# Keybinding to activate pane typing sync -# https://stackoverflow.com/questions/25909964/tmux-how-to-toggle-on-and-off-options-with-the-same-key -bind-key b setw synchronize-panes \; display-message "synchronize-panes toggle" - -setw -g mode-keys vi # Move around with vi keys -set-option -g status-key "vi" # Use vi mode for status bar command (like after typing "C-x [" one can search with "/") -set-option -g status-bg "#666666" # Status bar background color -set-option -g status-fg "#aaaaaa" # Status bar foreground color -set-option -g status-left-length 50 # session name in status bar length =[annex]= part -set-option -g history-limit 150000 # How many lines of history to keep -set-option -g status-right "" - -# Set the panes initial index value to 1 instead of 0 -# 0 is too far from ` ;) -set -g base-index 1 -set-window-option -g pane-base-index 1 - -# Automatically set window title -set-window-option -g automatic-rename on -set-option -g set-titles on - -# Set "correct term" -# https://wiki.archlinux.org/index.php/Tmux -set -g default-terminal screen-256color - -# No delay for escape key press -# https://mutelight.org/practical-tmux#faster-command-sequences -set -sg escape-time 0 - -# Display pane numbers for longer -# https://unix.stackexchange.com/questions/307696/how-to-increase-tmux-pane-numbers-display-time-ctrl-b-q -set -g display-panes-time 2500 - -bind-key t resize-pane -x 80 - -bind -n M-r attach-session -t . -c '#{pane_current_path}' \; display-message "CWD for session updated to #{pane_current_path}!" - -bind-key u capture-pane \; save-buffer /tmp/tmux-urlscan-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan < /tmp/tmux-urlscan-buffer"' diff --git a/.config/weechat/irc.conf b/.config/weechat/irc.conf deleted file mode 120000 index 7dff360..0000000 --- a/.config/weechat/irc.conf +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/weechat/irc.conf \ No newline at end of file diff --git a/.usr/etc/afew/config b/.usr/etc/afew/config new file mode 100644 index 0000000..94341e9 --- /dev/null +++ b/.usr/etc/afew/config @@ -0,0 +1,6 @@ +[SpamFilter] +[KillThreadsFilter] +[ListMailsFilter] +[ArchiveSentMailsFilter] +[MeFilter] +[InboxFilter] diff --git a/.usr/etc/alot/config b/.usr/etc/alot/config new file mode 120000 index 0000000..a92319d --- /dev/null +++ b/.usr/etc/alot/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/alot/config \ No newline at end of file diff --git a/.usr/etc/bash/check.sh b/.usr/etc/bash/check.sh new file mode 100755 index 0000000..7c12dec --- /dev/null +++ b/.usr/etc/bash/check.sh @@ -0,0 +1,57 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + check.sh + check.sh -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +shellcheck -xe 1090,1091 \ + "$XDG_CONFIG_HOME"/bash/rc \ + "$XDG_CONFIG_HOME"/bash/vcs-ps1.sh \ + "$XDG_CONFIG_HOME"/bash/check.sh \ + "$XDG_CONFIG_HOME"/bash/privrc.sh + +sh -eu ~/.profile diff --git a/.usr/etc/bash/inputrc b/.usr/etc/bash/inputrc new file mode 100644 index 0000000..f5c7095 --- /dev/null +++ b/.usr/etc/bash/inputrc @@ -0,0 +1,2 @@ +"\e[B": history-search-forward +"\e[A": history-search-backward diff --git a/.usr/etc/bash/privrc.sh b/.usr/etc/bash/privrc.sh new file mode 120000 index 0000000..243a4bd --- /dev/null +++ b/.usr/etc/bash/privrc.sh @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/privrc.sh \ No newline at end of file diff --git a/.usr/etc/bash/vcs-ps1.sh b/.usr/etc/bash/vcs-ps1.sh new file mode 100644 index 0000000..f2103da --- /dev/null +++ b/.usr/etc/bash/vcs-ps1.sh @@ -0,0 +1,158 @@ +#!/bin/sh + +repo_status_git() { + BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" + OUT="$(git status --short --branch --porcelain)" + BRANCH_LINE="$(echo "$OUT" | head -n 1)" + DIFF_LINES="$(echo "$OUT" | tail -n +2)" + + IS_AHEAD=false + IS_BEHIND=false + if echo "$BRANCH_LINE" | grep -q 'ahead'; then + IS_AHEAD=true + fi + if echo "$BRANCH_LINE" | grep -q 'behind'; then + IS_BEHIND=true + fi + + LINE='' + + if [ "$IS_AHEAD" = true ] && [ "$IS_BEHIND" = true ]; then + LINE="^^^ $BRANCH_NAME vvv" + elif [ "$IS_AHEAD" = true ]; then + LINE="^ $BRANCH_NAME ^" + elif [ "$IS_BEHIND" = true ]; then + LINE="v $BRANCH_NAME v" + else + LINE="$BRANCH_NAME" + fi + + HAS_DIFF=false + HAS_UNTRACKED=false + if echo "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then + HAS_DIFF=true + fi + if echo "$DIFF_LINES" | grep -q '^[?][?]'; then + HAS_UNTRACKED=true + fi + + if [ "$HAS_DIFF" = true ]; then + COLOR_FN=redb + LINE="{$LINE}" + elif [ "$IS_AHEAD" = true ] || [ "$IS_BEHIND" = true ]; then + COLOR_FN=bluei + LINE="[$LINE]" + elif [ "$HAS_UNTRACKED" = true ]; then + COLOR_FN=lightblue + LINE="{$LINE}" + else + COLOR_FN=green + LINE="($LINE)" + fi + + color -c "$COLOR_FN" "$LINE" + + BRANCH_COUNT="$(git branch --list | wc -l)" + if [ "$BRANCH_COUNT" -gt 1 ]; then + color -c lightblue "<$BRANCH_COUNT>" + fi + + STASH_COUNT="$(git stash list | wc -l)" + if [ "$STASH_COUNT" != 0 ]; then + color -c red "*$STASH_COUNT" + fi + + color -c blacki " - git/$(git rev-parse HEAD)" +} + +repo_status_fossil() { + BRANCH_NAME="$(fossil branch current)" + + if [ -n "$(fossil extras)" ]; then + HAS_UNTRACKED=1 + fi + + BRANCH_MARKER="$BRANCH_NAME" + + if [ -n "${HAS_UNTRACKED:-}" ]; then + COLOR_FN=lightblue + LINE="($BRANCH_MARKER)" + else + COLOR_FN=green + LINE="($BRANCH_MARKER)" + fi + + color -c "$COLOR_FN" "$LINE" + + color -c blacki " - fossil/$(fossil info | awk '/^checkout:/ { print $2 }')" +} + +repo_status_mercurial() { + BRANCH_NAME="$(hg branch)" +} + +repo_status() { + dir="$(basename "$PWD")" + if [ -d .git ]; then + repo_status_git + elif [ -f "$dir.fossil" ]; then + repo_status_fossil + elif [ -d .hg ]; then + repo_status_mercurial + fi +} + + +error_marker() { + STATUS=$? + if [ "$STATUS" != 0 ]; then + color -c redb " (!! $STATUS !!) " + fi +} + +timestamp() { + color -c blacki '\T' +} + +path() { + color -c yellowb '\w/' +} + +guix_env() { + if [ "$GUIX_ENVIRONMENT" != '' ]; then + printf '\n' + color -c blacki '~> ' + color -c purple 'guix environment ' + printf '(' + color -c blueb "$GUIX_ENVIRONMENT" + printf ')' + fi +} + +in_nix_shell() { + if [ "$IN_NIX_SHELL" != '' ]; then + printf '\n' + color -c blacki '~> ' + color -c purpleb "$IN_NIX_SHELL " + color -c purple 'nix-shell ' + printf '(' + color -c blueb "${name:-}" + printf ')' + fi +} + +PS1='`error_marker`'$(timestamp)' '$(path)' `repo_status``guix_env``in_nix_shell` +$ ' + + +vcs_status() { + git status "$@" +} + +vcs_diff() { + git diff "$@" +} + +vcs_diff_staged() { + git diff --staged "$@" +} diff --git a/.usr/etc/gnupg/gpg.conf b/.usr/etc/gnupg/gpg.conf new file mode 100644 index 0000000..d4498fe --- /dev/null +++ b/.usr/etc/gnupg/gpg.conf @@ -0,0 +1 @@ +keyserver pool.sks-keyservers.net diff --git a/.usr/etc/gnupg/sshcontrol b/.usr/etc/gnupg/sshcontrol new file mode 100644 index 0000000..1ae03ed --- /dev/null +++ b/.usr/etc/gnupg/sshcontrol @@ -0,0 +1 @@ +750154E135FD7B11FDDF0107CC0904F92EBD2AE4 diff --git a/.usr/etc/guix/channels.scm b/.usr/etc/guix/channels.scm new file mode 100644 index 0000000..304db35 --- /dev/null +++ b/.usr/etc/guix/channels.scm @@ -0,0 +1,20 @@ +(append + (list + (channel + (name 'xyz-euandreh) + (url "git://euandreh.xyz/package-repository.git/") + (branch "main") + (introduction + (make-channel-introduction + "d749e053e6db365069cb9b2ef47a78b06f9e7361" + (openpgp-fingerprint + "5BDA E9B8 B2F6 C6BC BB0D 6CE5 81F9 0EC3 CD35 6060")))) + (channel + (name 'nonguix) + (url "https://gitlab.com/nonguix/nonguix") + (introduction + (make-channel-introduction + "897c1a470da759236cc11798f4e0a5f7d4d59fbc" + (openpgp-fingerprint + "2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))) + %default-channels) diff --git a/.usr/etc/guix/home.scm b/.usr/etc/guix/home.scm new file mode 100644 index 0000000..607a059 --- /dev/null +++ b/.usr/etc/guix/home.scm @@ -0,0 +1,152 @@ +(use-modules + (curth0) + (gnu home services) + (gnu home services shells) + (gnu packages) + (gnu packages mail) + (gnu packages gnupg) + (gnu services) + (guix gexp) + (guix packages) + (guix utils)) + +(define msmtp-non-hardcoded + (package + (inherit msmtp) + (name "msmtp-non-hardcoded") + (arguments + (substitute-keyword-arguments (package-arguments msmtp) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'install-additional-files 'patch-hardcoded-paths + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out"))) + (substitute* (string-append out "/bin/msmtpq") + (("^LOG=.*$") "LOG=${XDG_LOG_HOME:-$HOME/.local/var/log}/msmtpq.log\n") + (("^Q=.*$") "Q=${XDG_DATA_HOME:-$HOME/.local/share}/msmtp/queue\n") + (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) + +(define (xdg-config-home s) + (string-append (getenv "XDG_CONFIG_HOME") "/" s)) + +(define gitconfig (mixed-text-file "gitconfig" #"- + [user] + email = eu@euandre.org + name = EuAndreh + signingkey = 81F90EC3CD356060 + [transfer] + fsckobjects = true + [push] + default = current + [commit] + gpgsign = true + verbose = true + [init] + defaultBranch = main + [sendemail] + assume8bitEncoding = UTF-8 + smtpserveroption = -a + smtpserveroption = euandreh + annotate = yes + confirm = never + smtpserver = "# msmtp-non-hardcoded "/bin/msmtpq\n")) + +(define gpg-agent.conf (mixed-text-file "gpg-agent.conf" #"- + default-cache-ttl 172800 + default-cache-ttl-ssh 172800 + max-cache-ttl 604800 + max-cache-ttl-ssh 604800 + enable-ssh-support + pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) + +(define config-files + `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) + ("git/config" ,gitconfig))) + +(define (dot-config) + (define (prefix-with-config s) + (string-append (substring (getenv "XDG_CONFIG_HOME") + (+ 1 (string-length (getenv "HOME")))) + "/" + s)) + (map (lambda (t) + (list (prefix-with-config (first t)) + (second t))) + config-files)) + +(home-environment + (packages + (append + (map (compose list specification->package+output symbol->string) + '(man-pages + posix-man-pages + + tree + openssh + mailutils + entr + git + git:send-email + tmux + rsync + gnupg + pulseaudio + password-store + playerctl + pinentry-gtk2 + bmake + fzf + ranger + blueman + ledger + curl + xclip + cloc + strace + file + urlscan + rlwrap + direnv + borg + khal + khard + libfaketime + qrencode + feh + sox + xset + graphviz + moreutils + shellcheck + gettext + groff + + clojure + openjdk + sbcl + perl + perl-mojolicious + + st + i3status + dmenu + + weechat + alot + notmuch + isync + w3m + afew + + zathura + zathura-djvu + zathura-pdf-poppler + zathura-ps + firefox)) + (list msmtp-non-hardcoded))) + (services + (list (service home-bash-service-type + (home-bash-configuration + (bashrc + (list (plain-file "bashrc.sh" ". $XDG_CONFIG_HOME/bash/rc"))))) + (simple-service 'config-files home-files-service-type (dot-config))))) diff --git a/.usr/etc/guix/system.scm b/.usr/etc/guix/system.scm new file mode 100644 index 0000000..3bd7235 --- /dev/null +++ b/.usr/etc/guix/system.scm @@ -0,0 +1,102 @@ +(use-modules + (curth0) + (gnu bootloader) + (gnu bootloader grub) + (gnu packages) + (gnu services base) + (gnu services desktop) + (gnu services security-token) + (gnu services xorg) + (gnu system keyboard) + (gnu system file-systems) + (gnu system mapped-devices) + (guix gexp) + (nongnu packages linux) + (nongnu system linux-initrd)) + +(operating-system + (kernel linux) + (initrd microcode-initrd) + (firmware (list linux-firmware)) + (locale "fr_FR.UTF-8") + (timezone "America/Sao_Paulo") + (keyboard-layout + (keyboard-layout "br" #:options '("caps:swapescape" "esperanto:qwerty"))) + (host-name "velhinho") + (users + (append + (let ((user-groups '("wheel" "netdev" "audio" "video"))) + (list + (user-account + (name "andreh") + (comment "EuAndreh") + (group "users") + (supplementary-groups user-groups)) + (user-account + (name "other") + (comment "Other Self") + (group "users") + (supplementary-groups user-groups)))) + %base-user-accounts)) + (packages + (append + (map (compose list specification->package+output symbol->string) + '(nss-certs + i3-wm)) + %base-packages)) + (services + (append + (list + (service bluetooth-service-type) + (service pcscd-service-type) + (service gnome-desktop-service-type) + (set-xorg-configuration + (xorg-configuration + (keyboard-layout keyboard-layout) + (extra-config (list #"- + Section "InputClass" + Identifier "touchpad" + Driver "libinput" + MatchIsTouchpad "on" + Option "Tapping" "on" + EndSection + "#))))) + (modify-services %desktop-services + (guix-service-type config => + (guix-configuration + (inherit config) + (substitute-urls + (append '("https://substitutes.nonguix.org") + %default-substitute-urls)) + (authorized-keys + (append (list (plain-file "non-guix.pub" #"- + (public-key + (ecc + (curve Ed25519) + (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#))) + "#)) + %default-authorized-guix-keys))))))) + (bootloader + (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets (list "/boot/efi")) + (keyboard-layout keyboard-layout))) + (mapped-devices + (list + (mapped-device + (source (uuid "6b0d38a6-d93e-4f8e-a59a-7729f5adf892")) + (target "cryptroot") + (type luks-device-mapping)))) + (file-systems + (append + (list + (file-system + (mount-point "/boot/efi") + (device (uuid "1B26-9F4E" 'fat32)) + (type "vfat")) + (file-system + (mount-point "/") + (device "/dev/mapper/cryptroot") + (type "ext4") + (dependencies mapped-devices))) + %base-file-systems))) diff --git a/.usr/etc/hg/hgrc b/.usr/etc/hg/hgrc new file mode 100644 index 0000000..656f40b --- /dev/null +++ b/.usr/etc/hg/hgrc @@ -0,0 +1,2 @@ +[ui] +username = EuAndreh diff --git a/.usr/etc/i3/config b/.usr/etc/i3/config new file mode 100644 index 0000000..7392d64 --- /dev/null +++ b/.usr/etc/i3/config @@ -0,0 +1,157 @@ +set $mod Mod4 + + +# font pango:monospace 8 + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +font pango:DejaVu Sans Mono 8 + +# Start XDG autostart .desktop files using dex. See also +# https://wiki.archlinux.org/index.php/XDG_Autostart +exec --no-startup-id dex --autostart --environment i3 + +# The combination of xss-lock, nm-applet and pactl is a popular choice, so +# they are included here as an example. Modify as you see fit. + +# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the +# screen before suspend. Use loginctl lock-session to lock your screen. +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork + +# NetworkManager is the most popular way to manage wireless networks on Linux, +# and nm-applet is a desktop environment-independent system tray GUI for it. +exec --no-startup-id nm-applet + +# Use pactl to adjust volume in PulseAudio. +set $refresh_i3status killall -SIGUSR1 i3status +bindsym F1 exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym F2 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status +bindsym F3 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status + +bindsym F5 exec --no-startup-id playerctl play-pause && $refresh_i3status + + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +bindsym $mod+Return exec st +bindsym $mod+Shift+q kill +bindsym $mod+p exec --no-startup-id dmenu_run + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# bindsym $mod+h split h # what is this? + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e 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'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + # bindsym Left resize shrink width 10 px or 10 ppt + # bindsym Down resize grow height 10 px or 10 ppt + # bindsym Up resize shrink height 10 px or 10 ppt + # bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Caps_Lock mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + position top + status_command i3status +} + +default_border pixel +default_floating_border pixel diff --git a/.usr/etc/info/infokey b/.usr/etc/info/infokey new file mode 100644 index 0000000..90edc50 --- /dev/null +++ b/.usr/etc/info/infokey @@ -0,0 +1,7 @@ +^e down-line +^y up-line + +#var +link-style=cyan +active-link-style=blue,bold +match-style=underline,bold,bggreen diff --git a/.usr/etc/khal/config b/.usr/etc/khal/config new file mode 120000 index 0000000..dfae173 --- /dev/null +++ b/.usr/etc/khal/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/khal/config \ No newline at end of file diff --git a/.usr/etc/khard/khard.conf b/.usr/etc/khard/khard.conf new file mode 120000 index 0000000..f015b29 --- /dev/null +++ b/.usr/etc/khard/khard.conf @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/khard/khard.conf \ No newline at end of file diff --git a/.usr/etc/mailcaps/config b/.usr/etc/mailcaps/config new file mode 100644 index 0000000..aeea68d --- /dev/null +++ b/.usr/etc/mailcaps/config @@ -0,0 +1 @@ +text/html; w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput diff --git a/.usr/etc/mbsync/config b/.usr/etc/mbsync/config new file mode 120000 index 0000000..68a3234 --- /dev/null +++ b/.usr/etc/mbsync/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/mbsync/config \ No newline at end of file diff --git a/.usr/etc/msmtp/config b/.usr/etc/msmtp/config new file mode 120000 index 0000000..45cd0ac --- /dev/null +++ b/.usr/etc/msmtp/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/msmtp/config \ No newline at end of file diff --git a/.usr/etc/newsboat/urls b/.usr/etc/newsboat/urls new file mode 120000 index 0000000..3c453f5 --- /dev/null +++ b/.usr/etc/newsboat/urls @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/newsboat/urls \ No newline at end of file diff --git a/.usr/etc/notmuch/default/config b/.usr/etc/notmuch/default/config new file mode 120000 index 0000000..3b9d2f4 --- /dev/null +++ b/.usr/etc/notmuch/default/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/notmuch/default/config \ No newline at end of file diff --git a/.usr/etc/python/pythonrc.py b/.usr/etc/python/pythonrc.py new file mode 100644 index 0000000..1fc3bfe --- /dev/null +++ b/.usr/etc/python/pythonrc.py @@ -0,0 +1,15 @@ +import os +import atexit +import readline + +history = os.path.join(os.environ["XDG_STATE_HOME"], "python-history") + +try: + readline.read_history_file(history) +except OSError: + pass + +def write_history(): + readline.write_history_file(history) + +atexit.register(write_history) diff --git a/.usr/etc/ranger/rc.conf b/.usr/etc/ranger/rc.conf new file mode 100644 index 0000000..ed2b538 --- /dev/null +++ b/.usr/etc/ranger/rc.conf @@ -0,0 +1 @@ +map DD shell trash %s diff --git a/.usr/etc/sbcl/sbclrc.lisp b/.usr/etc/sbcl/sbclrc.lisp new file mode 100644 index 0000000..df7f57a --- /dev/null +++ b/.usr/etc/sbcl/sbclrc.lisp @@ -0,0 +1,6 @@ +;;; The following lines added by ql:add-to-init-file: +#-quicklisp +(let ((quicklisp-init (merge-pathnames "dev/quicklisp/setup.lisp" + (user-homedir-pathname)))) + (when (probe-file quicklisp-init) + (load quicklisp-init))) diff --git a/.usr/etc/ssh/known_hosts b/.usr/etc/ssh/known_hosts new file mode 100644 index 0000000..ad6b0b2 --- /dev/null +++ b/.usr/etc/ssh/known_hosts @@ -0,0 +1,74 @@ +|1|G2vfdmQ84glwobYXZZ0d+cCMVRE=|DZJYmWjbeP52J4K7+Bsz2e0dgBA= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +|1|yosAhKlbZt51FfD2VvQJiVijSBA=|BFEig1gqq4EwCHEHagEASQZQmNI= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +|1|5yKbUaAB5AFz4MINtTVhVAPwMtU=|LwcI5Z8hXwwKxtkk4KDpeZduyPQ= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +|1|sfEM3JnFec93XEzMf9A6TkthgdI=|oZX7oe9eBKYMrXLcoFydh70my5A= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +|1|F/E3nafzrpMZEzyN8iA++okJ7Q4=|T00Gk7F90YmbaTMSOGjP8yhls94= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMylg2eib0byVT2R7dVFkxdhXO5pvgllnszKhlHiEP15ee8IjMYNPvz2A605hUdIxXtsBgjf+u7jlubh6mbx/YA= +|1|jSpDKjDomux2z3O/ok/UPGGQ8xs=|ZP60naGKQnpK6yHGD+B/+ykB05c= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMylg2eib0byVT2R7dVFkxdhXO5pvgllnszKhlHiEP15ee8IjMYNPvz2A605hUdIxXtsBgjf+u7jlubh6mbx/YA= +|1|PJybLcZRkpN9IyDsqaNjGO6lE5Y=|K0nchvCA7XV91J2X6l0h2DwOmyI= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +|1|zzdSJf8JIMfi5sKbc/mNcBy/RB8=|0GxC/CesxJHcRdt8MuPVjfab06k= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +|1|X5OmtKdXZh2kC//XCXEEOim7tgE=|Rh5ro2oEB4MN8MP6PRbG3QBR0Kk= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +46.101.43.82 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLIGIc5X12Y61eVcKJnNzCvrPeSKgyKgElqGl7QDeGeynE33sRVoNAg9aqkgXdc2MkN+nFhEWELkjPuBKYsyp2I= +hinarioespirita.org,167.99.34.30 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= +pt.hinarioespirita.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= +mtm.hinarioespirita.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= +77.109.148.18 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +35.231.145.151 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +git.sr.ht,173.195.146.142 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +192.168.33.10 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCL+hEiW/Va2L6y5Y4MyxRBXHJw/9bIC02M3wGVe1zaD3DT8wsAUcJ2QO1lJILudvMInx+SaPyJmwBvUn58YR2c= +173.195.146.152 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +2001:1620:2019::218 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +140.82.114.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +140.82.113.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +140.82.113.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +140.82.114.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +2604:bf00:710:0:5054:ff:fe7d:8fa8 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +azusa.runners.sr.ht,2604:bf00:710:0:ae1f:6bff:fead:55a ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPzxK5AM1FdMI9gZVDpw2O5iiS/49QokWpzANFntVt0Qig4qdBt4K7B0O6MrwggLh3A+zBlsXCMoWtvFtPQgLxA= +18.228.52.138 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +18.231.5.6 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +2604:bf00:710:0:5054:ff:fe36:ebc6 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +18.228.67.229 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +hg.sr.ht,2604:bf00:710:0:5054:ff:fe25:1aa6 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL4aNGa+KnvMA0QoWrIVuI2QBU0Q/xX48sMBl3VtP/zPOGMvS50zGVMaA00RSzfcI2X0v/aUTsVm2vBNo/V1gTg= +euandre.org,2a03:b0c0:3:d0::387:b001 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF6wlJqwd7KWLzLovwnwbTmNfO4E4yVDyqxAAlUkn9eDsTtzV1RYNDsaLPWv4mweJqP4crZPFxg40sFVeMDbkC0= +2606:4700:90:0:f22e:fbec:5bed:a9b9 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +46.101.160.115 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF6wlJqwd7KWLzLovwnwbTmNfO4E4yVDyqxAAlUkn9eDsTtzV1RYNDsaLPWv4mweJqP4crZPFxg40sFVeMDbkC0= +173.195.146.249 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPzxK5AM1FdMI9gZVDpw2O5iiS/49QokWpzANFntVt0Qig4qdBt4K7B0O6MrwggLh3A+zBlsXCMoWtvFtPQgLxA= +2604:a880:800:14::32:4000 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK8YTumqLFAL5MJ0AcDtFG9dWfbkJKU7FUDlH0xEgAZvHGU57TBr9DIQy2OHrxCxuhk9bZEUX8+vJiRXE05+Rzs= +2001:19f0:7001:5cec:5400:2ff:feec:9940 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPYRWlGutc+bRJ+N0sXHxhgnDsRvRoauQ92yM1U7N+8a +2001:19f0:6c01:2cf0:5400:2ff:feec:99c5 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMGiiEXB+koPS1vgGkwdExk2Q5fGv3Yc5rf8jVHB2FB7 +45.32.155.96 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN +45.77.65.204 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN +136.244.85.68 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN +199.247.0.136 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +euandreh.xyz ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +136.244.80.130 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +209.250.232.122 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +git.euandreh.xyz ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +80.240.24.148 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +95.179.246.150 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +45.77.52.185 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +199.247.2.245 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +140.82.112.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +104.238.176.223 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +172.65.251.78 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +140.82.112.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +45.32.158.17 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +95.179.253.243 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +95.179.163.103 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +217.69.2.177 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +arrobaponto.org,104.238.167.189 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +104.238.176.81 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +git.arrobaponto.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +173.199.70.52 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +[remembering.euandreh.xyz]:23841 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +167.71.86.194 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCXg/l/grol/OAY95VphKbVn4yXUStSWpxQjnka7PWXzWyForfX+fpmY+p72r1Uimx5oXIFISt8uSZW/tvD61iQ= +[localhost]:10022 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLHACdQJXUj5e4Znyh7KdTjB1RLznSfStRw6cuHZlu8rhANVfkjt300Fum9Jv6yLra6W4v2FLALWfcYpOlUzt9c= +107.191.63.70 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMONpsqwH79f/MsjtsOPitT5C+3hPPJqVh42oHMKOen6 +217.69.11.49 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr +[arrobaponto.org]:23213 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr +anoncvs.netbsd.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA3QiBl8leG9fqIJpKeNov0PKq5YryFFiroMWOPUv4hDFn8R0jC07YVaR/OSBrr37CTmGX5AFceXPzoFnLlwCqWR7rXg4NR75FTlTp9CG9EBAEtU8mee27KDrUFBTZdfVl2+aRYoAI5fTXA+0vpIO68Cq843vRWUZCcwinS4cNLUU= +git.2f30.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSLZ4G5w4NysBUmAHmr6/V9om42IHSUCtqrNdhWoYQ0 +[arrobaponto.org]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 +[199.247.13.53]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 +[2001:19f0:6801:988:5400:3ff:fea1:b566]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 +[gerrit.wikimedia.org]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCF8pwFLehzCXhbF1jfHWtd9d1LFq2NirplEBQYs7AOrGwQ/6ZZI0gvZFYiEiaw1o+F1CMfoHdny1VfWOJF3mJ1y9QMKAacc8/Z3tG39jBKRQCuxmYLO1SWymv7/Uvx9WQlkNRoTdTTa9OJFy6UqvLQEXKYaokfMIUHZ+oVFf1CgQ== +2001:19f0:5:1d65:5400:3ff:fee3:7463 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF2EgU3IgCwv1ynnWfxFm0SHTSoE0AYG3MJT/TpN3pBz diff --git a/.usr/etc/tmux/tmux.conf b/.usr/etc/tmux/tmux.conf new file mode 100644 index 0000000..dd718ca --- /dev/null +++ b/.usr/etc/tmux/tmux.conf @@ -0,0 +1,81 @@ +# Use personal prefix over "C-b" +unbind C-b +set -g prefix C-v + +# Turn on mouse mode +# https://groups.google.com/forum/#!msg/tmux-users/TRwPgEOVqho/Ck_oth_SDgAJ +# https://github.com/tmux/tmux/blob/310f0a960ca64fa3809545badc629c0c166c6cd2/CHANGES#L12 +set -g mouse on + +# Bind "C-x r" to reload the configuration file +bind-key r source-file $XDG_CONFIG_HOME/tmux/tmux.conf \; display-message "$XDG_CONFIG_HOME/tmux.conf reloaded" + +# Holy answer that properly implements copying from tmux! +# https://unix.stackexchange.com/a/349020/276661 +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xclip -selection clipboard -i" \; +bind-key y send-keys -X copy-pipe "xclip -selection clipboard -i" \; display-message "Copied system clipboard! Hooray! Long-live tmux!" + +# Moving around panes +bind-key -n M-h select-pane -L +bind-key -n M-j select-pane -D +bind-key -n M-k select-pane -U +bind-key -n M-l select-pane -R + +# Resizing panes +bind-key -n M-H resize-pane -L 5 +bind-key -n M-J resize-pane -D 5 +bind-key -n M-K resize-pane -U 5 +bind-key -n M-L resize-pane -R 5 + +# Reorder windows +bind-key -n C-S-Left swap-window -t -1\; select-window -t -1 +bind-key -n C-S-Right swap-window -t +1\; select-window -t +1 +# +# To change the number of a window, use: PREFIX-., and pick a new unused number +# + +# Join windows +bind-key -n C-S-M-Left join-pane -s :-0 -t :-1 +bind-key -n C-S-M-Right join-pane -s :-0 -t :+1 + +# "M m" to actually clear the pane history +bind -n M-m send-keys -R \; clear-history + +# Keybinding to activate pane typing sync +# https://stackoverflow.com/questions/25909964/tmux-how-to-toggle-on-and-off-options-with-the-same-key +bind-key b setw synchronize-panes \; display-message "synchronize-panes toggle" + +setw -g mode-keys vi # Move around with vi keys +set-option -g status-key "vi" # Use vi mode for status bar command (like after typing "C-x [" one can search with "/") +set-option -g status-bg "#666666" # Status bar background color +set-option -g status-fg "#aaaaaa" # Status bar foreground color +set-option -g status-left-length 50 # session name in status bar length =[annex]= part +set-option -g history-limit 150000 # How many lines of history to keep +set-option -g status-right "" + +# Set the panes initial index value to 1 instead of 0 +# 0 is too far from ` ;) +set -g base-index 1 +set-window-option -g pane-base-index 1 + +# Automatically set window title +set-window-option -g automatic-rename on +set-option -g set-titles on + +# Set "correct term" +# https://wiki.archlinux.org/index.php/Tmux +set -g default-terminal screen-256color + +# No delay for escape key press +# https://mutelight.org/practical-tmux#faster-command-sequences +set -sg escape-time 0 + +# Display pane numbers for longer +# https://unix.stackexchange.com/questions/307696/how-to-increase-tmux-pane-numbers-display-time-ctrl-b-q +set -g display-panes-time 2500 + +bind-key t resize-pane -x 80 + +bind -n M-r attach-session -t . -c '#{pane_current_path}' \; display-message "CWD for session updated to #{pane_current_path}!" + +bind-key u capture-pane \; save-buffer /tmp/tmux-urlscan-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan < /tmp/tmux-urlscan-buffer"' diff --git a/.usr/etc/weechat/irc.conf b/.usr/etc/weechat/irc.conf new file mode 120000 index 0000000..7dff360 --- /dev/null +++ b/.usr/etc/weechat/irc.conf @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/weechat/irc.conf \ No newline at end of file -- cgit v1.2.3 From f271b1d573405c4bddcd0af3aeb04e317926d6eb Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 10:57:02 -0300 Subject: mv ~/Maildir/.notmuch/hooks/ ~/.usr/etc/notmuch/default/ --- .usr/etc/notmuch/default/hooks/post-new | 1 + Maildir/.notmuch/hooks/post-new | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 120000 .usr/etc/notmuch/default/hooks/post-new delete mode 120000 Maildir/.notmuch/hooks/post-new diff --git a/.usr/etc/notmuch/default/hooks/post-new b/.usr/etc/notmuch/default/hooks/post-new new file mode 120000 index 0000000..7992789 --- /dev/null +++ b/.usr/etc/notmuch/default/hooks/post-new @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/notmuch/post-new \ No newline at end of file diff --git a/Maildir/.notmuch/hooks/post-new b/Maildir/.notmuch/hooks/post-new deleted file mode 120000 index 7992789..0000000 --- a/Maildir/.notmuch/hooks/post-new +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/notmuch/post-new \ No newline at end of file -- cgit v1.2.3 From b9d1cc3f8c43cd7f53631c3f43e5f887967be6ae Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 10:58:51 -0300 Subject: .usr/etc/i3/config: WIP setup extra bindings --- .usr/etc/i3/config | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.usr/etc/i3/config b/.usr/etc/i3/config index 7392d64..0b41311 100644 --- a/.usr/etc/i3/config +++ b/.usr/etc/i3/config @@ -21,6 +21,9 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork # NetworkManager is the most popular way to manage wireless networks on Linux, # and nm-applet is a desktop environment-independent system tray GUI for it. exec --no-startup-id nm-applet +exec --no-startup-id blueman-applet +exec --no-startup-id poweralertd +exec dunst # Use pactl to adjust volume in PulseAudio. set $refresh_i3status killall -SIGUSR1 i3status @@ -28,7 +31,20 @@ bindsym F1 exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $re bindsym F2 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status bindsym F3 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status -bindsym F5 exec --no-startup-id playerctl play-pause && $refresh_i3status +bindsym F4 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` position 5- +bindsym Shift+F4 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` previous +bindsym F5 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` play-pause +Bindsym Shift+F5 exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/rotate-mpris-player.sh +bindsym F6 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` position 5+ +bindsym Shift+F6 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` next + +# FIXME bad path +bindsym F7 exec --no-startup-id ~/.local/bin/brightness -1 +bindsym F8 exec --no-startup-id ~/.local/bin/brightness +1 + + + +bindsym $mod+Shift+s exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/toggle-pulseaudio-sink.sh && $refresh_i3status # Use Mouse+$mod to drag floating windows to their wanted position @@ -38,6 +54,18 @@ bindsym $mod+Return exec st bindsym $mod+Shift+q kill bindsym $mod+p exec --no-startup-id dmenu_run + + + +# FIXME: better placement of these files +bindsym $mod+o exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-emoji.sh +bindsym $mod+v exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-clipmenu.sh +bindsym $mod+i exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass.sh +bindsym $mod+Control+i exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass-login.sh + + + + # change focus bindsym $mod+h focus left bindsym $mod+j focus down @@ -53,7 +81,8 @@ bindsym $mod+Shift+l move right # bindsym $mod+h split h # what is this? # split in vertical orientation -bindsym $mod+v split v +# FIXME: what is this? It was in conflict with dmenu-clipmenu +# bindsym $mod+v split v # enter fullscreen mode for the focused container bindsym $mod+f fullscreen toggle -- cgit v1.2.3 From 90eaebabcaaea74237f34cf05709625345f276cc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 12:01:54 -0300 Subject: Move Git repository into ~/.usr/.git/ --- .usr/bin/backup | 128 -------------------- .usr/bin/brightness | 13 -- .usr/bin/clamp | 74 ------------ .usr/bin/color | 204 -------------------------------- .usr/bin/copy | 67 ----------- .usr/bin/e | 79 ------------- .usr/bin/email | 74 ------------ .usr/bin/gc | 105 ---------------- .usr/bin/grun | 102 ---------------- .usr/bin/max | 61 ---------- .usr/bin/min | 61 ---------- .usr/bin/mkdtemp | 24 ---- .usr/bin/mkstemp | 24 ---- .usr/bin/msg | 90 -------------- .usr/bin/open | 101 ---------------- .usr/bin/pre | 72 ----------- .usr/bin/print | 151 ----------------------- .usr/bin/qr | 58 --------- .usr/bin/rfc | 117 ------------------ .usr/bin/tmpname | 52 -------- .usr/bin/uuid | 53 --------- .usr/bin/with-email | 84 ------------- .usr/bin/without-env | 76 ------------ .usr/bin/xdg-open | 1 - .usr/bin/xmpp | 89 -------------- .usr/etc/afew/config | 6 - .usr/etc/alot/config | 1 - .usr/etc/bash/check.sh | 57 --------- .usr/etc/bash/inputrc | 2 - .usr/etc/bash/privrc.sh | 1 - .usr/etc/bash/vcs-ps1.sh | 158 ------------------------- .usr/etc/gnupg/gpg.conf | 1 - .usr/etc/gnupg/sshcontrol | 1 - .usr/etc/guix/channels.scm | 20 ---- .usr/etc/guix/home.scm | 152 ------------------------ .usr/etc/guix/system.scm | 102 ---------------- .usr/etc/hg/hgrc | 2 - .usr/etc/i3/config | 186 ----------------------------- .usr/etc/info/infokey | 7 -- .usr/etc/khal/config | 1 - .usr/etc/khard/khard.conf | 1 - .usr/etc/mailcaps/config | 1 - .usr/etc/mbsync/config | 1 - .usr/etc/msmtp/config | 1 - .usr/etc/newsboat/urls | 1 - .usr/etc/notmuch/default/config | 1 - .usr/etc/notmuch/default/hooks/post-new | 1 - .usr/etc/python/pythonrc.py | 15 --- .usr/etc/ranger/rc.conf | 1 - .usr/etc/sbcl/sbclrc.lisp | 6 - .usr/etc/ssh/known_hosts | 74 ------------ .usr/etc/tmux/tmux.conf | 81 ------------- .usr/etc/weechat/irc.conf | 1 - bin/backup | 128 ++++++++++++++++++++ bin/brightness | 13 ++ bin/clamp | 74 ++++++++++++ bin/color | 204 ++++++++++++++++++++++++++++++++ bin/copy | 67 +++++++++++ bin/e | 79 +++++++++++++ bin/email | 74 ++++++++++++ bin/gc | 105 ++++++++++++++++ bin/grun | 102 ++++++++++++++++ bin/max | 61 ++++++++++ bin/min | 61 ++++++++++ bin/mkdtemp | 24 ++++ bin/mkstemp | 24 ++++ bin/msg | 90 ++++++++++++++ bin/open | 101 ++++++++++++++++ bin/pre | 72 +++++++++++ bin/print | 151 +++++++++++++++++++++++ bin/qr | 58 +++++++++ bin/rfc | 117 ++++++++++++++++++ bin/tmpname | 52 ++++++++ bin/uuid | 53 +++++++++ bin/with-email | 84 +++++++++++++ bin/without-env | 76 ++++++++++++ bin/xdg-open | 1 + bin/xmpp | 89 ++++++++++++++ etc/afew/config | 6 + etc/alot/config | 1 + etc/bash/check.sh | 57 +++++++++ etc/bash/inputrc | 2 + etc/bash/privrc.sh | 1 + etc/bash/vcs-ps1.sh | 158 +++++++++++++++++++++++++ etc/gnupg/gpg.conf | 1 + etc/gnupg/sshcontrol | 1 + etc/guix/channels.scm | 20 ++++ etc/guix/home.scm | 152 ++++++++++++++++++++++++ etc/guix/system.scm | 102 ++++++++++++++++ etc/hg/hgrc | 2 + etc/i3/config | 186 +++++++++++++++++++++++++++++ etc/info/infokey | 7 ++ etc/khal/config | 1 + etc/khard/khard.conf | 1 + etc/mailcaps/config | 1 + etc/mbsync/config | 1 + etc/msmtp/config | 1 + etc/newsboat/urls | 1 + etc/notmuch/default/config | 1 + etc/notmuch/default/hooks/post-new | 1 + etc/python/pythonrc.py | 15 +++ etc/ranger/rc.conf | 1 + etc/sbcl/sbclrc.lisp | 6 + etc/ssh/known_hosts | 74 ++++++++++++ etc/tmux/tmux.conf | 81 +++++++++++++ etc/weechat/irc.conf | 1 + 106 files changed, 2842 insertions(+), 2842 deletions(-) delete mode 100755 .usr/bin/backup delete mode 100755 .usr/bin/brightness delete mode 100755 .usr/bin/clamp delete mode 100755 .usr/bin/color delete mode 100755 .usr/bin/copy delete mode 100755 .usr/bin/e delete mode 100755 .usr/bin/email delete mode 100755 .usr/bin/gc delete mode 100755 .usr/bin/grun delete mode 100755 .usr/bin/max delete mode 100755 .usr/bin/min delete mode 100755 .usr/bin/mkdtemp delete mode 100755 .usr/bin/mkstemp delete mode 100755 .usr/bin/msg delete mode 100755 .usr/bin/open delete mode 100755 .usr/bin/pre delete mode 100755 .usr/bin/print delete mode 100755 .usr/bin/qr delete mode 100755 .usr/bin/rfc delete mode 100755 .usr/bin/tmpname delete mode 100755 .usr/bin/uuid delete mode 100755 .usr/bin/with-email delete mode 100755 .usr/bin/without-env delete mode 120000 .usr/bin/xdg-open delete mode 100755 .usr/bin/xmpp delete mode 100644 .usr/etc/afew/config delete mode 120000 .usr/etc/alot/config delete mode 100755 .usr/etc/bash/check.sh delete mode 100644 .usr/etc/bash/inputrc delete mode 120000 .usr/etc/bash/privrc.sh delete mode 100644 .usr/etc/bash/vcs-ps1.sh delete mode 100644 .usr/etc/gnupg/gpg.conf delete mode 100644 .usr/etc/gnupg/sshcontrol delete mode 100644 .usr/etc/guix/channels.scm delete mode 100644 .usr/etc/guix/home.scm delete mode 100644 .usr/etc/guix/system.scm delete mode 100644 .usr/etc/hg/hgrc delete mode 100644 .usr/etc/i3/config delete mode 100644 .usr/etc/info/infokey delete mode 120000 .usr/etc/khal/config delete mode 120000 .usr/etc/khard/khard.conf delete mode 100644 .usr/etc/mailcaps/config delete mode 120000 .usr/etc/mbsync/config delete mode 120000 .usr/etc/msmtp/config delete mode 120000 .usr/etc/newsboat/urls delete mode 120000 .usr/etc/notmuch/default/config delete mode 120000 .usr/etc/notmuch/default/hooks/post-new delete mode 100644 .usr/etc/python/pythonrc.py delete mode 100644 .usr/etc/ranger/rc.conf delete mode 100644 .usr/etc/sbcl/sbclrc.lisp delete mode 100644 .usr/etc/ssh/known_hosts delete mode 100644 .usr/etc/tmux/tmux.conf delete mode 120000 .usr/etc/weechat/irc.conf create mode 100755 bin/backup create mode 100755 bin/brightness create mode 100755 bin/clamp create mode 100755 bin/color create mode 100755 bin/copy create mode 100755 bin/e create mode 100755 bin/email create mode 100755 bin/gc create mode 100755 bin/grun create mode 100755 bin/max create mode 100755 bin/min create mode 100755 bin/mkdtemp create mode 100755 bin/mkstemp create mode 100755 bin/msg create mode 100755 bin/open create mode 100755 bin/pre create mode 100755 bin/print create mode 100755 bin/qr create mode 100755 bin/rfc create mode 100755 bin/tmpname create mode 100755 bin/uuid create mode 100755 bin/with-email create mode 100755 bin/without-env create mode 120000 bin/xdg-open create mode 100755 bin/xmpp create mode 100644 etc/afew/config create mode 120000 etc/alot/config create mode 100755 etc/bash/check.sh create mode 100644 etc/bash/inputrc create mode 120000 etc/bash/privrc.sh create mode 100644 etc/bash/vcs-ps1.sh create mode 100644 etc/gnupg/gpg.conf create mode 100644 etc/gnupg/sshcontrol create mode 100644 etc/guix/channels.scm create mode 100644 etc/guix/home.scm create mode 100644 etc/guix/system.scm create mode 100644 etc/hg/hgrc create mode 100644 etc/i3/config create mode 100644 etc/info/infokey create mode 120000 etc/khal/config create mode 120000 etc/khard/khard.conf create mode 100644 etc/mailcaps/config create mode 120000 etc/mbsync/config create mode 120000 etc/msmtp/config create mode 120000 etc/newsboat/urls create mode 120000 etc/notmuch/default/config create mode 120000 etc/notmuch/default/hooks/post-new create mode 100644 etc/python/pythonrc.py create mode 100644 etc/ranger/rc.conf create mode 100644 etc/sbcl/sbclrc.lisp create mode 100644 etc/ssh/known_hosts create mode 100644 etc/tmux/tmux.conf create mode 120000 etc/weechat/irc.conf diff --git a/.usr/bin/backup b/.usr/bin/backup deleted file mode 100755 index cab37dc..0000000 --- a/.usr/bin/backup +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - backup [-v] [-C COMMENT] ARCHIVE_TAG - backup -h - EOF -} - -help() { - cat <<-'EOF' - - - Options: - -v enable verbose mode, useful for - interactive sessions - -C COMMENT the comment text to be attached to the archive - -h, --help show this message - - ARCHIVE_TAG the tag used to create the new - backup (default: "cronjob") - - - The repository is expected to have been created with: - - $ borg init -e repokey-blake2 - - The following environment variables are expected to be exported: - - $BORG_PASSCOMMAND - $BORG_REPO - $BORG_REMOTE_PATH - - Password-less SSH access is required, usually done via adding - ~/.ssh/id_rsa.pub to suyin:.ssh/authorized_keys. - - - Examples: - - Run backup from cronjob: - - $ backup cronjob - - Create backup with comment, and verbose mode active: - - $ backup -vC 'The backup has a comment' my-backup - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -VERBOSE_FLAGS='' -COMMENT='' -while getopts 'vC:h' flag; do - case "$flag" in - v) - VERBOSE_FLAGS='--verbose --progress' - ;; - C) - COMMENT="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -ARCHIVE_TAG="${1:-}" -assert_arg "$ARCHIVE_TAG" 'ARCHIVE_TAG' - - -finish() { - STATUS=$? - printf '\n>>>\n>>> exit status: %s\n>>>\n\n' "$STATUS" >&2 -} -trap finish EXIT - -run() { - borg create \ - $VERBOSE_FLAGS \ - --comment "$COMMENT" \ - --exclude ~/.cache/ \ - --exclude ~/Downloads/ \ - --stats \ - --compression lzma,9 \ - "::{hostname}-{now}-$ARCHIVE_TAG" \ - ~/ - STATUS=$? - - if [ "$STATUS" = 0 ] || [ "$STATUS" = 1 ]; then - echo 'WARNING, but no ERROR.' >&2 - return 0 - else - return "$STATUS" - fi -} - -run || exit $? diff --git a/.usr/bin/brightness b/.usr/bin/brightness deleted file mode 100755 index 8e178ad..0000000 --- a/.usr/bin/brightness +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -eu - -BRIGHTNESS_DIFF="$1" - -DEVICE="$(cat "$XDG_CONFIG_HOME"/backlight-device)" -HANDLER="/sys/class/backlight/$DEVICE" - -OLD_BRIGHTNESS="$(cat "$HANDLER"/brightness)" -MAX_BRIGHTNESS="$(cat "$HANDLER"/max_brightness)" -SUM=$((OLD_BRIGHTNESS + BRIGHTNESS_DIFF)) -NEW_BRIGHTNESS="$(clamp -- "$SUM" 0 "$MAX_BRIGHTNESS")" -echo "$NEW_BRIGHTNESS" > "$HANDLER"/brightness || sudo chmod 666 "$HANDLER/brightness" diff --git a/.usr/bin/clamp b/.usr/bin/clamp deleted file mode 100755 index a40b823..0000000 --- a/.usr/bin/clamp +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - clamp NUMBER MIN MAX - clamp -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Clamp the NUMBER between MIN and MAX. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -NUMBER="${1:-}" -MIN="${2:-}" -MAX="${3:-}" - -assert_arg "$NUMBER" 'NUMBER' -assert_arg "$MIN" 'MIN' -assert_arg "$MAX" 'MAX' - - -if [ "$MIN" -gt "$MAX" ]; then - printf 'MIN (%s) is greater then MAX (%s).\n' "$MIN" "$MAX" >&2 - exit 2 -fi - -min -- "$(max -- "$NUMBER" "$MIN")" "$MAX" diff --git a/.usr/bin/color b/.usr/bin/color deleted file mode 100755 index 0597278..0000000 --- a/.usr/bin/color +++ /dev/null @@ -1,204 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - color -c COLOR TEXT - color -h - EOF -} - -help() { - cat <<-'EOF' - - - Options: - -c COLOR - -h, --help show this message - - - The available colors are: - EOF - list_colors | sed 's/^/ /' -} - - -END="\033[0m" - -black() { - BLACK="\033[0;30m" - printf "${BLACK}${1}${END}" -} - -blackb() { - BLACK_B="\033[1;30m" - printf "${BLACK_B}${1}${END}" -} - -blacki() { - BLACK_I="\033[0;90m" - printf "${BLACK_I}${1}${END}" -} - -white() { - WHITE="\033[0;37m" - printf "${WHITE}${1}${END}" -} - -whiteb() { - WHITE_B="\033[1;37m" - printf "${WHITE_B}${1}${END}" -} - -red() { - RED="\033[0;31m" - printf "${RED}${1}${END}" -} - -redb() { - RED_B="\033[1;31m" - printf "${RED_B}${1}${END}" -} - -green() { - GREEN="\033[0;32m" - printf "${GREEN}${1}${END}" -} - -greenb() { - GREEN_B="\033[1;32m" - printf "${GREEN_B}${1}${END}" -} - -yellow() { - YELLOW="\033[0;33m" - printf "${YELLOW}${1}${END}" -} - -yellowb() { - YELLOW_B="\033[1;33m" - printf "${YELLOW_B}${1}${END}" -} - -blue() { - BLUE="\033[0;34m" - printf "${BLUE}${1}${END}" -} - -blueb() { - BLUE_B="\033[1;34m" - printf "${BLUE_B}${1}${END}" -} - -bluei() { - BLUE_I="\033[0;94m" - printf "${BLUE_I}${1}${END}" -} - -purple() { - PURPLE="\033[0;35m" - printf "${PURPLE}${1}${END}" -} - - -purpleb() { - PURPLE_B="\033[1;35m" - printf "${PURPLE_B}${1}${END}" -} - -lightblue() { - LIGHT_BLUE="\033[0;36m" - printf "${LIGHT_BLUE}${1}${END}" -} - -lightblueb() { - LIGHT_BLUE_B="\033[1;36m" - printf "${LIGHT_BLUE_B}${1}${END}" -} - -COLOR_LIST=' -black -blackb -white -whiteb -red -redb -green -greenb -yellow -yellowb -blue -blueb -purple -purpleb -lightblue -lightblueb -blacki -bluei -' -list_colors() { - for c in $COLOR_LIST; do - printf '%s\n' "$("$c" "$c")" - done -} - - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'c:h' flag; do - case "$flag" in - c) - EXISTS=false - for c in $COLOR_LIST; do - if [ "$OPTARG" = "$c" ]; then - EXISTS=true - break - fi - done - if [ "$EXISTS" = false ]; then - printf 'Invalid color: %s\n' "$OPTARG" >&2 - exit 2 - fi - COLOR_FN="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -TEXT="${1:-}" -assert_arg "$COLOR_FN" '-c COLOR' -assert_arg "$TEXT" 'TEXT' - - -"$COLOR_FN" "$TEXT" diff --git a/.usr/bin/copy b/.usr/bin/copy deleted file mode 100755 index 64e1e32..0000000 --- a/.usr/bin/copy +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - copy [-n] < STDIN - copy -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -n remove newlines - -h, --help show this message - - Examples: - - Copy numbers to clipboard: - seq 10 | copy - - Copy string without newline: - echo 'with automatic newline' | copy -n - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -TRIM=false -while getopts 'nh' flag; do - case "$flag" in - n) - TRIM=true - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -if [ "$TRIM" = true ]; then - cat - | tr -d '\n' | xclip -sel clip -else - cat - | xclip -sel clip -fi diff --git a/.usr/bin/e b/.usr/bin/e deleted file mode 100755 index 76b4899..0000000 --- a/.usr/bin/e +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - e [FILE] - e -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help - - - Flexibly run a text editor, either directly on in a pipe. - - Examples: - - Edit "file.txt": - - $ e file.txt - - Manipulate the content of a pipe midway: - - $ seq 10 | e | grep 5 - - The editor used is either $VISUAL or $EDITOR, with a fallback to - vi in case any of those variables aren't defined. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -CMD="${VISUAL:-${EDITOR:-vi}}" - -if [ ! -t 0 ]; then - F="$(mkstemp)" - cat > "$F" - exec 0&1 - exec 1>/dev/tty - $CMD "$F" - cat "$F" >&3 -else - $CMD "$@" -fi diff --git a/.usr/bin/email b/.usr/bin/email deleted file mode 100755 index 0a1fd15..0000000 --- a/.usr/bin/email +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - mail -s SUBJECT ADDRESS... < BODY - mail -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -s SUBJECT the email subject - -h, --help show this message - - ADDRESS the email addresses to send the email to - BODY the text to be sent as the body - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 's:h' flag; do - case "$flag" in - s) - SUBJECT="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - { - printf 'Missing %s.\n' "$2" - printf '\n' - usage - } >&2 - exit 2 - fi -} - -assert_arg "${SUBJECT:-}" '-s SUBJECT' -assert_arg "${1:-}" 'ADDRESS' - -printf 'Subject: %s\n\n%s' \ - "$(echo "$SUBJECT" | tr -d '\n')" \ - "$(cat)" | - msmtpq -a euandreh "$@" diff --git a/.usr/bin/gc b/.usr/bin/gc deleted file mode 100755 index ec6a8f1..0000000 --- a/.usr/bin/gc +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - gc - gc -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -disk() { - df -h . | - awk 'NR == 2 { printf "%s - %s/%s\n", $4, $3, $2 }' -} - - -gc_guix() { - pass show velhinho/0-andreh-password | sudo -S guix system delete-generations - guix home delete-generations - guix gc -d -} - -gc_nohup() { - find ~/ -type f -name 'nohup.out' -exec rm -vf "{}" \; -} - -gc_trash() { - yes | trash-empty -} - -gc_tmpdir() { - find /tmp/ -type f -atime +10 -exec rm -vf "{}" \; ||: -} - -gc_docker() { - if command -v docker; then - yes | docker system prune -a - docker rmi "$(docker images -a -q)" ||: - docker rm "$(docker ps -a -f status=exited -q)" ||: - docker stop "$(docker ps -a -q)" ||: - docker rm "$(docker ps -a -q)" ||: - yes | docker volume prune - yes | docker container prune - fi -} - -gc_email() { - notmuch search --output=files --exclude=false tag:killed | - xargs -I{} rm -vf "{}" -} - - -BEFORE="$(disk)" -gc_guix -gc_nohup -gc_trash -gc_tmpdir -gc_docker -gc_email -wait -AFTER="$(disk)" - -printf 'Disk space:\n' -printf ' before: %s\n' "$BEFORE" -printf ' after: %s\n' "$AFTER" diff --git a/.usr/bin/grun b/.usr/bin/grun deleted file mode 100755 index 5884e9e..0000000 --- a/.usr/bin/grun +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - grun [-r RECIPIENT] FILENAME -- COMMAND... - grun -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -r RECIPIENT the recipient to encrypt to. Can be given - multiple for multiple recipients. - -h, --help show this message - - COMMAND A command to be executed, that accepts input - in STDIN and emits result in STDOUT, and emits - errors as non-zero return codes. - FILENAME The GPG-encrypted file to be processed. If it - doesn't exist yet, it will be created. - - Examples: - - Edit "secrets.txt.gpg" using `vipe` and the default recipient: - - $ grun secrets.txt.gpg -- vipe - - Delete lines containing "FIXME" in todos.gpg: - - $ grun -r ABC123DEF321 todos.gpg -- sed '/FIXME/d' - - If COMMAND emits a non-zero return code, the file is left - unmodified. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'rh' flag; do - case "$flag" in - r) - RECIPIENTS_FLAG="${RECIPIENTS_FLAG:-} -r $OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -FILENAME="${1:-}" -assert_arg "$FILENAME" 'FILENAME' -shift - -if [ "${1:-}" != '--' ]; then - printf 'Missing "--" separator\n\n' >&2 - usage >&2 - exit 2 -fi -shift - -assert_arg "${1:-}" 'COMMAND' - - -if [ ! -e "$FILENAME" ]; then - OUT="$(printf '' | "$@")" -else - OUT="$(gpg -dq "$FILENAME" | "$@")" -fi - -echo "$OUT" | gpg -e ${RECIPIENTS_FLAG:--r eu@euandre.org} | sponge "$FILENAME" diff --git a/.usr/bin/max b/.usr/bin/max deleted file mode 100755 index 84585ee..0000000 --- a/.usr/bin/max +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - max NUMBER... - max -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Get the maximum number from the given values. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -if [ -z "${1:-}" ]; then - echo 0 - exit -fi - -N="$1" -for n in "$@"; do - N=$((N > n ? N : n)) -done -echo "$N" diff --git a/.usr/bin/min b/.usr/bin/min deleted file mode 100755 index 7868623..0000000 --- a/.usr/bin/min +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - min NUMBER... - min -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Get the minimun number from the given values. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -if [ -z "${1:-}" ]; then - echo 0 - exit -fi - -N="$1" -for n in "$@"; do - N=$((N < n ? N : n)) -done -echo "$N" diff --git a/.usr/bin/mkdtemp b/.usr/bin/mkdtemp deleted file mode 100755 index 9c7ddd8..0000000 --- a/.usr/bin/mkdtemp +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - mkstemp - mkstemp -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Create a new temporary file and echo its name back. - EOF -} - -name="$(tmpname)" -mkdir "$name" -echo "$name" diff --git a/.usr/bin/mkstemp b/.usr/bin/mkstemp deleted file mode 100755 index ec92c14..0000000 --- a/.usr/bin/mkstemp +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - mkstemp - mkstemp -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Create a new temporary file and echo its name back. - EOF -} - -name="$(tmpname)" -touch "$name" -echo "$name" diff --git a/.usr/bin/msg b/.usr/bin/msg deleted file mode 100755 index f3e893e..0000000 --- a/.usr/bin/msg +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - msg -X XMPP_MESSAGE -s -S SOUND_MESSAGE -m EMAIL -D DESKTOP -b - msg -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -X XMPP_MESSAGE send XMPP using the `xmpp` command - -s play ~/Desktop/medium.ogg sound - -S SOUND_MESSAGE say SOUND_MESSAGE using `speak` - -m EMAIL_SUBJECT send email with EMAIL_SUBJECT and empty body - -D DESKTOP_MESSAGE the desktop message for `notify-send` - -b print terminal bell - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -sound() { - play ~/Desktop/medium.ogg 2>/dev/null & -} - -ACTION_DONE=false -while getopts 'X:sS:m:D:bh' flag; do - case "$flag" in - X) - xmpp -m "$OPTARG" eu@euandreh.xyz - ACTION_DONE=true - ;; - s) - sound - ACTION_DONE=true - ;; - S) - echo "$OPTARG" | speak -v pt-BR - ACTION_DONE=true - ;; - m) - echo "" | email -s "$OPTARG" eu@euandre.org - ACTION_DONE=true - ;; - D) - notify-send "$OPTARG" - ACTION_DONE=true - ;; - b) - printf '\a' - ACTION_DONE=true - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done - -if [ "$ACTION_DONE" = false ]; then - sound - usage - help -fi - -wait diff --git a/.usr/bin/open b/.usr/bin/open deleted file mode 100755 index df1ad56..0000000 --- a/.usr/bin/open +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - open FILE... - open -h -EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Examples: - - Open an HTML file on the current $BROWSER: - open index.html - - Open multiple PDF files (with zathura): - open *.pdf -EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -if [ -z "${1:-}" ]; then - usage >&2 - exit 2 -fi - -for f in "$@"; do - case "$f" in - *.ico|*.jpg|*.jpeg|*.png) - feh "$f" - ;; - https://www.youtube.com/watch*) - nohup mpv "$f" 1>&2 2>/dev/null & - ;; - *.flac|*.ogg|*.mkv|*.avi|*.mp4) - nohup mpv "$f" 1>&2 2>/dev/null & - ;; - http*|*.svg|*.html) - "$BROWSER" "$f" - ;; - gopher://*) - amfora "$f" - ;; - gemini://*) - telescope "$f" - ;; - *.pdf|*.djvu|*.ps|*.epub) - nohup zathura "$f" 1>&2 2>/dev/null & - ;; - *.txt) - less "$f" - ;; - *.midi) - timidity "$f" - ;; - mailto:*) - alot compose "$f" - ;; - *) - DIR="$(cd -- "$(dirname -- "$0")"; pwd)" - CMD="$(without-env PATH "$DIR" -- command -v xdg-open)" - "$CMD" "$f" - ;; - esac -done diff --git a/.usr/bin/pre b/.usr/bin/pre deleted file mode 100755 index 233ac1a..0000000 --- a/.usr/bin/pre +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - pre [-c COLOR] PREFIX - pre -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -c COLOR ANSI color to be used on the prefix text - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -COLOR='' -while getopts 'c:h' flag; do - case "$flag" in - c) - COLOR="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -PREFIX="${1:-}" -assert_arg "$PREFIX" 'PREFIX' - -while read -r line; do - if [ -z "$COLOR" ]; then - printf '%s: %s\n' "$PREFIX" "$line" - else - printf '%s: %s\n' "$(color -c "$COLOR" "$PREFIX")" "$line" - fi -done diff --git a/.usr/bin/print b/.usr/bin/print deleted file mode 100755 index 735d8ba..0000000 --- a/.usr/bin/print +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - print [-d] [-q QUALITY] [FILE...] - print -h -EOF -} - -help() { - cat <<-'EOF' - - Options: - -d print duplex/double-sided - -q QUALITY choose the print quality, either: - low, medium (default) or high. - -h, --help show this message - - Examples: - - Print the given PostScript file with default quality: - $ print f1.ps - - Print multiple PDF files with high quality: - $ print -dq high *.pdf - - Print the file from STDIN, double-sided: - $ print -d < f2.ps - - Print multiple source code files: - $ print src/*.{c,h} -EOF -} - -mkdtemp() { - name="$(echo 'mkstemp(template)' | - m4 -D template="${TMPDIR:-/tmp}/m4-tmpname.")" - rm -f "$name" - mkdir "$name" - echo "$name" -} - -n_pages() { - pdftk "$1" dump_data | awk '/NumberOfPages/ { print $2 }' -} - -main() { - if file -b "$FILE" | grep -q PostScript; then - ps2pdf "$FILE" "$NEWDIR"/in.pdf - elif file -b "$FILE" | grep -q PDF; then - cp "$FILE" "$NEWDIR"/in.pdf - else - enscript -o- "$FILE" | ps2pdf - "$NEWDIR"/in.pdf - fi - cd "$NEWDIR" - - if [ -z "$DUPLEX" ]; then - lp in.pdf - cd - > /dev/null - return - fi - - if [ "$(n_pages in.pdf)" = '1' ]; then - lp in.pdf - return - fi - - pdftk A=in.pdf cat Aodd output odd.pdf - pdftk A=in.pdf cat Aeven output even.pdf - - NODD="$(n_pages odd.pdf)" - NEVEN="$(n_pages even.pdf)" - - printf 'Printing odd pages...\n' >&2 - lp odd.pdf - printf 'Has printing finished yet? Once it does, reload the pages and hit it enter to continue. ' - read -r < /dev/tty - lp even.pdf - - if [ "$NODD" != "$NEVEN" ]; then - printf '\n' | lp - fi - - cd - > /dev/null -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -lpoptions -o PrintQuality=standard -DUPLEX= -while getopts 'dq:h' flag; do - case "$flag" in - d) - DUPLEX=1 - ;; - q) - case "$OPTARG" in - low) - lpoptions -o PrintQuality=draft - ;; - medium) - lpoptions -o PrintQuality=standard - ;; - high) - lpoptions -o PrintQuality=high - ;; - *) - echo "Bad QUALITY option: \"$OPTARG\"" >&2 - exit 2 - ;; - esac - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -NEWDIR="$(mkdtemp)" -if [ -z "${1:-}" ]; then - FILE="$NEWDIR"/STDIN - cat - > "$FILE" - main -else - for f in "$@"; do - FILE="$f" - main - done -fi diff --git a/.usr/bin/qr b/.usr/bin/qr deleted file mode 100755 index 4821a46..0000000 --- a/.usr/bin/qr +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - qr [-s PIXEL_SIZE] - qr -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -s PIXEL_SIZE size of the pixel (default 10) - -h, --help show this help message - - Read data from STDIN and present a QR image with said data. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -PIXEL_SIZE=10 -while getopts 's:h' flag; do - case "$flag" in - s) - PIXEL_SIZE="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -cat | qrencode -s "$PIXEL_SIZE" -o- | feh - diff --git a/.usr/bin/rfc b/.usr/bin/rfc deleted file mode 100755 index a483595..0000000 --- a/.usr/bin/rfc +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/sh -set -eu - -TARBALL_URL='https://www.rfc-editor.org/in-notes/tar/RFC-all.tar.gz' - -usage() { - cat <<-'EOF' - Usage: - rfc [-w] RFC_NUMBER - rfc -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -w Show the path to the RFC file instead of displaying - its contents. - -h, --help show this message - - Lookup the given RFC - in $XDG_DATA_HOME/doc/rfc/ (defaults to ~/.local/share), - and feed it into the $PAGER, akin to doing: - - $ $PAGER $XDG_DATA_HOME/doc/rfc/rfc$RFC_NUMBER.txt - - If the $XDG_DATA_HOME/doc/rfc/ directory doesn't exist, it tries to - create it by downloading the latest RFC tarball [0] and placing all .txt - files there. - EOF - - printf '\n[0]: %s\n' "$TARBALL_URL" -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'wh' flag; do - case "$flag" in - w) - WHERE=true - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -RFC_NUMBER="${1:-}" -if [ -z "$RFC_NUMBER" ]; then - echo 'Missing argument RFC_NUMBER' >&2 - usage >&2 - exit 2 -fi - -D="${XDG_DATA_HOME:-$HOME/.local/share}/doc/rfc" -if [ ! -e "$D" ]; then - printf 'RFC directory does not exist:\n\t%s/\n\n' "$D" - printf 'Do you want to download the files to create it? [Y/n] ' - read -r yesno - if [ "$yesno" != 'n' ] && [ "$yesno" != 'N' ]; then - CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/rfc-cli" - mkdir -p "$CACHE_DIR" - wget -cO "$CACHE_DIR"/RFC-all.tar.gz "$TARBALL_URL" - rm -rf "$CACHE_DIR/tmp" - mkdir -p "$CACHE_DIR/tmp" - tar \ - -C "$CACHE_DIR/tmp" \ - -xvf "$CACHE_DIR"/RFC-all.tar.gz \ - --wildcards \ - 'rfc*.txt' - mkdir -p "$(dirname "$D")" - mv "$CACHE_DIR/tmp" "$D" - fi -fi - -F="$D/rfc${RFC_NUMBER}.txt" -if [ ! -e "$F" ]; then - printf 'Given RFC_NUMBER "%s" does not exist at:\n%s\n' \ - "$RFC_NUMBER" "$F" >&2 - exit 2 -fi - -if [ "${WHERE:-}" = true ]; then - printf '%s\n' "$F" - exit -fi - -view() { - if [ -t 1 ]; then - ${PAGER:-cat} - else - cat - fi -} - -view < "$F" diff --git a/.usr/bin/tmpname b/.usr/bin/tmpname deleted file mode 100755 index d83fc87..0000000 --- a/.usr/bin/tmpname +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - tmpname - tmpname -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Generate a temporary name. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -echo "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)" diff --git a/.usr/bin/uuid b/.usr/bin/uuid deleted file mode 100755 index 74d0fba..0000000 --- a/.usr/bin/uuid +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - uuid - uuid -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Generate UUID from /dev/random. - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -od -xN20 /dev/random | - awk 'NR == 1 { OFS="-"; print $2$3,$4,$5,$6,$7$8$9; exit }' diff --git a/.usr/bin/with-email b/.usr/bin/with-email deleted file mode 100755 index 9d6326b..0000000 --- a/.usr/bin/with-email +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - with-email [-s SUBJECT] COMMAND... - with-email -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -s SUBJECT set the subject of the email - -h, --help show this message - - COMMAND the command to be wrapped - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -SUBJECT='NO SUBJECT' -while getopts 's:h' flag; do - case "$flag" in - s) - SUBJECT="$OPTARG" - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -assert_arg "${1:-}" 'COMMAND...' - -now() { - date '+%Y-%m-%dT%H:%M:%S%Z' -} - -OUT="$(mkstemp)" -{ - printf 'Running command: %s\n' "$*" - printf 'Starting at: %s\n' "$(now)" - printf '\n' - - STATUS=0 - "$@" 2>&1 || STATUS=$? - - printf '\n' - printf '\nFinished at: %s\n' "$(now)" -} 2>&1 1>"$OUT" - -email -s "(exit status: $STATUS) - $SUBJECT" eu@euandre.org < "$OUT" diff --git a/.usr/bin/without-env b/.usr/bin/without-env deleted file mode 100755 index 45c41ca..0000000 --- a/.usr/bin/without-env +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - without-env ENVVAR PATH -- COMMAND... - without-env [-h] - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - Examples: - - Execute "command -V" filtering ~/bin, to get where "w3m" is - in $PATH, other than ~/bin: - $ without-env PATH ~/bin -- command -v w3m - - Compile foo.c, excluding ~/.local/include - from $C_INCLUDE_PATH: - $ without-env C_INCLUDE_PATH ~/.local/include -- cc -co foo.o foo.c - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n' "$2" >&2 - exit 2 - fi -} - -assert_arg "${1:-}" 'ENVVAR' -assert_arg "${2:-}" 'PATH' -assert_arg "${3:-}" '--' - -eval "export $1=\"\$(echo \"\$$1\" | sed \"s|\$2:||g\")\"" -shift # drop $1 -shift # drop $2 -shift # drop -- - -"$@" diff --git a/.usr/bin/xdg-open b/.usr/bin/xdg-open deleted file mode 120000 index ce4a72b..0000000 --- a/.usr/bin/xdg-open +++ /dev/null @@ -1 +0,0 @@ -open \ No newline at end of file diff --git a/.usr/bin/xmpp b/.usr/bin/xmpp deleted file mode 100755 index 472e9ca..0000000 --- a/.usr/bin/xmpp +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import getopt -import logging -import slixmpp - -USAGE = """\ -Usage: - xmpp [-d] [-F FROM_JID] -m MESSAGE TO_JID... - xmpp -h""" - -HELP = """ -Options: - -d run in DEBUG mode - -m MESSAGE the text of the message to be sent - -h, --help show this message - - FROM_JID the address used to send the message from - TO_JID the addresses where to send the message to""" - -class SendMsgBot(slixmpp.ClientXMPP): - def __init__(self, jid, password, on_start): - slixmpp.ClientXMPP.__init__(self, jid, password) - - self.on_start = on_start - self.add_event_handler("session_start", self.start) - - def start(self, event): - self.on_start(self) - self.disconnect(wait=True) - -def main(): - logging.basicConfig(level=logging.INFO) - from_ = "bot@euandreh.xyz" - message = "" - - for s in sys.argv: - if s == "--": - break - elif s == "--help": - print(USAGE) - print(HELP) - sys.exit() - - try: - opts, args = getopt.getopt(sys.argv[1:], 'm:F:dh') - except getopt.GetoptError as err: - print(err, file=sys.stderr) - print(USAGE, file=sys.stderr) - sys.exit(2) - for o, a in opts: - if o == "-m": - message = a - elif o == "-F": - from_ = a - elif o == "-d": - logging.basicConfig(level=logging.DEBUG) - elif o == "-h": - print(USAGE) - print(HELP) - sys.exit() - else: - assert False, "unhandled option" - - if message == "": - print("Missing -m MESSAGE", file=sys.stderr) - print(USAGE, file=sys.stderr) - sys.exit(2) - - if args == []: - print("Missing TO_JID", file=sys.stderr) - print(USAGE, file=sys.stderr) - sys.exit(2) - - passcmd = "pass show VPS/kuvira/XMPP/" + from_ + " | head -n1 | tr -d '\\n'" - password = os.popen(passcmd).read() - - def on_start(self): - for to in args: - self.send_message(mto=to, mbody=message, mtype='chat') - - xmpp = SendMsgBot(from_, password, on_start) - xmpp.connect() - xmpp.process(forever=False) - -if __name__ == "__main__": - main() diff --git a/.usr/etc/afew/config b/.usr/etc/afew/config deleted file mode 100644 index 94341e9..0000000 --- a/.usr/etc/afew/config +++ /dev/null @@ -1,6 +0,0 @@ -[SpamFilter] -[KillThreadsFilter] -[ListMailsFilter] -[ArchiveSentMailsFilter] -[MeFilter] -[InboxFilter] diff --git a/.usr/etc/alot/config b/.usr/etc/alot/config deleted file mode 120000 index a92319d..0000000 --- a/.usr/etc/alot/config +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/alot/config \ No newline at end of file diff --git a/.usr/etc/bash/check.sh b/.usr/etc/bash/check.sh deleted file mode 100755 index 7c12dec..0000000 --- a/.usr/etc/bash/check.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - check.sh - check.sh -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -shellcheck -xe 1090,1091 \ - "$XDG_CONFIG_HOME"/bash/rc \ - "$XDG_CONFIG_HOME"/bash/vcs-ps1.sh \ - "$XDG_CONFIG_HOME"/bash/check.sh \ - "$XDG_CONFIG_HOME"/bash/privrc.sh - -sh -eu ~/.profile diff --git a/.usr/etc/bash/inputrc b/.usr/etc/bash/inputrc deleted file mode 100644 index f5c7095..0000000 --- a/.usr/etc/bash/inputrc +++ /dev/null @@ -1,2 +0,0 @@ -"\e[B": history-search-forward -"\e[A": history-search-backward diff --git a/.usr/etc/bash/privrc.sh b/.usr/etc/bash/privrc.sh deleted file mode 120000 index 243a4bd..0000000 --- a/.usr/etc/bash/privrc.sh +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/privrc.sh \ No newline at end of file diff --git a/.usr/etc/bash/vcs-ps1.sh b/.usr/etc/bash/vcs-ps1.sh deleted file mode 100644 index f2103da..0000000 --- a/.usr/etc/bash/vcs-ps1.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/sh - -repo_status_git() { - BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" - OUT="$(git status --short --branch --porcelain)" - BRANCH_LINE="$(echo "$OUT" | head -n 1)" - DIFF_LINES="$(echo "$OUT" | tail -n +2)" - - IS_AHEAD=false - IS_BEHIND=false - if echo "$BRANCH_LINE" | grep -q 'ahead'; then - IS_AHEAD=true - fi - if echo "$BRANCH_LINE" | grep -q 'behind'; then - IS_BEHIND=true - fi - - LINE='' - - if [ "$IS_AHEAD" = true ] && [ "$IS_BEHIND" = true ]; then - LINE="^^^ $BRANCH_NAME vvv" - elif [ "$IS_AHEAD" = true ]; then - LINE="^ $BRANCH_NAME ^" - elif [ "$IS_BEHIND" = true ]; then - LINE="v $BRANCH_NAME v" - else - LINE="$BRANCH_NAME" - fi - - HAS_DIFF=false - HAS_UNTRACKED=false - if echo "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then - HAS_DIFF=true - fi - if echo "$DIFF_LINES" | grep -q '^[?][?]'; then - HAS_UNTRACKED=true - fi - - if [ "$HAS_DIFF" = true ]; then - COLOR_FN=redb - LINE="{$LINE}" - elif [ "$IS_AHEAD" = true ] || [ "$IS_BEHIND" = true ]; then - COLOR_FN=bluei - LINE="[$LINE]" - elif [ "$HAS_UNTRACKED" = true ]; then - COLOR_FN=lightblue - LINE="{$LINE}" - else - COLOR_FN=green - LINE="($LINE)" - fi - - color -c "$COLOR_FN" "$LINE" - - BRANCH_COUNT="$(git branch --list | wc -l)" - if [ "$BRANCH_COUNT" -gt 1 ]; then - color -c lightblue "<$BRANCH_COUNT>" - fi - - STASH_COUNT="$(git stash list | wc -l)" - if [ "$STASH_COUNT" != 0 ]; then - color -c red "*$STASH_COUNT" - fi - - color -c blacki " - git/$(git rev-parse HEAD)" -} - -repo_status_fossil() { - BRANCH_NAME="$(fossil branch current)" - - if [ -n "$(fossil extras)" ]; then - HAS_UNTRACKED=1 - fi - - BRANCH_MARKER="$BRANCH_NAME" - - if [ -n "${HAS_UNTRACKED:-}" ]; then - COLOR_FN=lightblue - LINE="($BRANCH_MARKER)" - else - COLOR_FN=green - LINE="($BRANCH_MARKER)" - fi - - color -c "$COLOR_FN" "$LINE" - - color -c blacki " - fossil/$(fossil info | awk '/^checkout:/ { print $2 }')" -} - -repo_status_mercurial() { - BRANCH_NAME="$(hg branch)" -} - -repo_status() { - dir="$(basename "$PWD")" - if [ -d .git ]; then - repo_status_git - elif [ -f "$dir.fossil" ]; then - repo_status_fossil - elif [ -d .hg ]; then - repo_status_mercurial - fi -} - - -error_marker() { - STATUS=$? - if [ "$STATUS" != 0 ]; then - color -c redb " (!! $STATUS !!) " - fi -} - -timestamp() { - color -c blacki '\T' -} - -path() { - color -c yellowb '\w/' -} - -guix_env() { - if [ "$GUIX_ENVIRONMENT" != '' ]; then - printf '\n' - color -c blacki '~> ' - color -c purple 'guix environment ' - printf '(' - color -c blueb "$GUIX_ENVIRONMENT" - printf ')' - fi -} - -in_nix_shell() { - if [ "$IN_NIX_SHELL" != '' ]; then - printf '\n' - color -c blacki '~> ' - color -c purpleb "$IN_NIX_SHELL " - color -c purple 'nix-shell ' - printf '(' - color -c blueb "${name:-}" - printf ')' - fi -} - -PS1='`error_marker`'$(timestamp)' '$(path)' `repo_status``guix_env``in_nix_shell` -$ ' - - -vcs_status() { - git status "$@" -} - -vcs_diff() { - git diff "$@" -} - -vcs_diff_staged() { - git diff --staged "$@" -} diff --git a/.usr/etc/gnupg/gpg.conf b/.usr/etc/gnupg/gpg.conf deleted file mode 100644 index d4498fe..0000000 --- a/.usr/etc/gnupg/gpg.conf +++ /dev/null @@ -1 +0,0 @@ -keyserver pool.sks-keyservers.net diff --git a/.usr/etc/gnupg/sshcontrol b/.usr/etc/gnupg/sshcontrol deleted file mode 100644 index 1ae03ed..0000000 --- a/.usr/etc/gnupg/sshcontrol +++ /dev/null @@ -1 +0,0 @@ -750154E135FD7B11FDDF0107CC0904F92EBD2AE4 diff --git a/.usr/etc/guix/channels.scm b/.usr/etc/guix/channels.scm deleted file mode 100644 index 304db35..0000000 --- a/.usr/etc/guix/channels.scm +++ /dev/null @@ -1,20 +0,0 @@ -(append - (list - (channel - (name 'xyz-euandreh) - (url "git://euandreh.xyz/package-repository.git/") - (branch "main") - (introduction - (make-channel-introduction - "d749e053e6db365069cb9b2ef47a78b06f9e7361" - (openpgp-fingerprint - "5BDA E9B8 B2F6 C6BC BB0D 6CE5 81F9 0EC3 CD35 6060")))) - (channel - (name 'nonguix) - (url "https://gitlab.com/nonguix/nonguix") - (introduction - (make-channel-introduction - "897c1a470da759236cc11798f4e0a5f7d4d59fbc" - (openpgp-fingerprint - "2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))) - %default-channels) diff --git a/.usr/etc/guix/home.scm b/.usr/etc/guix/home.scm deleted file mode 100644 index 607a059..0000000 --- a/.usr/etc/guix/home.scm +++ /dev/null @@ -1,152 +0,0 @@ -(use-modules - (curth0) - (gnu home services) - (gnu home services shells) - (gnu packages) - (gnu packages mail) - (gnu packages gnupg) - (gnu services) - (guix gexp) - (guix packages) - (guix utils)) - -(define msmtp-non-hardcoded - (package - (inherit msmtp) - (name "msmtp-non-hardcoded") - (arguments - (substitute-keyword-arguments (package-arguments msmtp) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'install-additional-files 'patch-hardcoded-paths - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out"))) - (substitute* (string-append out "/bin/msmtpq") - (("^LOG=.*$") "LOG=${XDG_LOG_HOME:-$HOME/.local/var/log}/msmtpq.log\n") - (("^Q=.*$") "Q=${XDG_DATA_HOME:-$HOME/.local/share}/msmtp/queue\n") - (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) - -(define (xdg-config-home s) - (string-append (getenv "XDG_CONFIG_HOME") "/" s)) - -(define gitconfig (mixed-text-file "gitconfig" #"- - [user] - email = eu@euandre.org - name = EuAndreh - signingkey = 81F90EC3CD356060 - [transfer] - fsckobjects = true - [push] - default = current - [commit] - gpgsign = true - verbose = true - [init] - defaultBranch = main - [sendemail] - assume8bitEncoding = UTF-8 - smtpserveroption = -a - smtpserveroption = euandreh - annotate = yes - confirm = never - smtpserver = "# msmtp-non-hardcoded "/bin/msmtpq\n")) - -(define gpg-agent.conf (mixed-text-file "gpg-agent.conf" #"- - default-cache-ttl 172800 - default-cache-ttl-ssh 172800 - max-cache-ttl 604800 - max-cache-ttl-ssh 604800 - enable-ssh-support - pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) - -(define config-files - `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) - ("git/config" ,gitconfig))) - -(define (dot-config) - (define (prefix-with-config s) - (string-append (substring (getenv "XDG_CONFIG_HOME") - (+ 1 (string-length (getenv "HOME")))) - "/" - s)) - (map (lambda (t) - (list (prefix-with-config (first t)) - (second t))) - config-files)) - -(home-environment - (packages - (append - (map (compose list specification->package+output symbol->string) - '(man-pages - posix-man-pages - - tree - openssh - mailutils - entr - git - git:send-email - tmux - rsync - gnupg - pulseaudio - password-store - playerctl - pinentry-gtk2 - bmake - fzf - ranger - blueman - ledger - curl - xclip - cloc - strace - file - urlscan - rlwrap - direnv - borg - khal - khard - libfaketime - qrencode - feh - sox - xset - graphviz - moreutils - shellcheck - gettext - groff - - clojure - openjdk - sbcl - perl - perl-mojolicious - - st - i3status - dmenu - - weechat - alot - notmuch - isync - w3m - afew - - zathura - zathura-djvu - zathura-pdf-poppler - zathura-ps - firefox)) - (list msmtp-non-hardcoded))) - (services - (list (service home-bash-service-type - (home-bash-configuration - (bashrc - (list (plain-file "bashrc.sh" ". $XDG_CONFIG_HOME/bash/rc"))))) - (simple-service 'config-files home-files-service-type (dot-config))))) diff --git a/.usr/etc/guix/system.scm b/.usr/etc/guix/system.scm deleted file mode 100644 index 3bd7235..0000000 --- a/.usr/etc/guix/system.scm +++ /dev/null @@ -1,102 +0,0 @@ -(use-modules - (curth0) - (gnu bootloader) - (gnu bootloader grub) - (gnu packages) - (gnu services base) - (gnu services desktop) - (gnu services security-token) - (gnu services xorg) - (gnu system keyboard) - (gnu system file-systems) - (gnu system mapped-devices) - (guix gexp) - (nongnu packages linux) - (nongnu system linux-initrd)) - -(operating-system - (kernel linux) - (initrd microcode-initrd) - (firmware (list linux-firmware)) - (locale "fr_FR.UTF-8") - (timezone "America/Sao_Paulo") - (keyboard-layout - (keyboard-layout "br" #:options '("caps:swapescape" "esperanto:qwerty"))) - (host-name "velhinho") - (users - (append - (let ((user-groups '("wheel" "netdev" "audio" "video"))) - (list - (user-account - (name "andreh") - (comment "EuAndreh") - (group "users") - (supplementary-groups user-groups)) - (user-account - (name "other") - (comment "Other Self") - (group "users") - (supplementary-groups user-groups)))) - %base-user-accounts)) - (packages - (append - (map (compose list specification->package+output symbol->string) - '(nss-certs - i3-wm)) - %base-packages)) - (services - (append - (list - (service bluetooth-service-type) - (service pcscd-service-type) - (service gnome-desktop-service-type) - (set-xorg-configuration - (xorg-configuration - (keyboard-layout keyboard-layout) - (extra-config (list #"- - Section "InputClass" - Identifier "touchpad" - Driver "libinput" - MatchIsTouchpad "on" - Option "Tapping" "on" - EndSection - "#))))) - (modify-services %desktop-services - (guix-service-type config => - (guix-configuration - (inherit config) - (substitute-urls - (append '("https://substitutes.nonguix.org") - %default-substitute-urls)) - (authorized-keys - (append (list (plain-file "non-guix.pub" #"- - (public-key - (ecc - (curve Ed25519) - (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#))) - "#)) - %default-authorized-guix-keys))))))) - (bootloader - (bootloader-configuration - (bootloader grub-efi-bootloader) - (targets (list "/boot/efi")) - (keyboard-layout keyboard-layout))) - (mapped-devices - (list - (mapped-device - (source (uuid "6b0d38a6-d93e-4f8e-a59a-7729f5adf892")) - (target "cryptroot") - (type luks-device-mapping)))) - (file-systems - (append - (list - (file-system - (mount-point "/boot/efi") - (device (uuid "1B26-9F4E" 'fat32)) - (type "vfat")) - (file-system - (mount-point "/") - (device "/dev/mapper/cryptroot") - (type "ext4") - (dependencies mapped-devices))) - %base-file-systems))) diff --git a/.usr/etc/hg/hgrc b/.usr/etc/hg/hgrc deleted file mode 100644 index 656f40b..0000000 --- a/.usr/etc/hg/hgrc +++ /dev/null @@ -1,2 +0,0 @@ -[ui] -username = EuAndreh diff --git a/.usr/etc/i3/config b/.usr/etc/i3/config deleted file mode 100644 index 0b41311..0000000 --- a/.usr/etc/i3/config +++ /dev/null @@ -1,186 +0,0 @@ -set $mod Mod4 - - -# font pango:monospace 8 - -# This font is widely installed, provides lots of unicode glyphs, right-to-left -# text rendering and scalability on retina/hidpi displays (thanks to pango). -font pango:DejaVu Sans Mono 8 - -# Start XDG autostart .desktop files using dex. See also -# https://wiki.archlinux.org/index.php/XDG_Autostart -exec --no-startup-id dex --autostart --environment i3 - -# The combination of xss-lock, nm-applet and pactl is a popular choice, so -# they are included here as an example. Modify as you see fit. - -# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the -# screen before suspend. Use loginctl lock-session to lock your screen. -exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork - -# NetworkManager is the most popular way to manage wireless networks on Linux, -# and nm-applet is a desktop environment-independent system tray GUI for it. -exec --no-startup-id nm-applet -exec --no-startup-id blueman-applet -exec --no-startup-id poweralertd -exec dunst - -# Use pactl to adjust volume in PulseAudio. -set $refresh_i3status killall -SIGUSR1 i3status -bindsym F1 exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status -bindsym F2 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status -bindsym F3 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status - -bindsym F4 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` position 5- -bindsym Shift+F4 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` previous -bindsym F5 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` play-pause -Bindsym Shift+F5 exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/rotate-mpris-player.sh -bindsym F6 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` position 5+ -bindsym Shift+F6 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` next - -# FIXME bad path -bindsym F7 exec --no-startup-id ~/.local/bin/brightness -1 -bindsym F8 exec --no-startup-id ~/.local/bin/brightness +1 - - - -bindsym $mod+Shift+s exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/toggle-pulseaudio-sink.sh && $refresh_i3status - - -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -bindsym $mod+Return exec st -bindsym $mod+Shift+q kill -bindsym $mod+p exec --no-startup-id dmenu_run - - - - -# FIXME: better placement of these files -bindsym $mod+o exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-emoji.sh -bindsym $mod+v exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-clipmenu.sh -bindsym $mod+i exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass.sh -bindsym $mod+Control+i exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass-login.sh - - - - -# change focus -bindsym $mod+h focus left -bindsym $mod+j focus down -bindsym $mod+k focus up -bindsym $mod+l focus right - -# move focused window -bindsym $mod+Shift+h move left -bindsym $mod+Shift+j move down -bindsym $mod+Shift+k move up -bindsym $mod+Shift+l move right - -# bindsym $mod+h split h # what is this? - -# split in vertical orientation -# FIXME: what is this? It was in conflict with dmenu-clipmenu -# bindsym $mod+v split v - -# enter fullscreen mode for the focused container -bindsym $mod+f fullscreen toggle - -# change container layout (stacked, tabbed, toggle split) -bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+e layout toggle split - -# toggle tiling / floating -bindsym $mod+Shift+space floating toggle - -# change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle - -# focus the parent container -bindsym $mod+a focus parent - -# focus the child container -bindsym $mod+d focus child - -# Define names for default workspaces for which we configure key bindings later on. -# We use variables to avoid repeating the names in multiple places. -set $ws1 "1" -set $ws2 "2" -set $ws3 "3" -set $ws4 "4" -set $ws5 "5" -set $ws6 "6" -set $ws7 "7" -set $ws8 "8" -set $ws9 "9" -set $ws10 "10" - -# switch to workspace -bindsym $mod+1 workspace number $ws1 -bindsym $mod+2 workspace number $ws2 -bindsym $mod+3 workspace number $ws3 -bindsym $mod+4 workspace number $ws4 -bindsym $mod+5 workspace number $ws5 -bindsym $mod+6 workspace number $ws6 -bindsym $mod+7 workspace number $ws7 -bindsym $mod+8 workspace number $ws8 -bindsym $mod+9 workspace number $ws9 -bindsym $mod+0 workspace number $ws10 - -# move focused container to workspace -bindsym $mod+Shift+1 move container to workspace number $ws1 -bindsym $mod+Shift+2 move container to workspace number $ws2 -bindsym $mod+Shift+3 move container to workspace number $ws3 -bindsym $mod+Shift+4 move container to workspace number $ws4 -bindsym $mod+Shift+5 move container to workspace number $ws5 -bindsym $mod+Shift+6 move container to workspace number $ws6 -bindsym $mod+Shift+7 move container to workspace number $ws7 -bindsym $mod+Shift+8 move container to workspace number $ws8 -bindsym $mod+Shift+9 move container to workspace number $ws9 -bindsym $mod+Shift+0 move container to workspace number $ws10 - -# reload the configuration file -bindsym $mod+Shift+c reload -# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -bindsym $mod+Shift+r restart -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+e 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'" - -# resize window (you can also use the mouse for that) -mode "resize" { - # These bindings trigger as soon as you enter the resize mode - - # Pressing left will shrink the window’s width. - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - bindsym h resize shrink width 10 px or 10 ppt - bindsym j resize grow height 10 px or 10 ppt - bindsym k resize shrink height 10 px or 10 ppt - bindsym l resize grow width 10 px or 10 ppt - - # same bindings, but for the arrow keys - # bindsym Left resize shrink width 10 px or 10 ppt - # bindsym Down resize grow height 10 px or 10 ppt - # bindsym Up resize shrink height 10 px or 10 ppt - # bindsym Right resize grow width 10 px or 10 ppt - - # back to normal: Enter or Escape or $mod+r - bindsym Return mode "default" - bindsym Caps_Lock mode "default" - bindsym $mod+r mode "default" -} - -bindsym $mod+r mode "resize" - -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) -bar { - position top - status_command i3status -} - -default_border pixel -default_floating_border pixel diff --git a/.usr/etc/info/infokey b/.usr/etc/info/infokey deleted file mode 100644 index 90edc50..0000000 --- a/.usr/etc/info/infokey +++ /dev/null @@ -1,7 +0,0 @@ -^e down-line -^y up-line - -#var -link-style=cyan -active-link-style=blue,bold -match-style=underline,bold,bggreen diff --git a/.usr/etc/khal/config b/.usr/etc/khal/config deleted file mode 120000 index dfae173..0000000 --- a/.usr/etc/khal/config +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/khal/config \ No newline at end of file diff --git a/.usr/etc/khard/khard.conf b/.usr/etc/khard/khard.conf deleted file mode 120000 index f015b29..0000000 --- a/.usr/etc/khard/khard.conf +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/khard/khard.conf \ No newline at end of file diff --git a/.usr/etc/mailcaps/config b/.usr/etc/mailcaps/config deleted file mode 100644 index aeea68d..0000000 --- a/.usr/etc/mailcaps/config +++ /dev/null @@ -1 +0,0 @@ -text/html; w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput diff --git a/.usr/etc/mbsync/config b/.usr/etc/mbsync/config deleted file mode 120000 index 68a3234..0000000 --- a/.usr/etc/mbsync/config +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/mbsync/config \ No newline at end of file diff --git a/.usr/etc/msmtp/config b/.usr/etc/msmtp/config deleted file mode 120000 index 45cd0ac..0000000 --- a/.usr/etc/msmtp/config +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/msmtp/config \ No newline at end of file diff --git a/.usr/etc/newsboat/urls b/.usr/etc/newsboat/urls deleted file mode 120000 index 3c453f5..0000000 --- a/.usr/etc/newsboat/urls +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/newsboat/urls \ No newline at end of file diff --git a/.usr/etc/notmuch/default/config b/.usr/etc/notmuch/default/config deleted file mode 120000 index 3b9d2f4..0000000 --- a/.usr/etc/notmuch/default/config +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/notmuch/default/config \ No newline at end of file diff --git a/.usr/etc/notmuch/default/hooks/post-new b/.usr/etc/notmuch/default/hooks/post-new deleted file mode 120000 index 7992789..0000000 --- a/.usr/etc/notmuch/default/hooks/post-new +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/notmuch/post-new \ No newline at end of file diff --git a/.usr/etc/python/pythonrc.py b/.usr/etc/python/pythonrc.py deleted file mode 100644 index 1fc3bfe..0000000 --- a/.usr/etc/python/pythonrc.py +++ /dev/null @@ -1,15 +0,0 @@ -import os -import atexit -import readline - -history = os.path.join(os.environ["XDG_STATE_HOME"], "python-history") - -try: - readline.read_history_file(history) -except OSError: - pass - -def write_history(): - readline.write_history_file(history) - -atexit.register(write_history) diff --git a/.usr/etc/ranger/rc.conf b/.usr/etc/ranger/rc.conf deleted file mode 100644 index ed2b538..0000000 --- a/.usr/etc/ranger/rc.conf +++ /dev/null @@ -1 +0,0 @@ -map DD shell trash %s diff --git a/.usr/etc/sbcl/sbclrc.lisp b/.usr/etc/sbcl/sbclrc.lisp deleted file mode 100644 index df7f57a..0000000 --- a/.usr/etc/sbcl/sbclrc.lisp +++ /dev/null @@ -1,6 +0,0 @@ -;;; The following lines added by ql:add-to-init-file: -#-quicklisp -(let ((quicklisp-init (merge-pathnames "dev/quicklisp/setup.lisp" - (user-homedir-pathname)))) - (when (probe-file quicklisp-init) - (load quicklisp-init))) diff --git a/.usr/etc/ssh/known_hosts b/.usr/etc/ssh/known_hosts deleted file mode 100644 index ad6b0b2..0000000 --- a/.usr/etc/ssh/known_hosts +++ /dev/null @@ -1,74 +0,0 @@ -|1|G2vfdmQ84glwobYXZZ0d+cCMVRE=|DZJYmWjbeP52J4K7+Bsz2e0dgBA= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= -|1|yosAhKlbZt51FfD2VvQJiVijSBA=|BFEig1gqq4EwCHEHagEASQZQmNI= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= -|1|5yKbUaAB5AFz4MINtTVhVAPwMtU=|LwcI5Z8hXwwKxtkk4KDpeZduyPQ= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -|1|sfEM3JnFec93XEzMf9A6TkthgdI=|oZX7oe9eBKYMrXLcoFydh70my5A= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -|1|F/E3nafzrpMZEzyN8iA++okJ7Q4=|T00Gk7F90YmbaTMSOGjP8yhls94= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMylg2eib0byVT2R7dVFkxdhXO5pvgllnszKhlHiEP15ee8IjMYNPvz2A605hUdIxXtsBgjf+u7jlubh6mbx/YA= -|1|jSpDKjDomux2z3O/ok/UPGGQ8xs=|ZP60naGKQnpK6yHGD+B/+ykB05c= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMylg2eib0byVT2R7dVFkxdhXO5pvgllnszKhlHiEP15ee8IjMYNPvz2A605hUdIxXtsBgjf+u7jlubh6mbx/YA= -|1|PJybLcZRkpN9IyDsqaNjGO6lE5Y=|K0nchvCA7XV91J2X6l0h2DwOmyI= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -|1|zzdSJf8JIMfi5sKbc/mNcBy/RB8=|0GxC/CesxJHcRdt8MuPVjfab06k= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 -|1|X5OmtKdXZh2kC//XCXEEOim7tgE=|Rh5ro2oEB4MN8MP6PRbG3QBR0Kk= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 -46.101.43.82 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLIGIc5X12Y61eVcKJnNzCvrPeSKgyKgElqGl7QDeGeynE33sRVoNAg9aqkgXdc2MkN+nFhEWELkjPuBKYsyp2I= -hinarioespirita.org,167.99.34.30 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= -pt.hinarioespirita.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= -mtm.hinarioespirita.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= -77.109.148.18 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 -35.231.145.151 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= -git.sr.ht,173.195.146.142 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= -192.168.33.10 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCL+hEiW/Va2L6y5Y4MyxRBXHJw/9bIC02M3wGVe1zaD3DT8wsAUcJ2QO1lJILudvMInx+SaPyJmwBvUn58YR2c= -173.195.146.152 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= -2001:1620:2019::218 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 -140.82.114.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -140.82.113.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -140.82.113.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -140.82.114.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -2604:bf00:710:0:5054:ff:fe7d:8fa8 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= -azusa.runners.sr.ht,2604:bf00:710:0:ae1f:6bff:fead:55a ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPzxK5AM1FdMI9gZVDpw2O5iiS/49QokWpzANFntVt0Qig4qdBt4K7B0O6MrwggLh3A+zBlsXCMoWtvFtPQgLxA= -18.228.52.138 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -18.231.5.6 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -2604:bf00:710:0:5054:ff:fe36:ebc6 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= -18.228.67.229 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -hg.sr.ht,2604:bf00:710:0:5054:ff:fe25:1aa6 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL4aNGa+KnvMA0QoWrIVuI2QBU0Q/xX48sMBl3VtP/zPOGMvS50zGVMaA00RSzfcI2X0v/aUTsVm2vBNo/V1gTg= -euandre.org,2a03:b0c0:3:d0::387:b001 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF6wlJqwd7KWLzLovwnwbTmNfO4E4yVDyqxAAlUkn9eDsTtzV1RYNDsaLPWv4mweJqP4crZPFxg40sFVeMDbkC0= -2606:4700:90:0:f22e:fbec:5bed:a9b9 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= -46.101.160.115 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF6wlJqwd7KWLzLovwnwbTmNfO4E4yVDyqxAAlUkn9eDsTtzV1RYNDsaLPWv4mweJqP4crZPFxg40sFVeMDbkC0= -173.195.146.249 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPzxK5AM1FdMI9gZVDpw2O5iiS/49QokWpzANFntVt0Qig4qdBt4K7B0O6MrwggLh3A+zBlsXCMoWtvFtPQgLxA= -2604:a880:800:14::32:4000 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK8YTumqLFAL5MJ0AcDtFG9dWfbkJKU7FUDlH0xEgAZvHGU57TBr9DIQy2OHrxCxuhk9bZEUX8+vJiRXE05+Rzs= -2001:19f0:7001:5cec:5400:2ff:feec:9940 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPYRWlGutc+bRJ+N0sXHxhgnDsRvRoauQ92yM1U7N+8a -2001:19f0:6c01:2cf0:5400:2ff:feec:99c5 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMGiiEXB+koPS1vgGkwdExk2Q5fGv3Yc5rf8jVHB2FB7 -45.32.155.96 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN -45.77.65.204 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN -136.244.85.68 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN -199.247.0.136 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -euandreh.xyz ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -136.244.80.130 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -209.250.232.122 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -git.euandreh.xyz ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -80.240.24.148 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -95.179.246.150 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -45.77.52.185 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -199.247.2.245 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -140.82.112.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -104.238.176.223 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -172.65.251.78 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= -140.82.112.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -45.32.158.17 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -95.179.253.243 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -95.179.163.103 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -217.69.2.177 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -arrobaponto.org,104.238.167.189 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -104.238.176.81 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -git.arrobaponto.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -173.199.70.52 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -[remembering.euandreh.xyz]:23841 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -167.71.86.194 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCXg/l/grol/OAY95VphKbVn4yXUStSWpxQjnka7PWXzWyForfX+fpmY+p72r1Uimx5oXIFISt8uSZW/tvD61iQ= -[localhost]:10022 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLHACdQJXUj5e4Znyh7KdTjB1RLznSfStRw6cuHZlu8rhANVfkjt300Fum9Jv6yLra6W4v2FLALWfcYpOlUzt9c= -107.191.63.70 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMONpsqwH79f/MsjtsOPitT5C+3hPPJqVh42oHMKOen6 -217.69.11.49 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr -[arrobaponto.org]:23213 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr -anoncvs.netbsd.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA3QiBl8leG9fqIJpKeNov0PKq5YryFFiroMWOPUv4hDFn8R0jC07YVaR/OSBrr37CTmGX5AFceXPzoFnLlwCqWR7rXg4NR75FTlTp9CG9EBAEtU8mee27KDrUFBTZdfVl2+aRYoAI5fTXA+0vpIO68Cq843vRWUZCcwinS4cNLUU= -git.2f30.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSLZ4G5w4NysBUmAHmr6/V9om42IHSUCtqrNdhWoYQ0 -[arrobaponto.org]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 -[199.247.13.53]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 -[2001:19f0:6801:988:5400:3ff:fea1:b566]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 -[gerrit.wikimedia.org]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCF8pwFLehzCXhbF1jfHWtd9d1LFq2NirplEBQYs7AOrGwQ/6ZZI0gvZFYiEiaw1o+F1CMfoHdny1VfWOJF3mJ1y9QMKAacc8/Z3tG39jBKRQCuxmYLO1SWymv7/Uvx9WQlkNRoTdTTa9OJFy6UqvLQEXKYaokfMIUHZ+oVFf1CgQ== -2001:19f0:5:1d65:5400:3ff:fee3:7463 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF2EgU3IgCwv1ynnWfxFm0SHTSoE0AYG3MJT/TpN3pBz diff --git a/.usr/etc/tmux/tmux.conf b/.usr/etc/tmux/tmux.conf deleted file mode 100644 index dd718ca..0000000 --- a/.usr/etc/tmux/tmux.conf +++ /dev/null @@ -1,81 +0,0 @@ -# Use personal prefix over "C-b" -unbind C-b -set -g prefix C-v - -# Turn on mouse mode -# https://groups.google.com/forum/#!msg/tmux-users/TRwPgEOVqho/Ck_oth_SDgAJ -# https://github.com/tmux/tmux/blob/310f0a960ca64fa3809545badc629c0c166c6cd2/CHANGES#L12 -set -g mouse on - -# Bind "C-x r" to reload the configuration file -bind-key r source-file $XDG_CONFIG_HOME/tmux/tmux.conf \; display-message "$XDG_CONFIG_HOME/tmux.conf reloaded" - -# Holy answer that properly implements copying from tmux! -# https://unix.stackexchange.com/a/349020/276661 -bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xclip -selection clipboard -i" \; -bind-key y send-keys -X copy-pipe "xclip -selection clipboard -i" \; display-message "Copied system clipboard! Hooray! Long-live tmux!" - -# Moving around panes -bind-key -n M-h select-pane -L -bind-key -n M-j select-pane -D -bind-key -n M-k select-pane -U -bind-key -n M-l select-pane -R - -# Resizing panes -bind-key -n M-H resize-pane -L 5 -bind-key -n M-J resize-pane -D 5 -bind-key -n M-K resize-pane -U 5 -bind-key -n M-L resize-pane -R 5 - -# Reorder windows -bind-key -n C-S-Left swap-window -t -1\; select-window -t -1 -bind-key -n C-S-Right swap-window -t +1\; select-window -t +1 -# -# To change the number of a window, use: PREFIX-., and pick a new unused number -# - -# Join windows -bind-key -n C-S-M-Left join-pane -s :-0 -t :-1 -bind-key -n C-S-M-Right join-pane -s :-0 -t :+1 - -# "M m" to actually clear the pane history -bind -n M-m send-keys -R \; clear-history - -# Keybinding to activate pane typing sync -# https://stackoverflow.com/questions/25909964/tmux-how-to-toggle-on-and-off-options-with-the-same-key -bind-key b setw synchronize-panes \; display-message "synchronize-panes toggle" - -setw -g mode-keys vi # Move around with vi keys -set-option -g status-key "vi" # Use vi mode for status bar command (like after typing "C-x [" one can search with "/") -set-option -g status-bg "#666666" # Status bar background color -set-option -g status-fg "#aaaaaa" # Status bar foreground color -set-option -g status-left-length 50 # session name in status bar length =[annex]= part -set-option -g history-limit 150000 # How many lines of history to keep -set-option -g status-right "" - -# Set the panes initial index value to 1 instead of 0 -# 0 is too far from ` ;) -set -g base-index 1 -set-window-option -g pane-base-index 1 - -# Automatically set window title -set-window-option -g automatic-rename on -set-option -g set-titles on - -# Set "correct term" -# https://wiki.archlinux.org/index.php/Tmux -set -g default-terminal screen-256color - -# No delay for escape key press -# https://mutelight.org/practical-tmux#faster-command-sequences -set -sg escape-time 0 - -# Display pane numbers for longer -# https://unix.stackexchange.com/questions/307696/how-to-increase-tmux-pane-numbers-display-time-ctrl-b-q -set -g display-panes-time 2500 - -bind-key t resize-pane -x 80 - -bind -n M-r attach-session -t . -c '#{pane_current_path}' \; display-message "CWD for session updated to #{pane_current_path}!" - -bind-key u capture-pane \; save-buffer /tmp/tmux-urlscan-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan < /tmp/tmux-urlscan-buffer"' diff --git a/.usr/etc/weechat/irc.conf b/.usr/etc/weechat/irc.conf deleted file mode 120000 index 7dff360..0000000 --- a/.usr/etc/weechat/irc.conf +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/private/dotfiles/weechat/irc.conf \ No newline at end of file diff --git a/bin/backup b/bin/backup new file mode 100755 index 0000000..cab37dc --- /dev/null +++ b/bin/backup @@ -0,0 +1,128 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + backup [-v] [-C COMMENT] ARCHIVE_TAG + backup -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -v enable verbose mode, useful for + interactive sessions + -C COMMENT the comment text to be attached to the archive + -h, --help show this message + + ARCHIVE_TAG the tag used to create the new + backup (default: "cronjob") + + + The repository is expected to have been created with: + + $ borg init -e repokey-blake2 + + The following environment variables are expected to be exported: + + $BORG_PASSCOMMAND + $BORG_REPO + $BORG_REMOTE_PATH + + Password-less SSH access is required, usually done via adding + ~/.ssh/id_rsa.pub to suyin:.ssh/authorized_keys. + + + Examples: + + Run backup from cronjob: + + $ backup cronjob + + Create backup with comment, and verbose mode active: + + $ backup -vC 'The backup has a comment' my-backup + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +VERBOSE_FLAGS='' +COMMENT='' +while getopts 'vC:h' flag; do + case "$flag" in + v) + VERBOSE_FLAGS='--verbose --progress' + ;; + C) + COMMENT="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +ARCHIVE_TAG="${1:-}" +assert_arg "$ARCHIVE_TAG" 'ARCHIVE_TAG' + + +finish() { + STATUS=$? + printf '\n>>>\n>>> exit status: %s\n>>>\n\n' "$STATUS" >&2 +} +trap finish EXIT + +run() { + borg create \ + $VERBOSE_FLAGS \ + --comment "$COMMENT" \ + --exclude ~/.cache/ \ + --exclude ~/Downloads/ \ + --stats \ + --compression lzma,9 \ + "::{hostname}-{now}-$ARCHIVE_TAG" \ + ~/ + STATUS=$? + + if [ "$STATUS" = 0 ] || [ "$STATUS" = 1 ]; then + echo 'WARNING, but no ERROR.' >&2 + return 0 + else + return "$STATUS" + fi +} + +run || exit $? diff --git a/bin/brightness b/bin/brightness new file mode 100755 index 0000000..8e178ad --- /dev/null +++ b/bin/brightness @@ -0,0 +1,13 @@ +#!/bin/sh +set -eu + +BRIGHTNESS_DIFF="$1" + +DEVICE="$(cat "$XDG_CONFIG_HOME"/backlight-device)" +HANDLER="/sys/class/backlight/$DEVICE" + +OLD_BRIGHTNESS="$(cat "$HANDLER"/brightness)" +MAX_BRIGHTNESS="$(cat "$HANDLER"/max_brightness)" +SUM=$((OLD_BRIGHTNESS + BRIGHTNESS_DIFF)) +NEW_BRIGHTNESS="$(clamp -- "$SUM" 0 "$MAX_BRIGHTNESS")" +echo "$NEW_BRIGHTNESS" > "$HANDLER"/brightness || sudo chmod 666 "$HANDLER/brightness" diff --git a/bin/clamp b/bin/clamp new file mode 100755 index 0000000..a40b823 --- /dev/null +++ b/bin/clamp @@ -0,0 +1,74 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + clamp NUMBER MIN MAX + clamp -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Clamp the NUMBER between MIN and MAX. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +NUMBER="${1:-}" +MIN="${2:-}" +MAX="${3:-}" + +assert_arg "$NUMBER" 'NUMBER' +assert_arg "$MIN" 'MIN' +assert_arg "$MAX" 'MAX' + + +if [ "$MIN" -gt "$MAX" ]; then + printf 'MIN (%s) is greater then MAX (%s).\n' "$MIN" "$MAX" >&2 + exit 2 +fi + +min -- "$(max -- "$NUMBER" "$MIN")" "$MAX" diff --git a/bin/color b/bin/color new file mode 100755 index 0000000..0597278 --- /dev/null +++ b/bin/color @@ -0,0 +1,204 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + color -c COLOR TEXT + color -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -c COLOR + -h, --help show this message + + + The available colors are: + EOF + list_colors | sed 's/^/ /' +} + + +END="\033[0m" + +black() { + BLACK="\033[0;30m" + printf "${BLACK}${1}${END}" +} + +blackb() { + BLACK_B="\033[1;30m" + printf "${BLACK_B}${1}${END}" +} + +blacki() { + BLACK_I="\033[0;90m" + printf "${BLACK_I}${1}${END}" +} + +white() { + WHITE="\033[0;37m" + printf "${WHITE}${1}${END}" +} + +whiteb() { + WHITE_B="\033[1;37m" + printf "${WHITE_B}${1}${END}" +} + +red() { + RED="\033[0;31m" + printf "${RED}${1}${END}" +} + +redb() { + RED_B="\033[1;31m" + printf "${RED_B}${1}${END}" +} + +green() { + GREEN="\033[0;32m" + printf "${GREEN}${1}${END}" +} + +greenb() { + GREEN_B="\033[1;32m" + printf "${GREEN_B}${1}${END}" +} + +yellow() { + YELLOW="\033[0;33m" + printf "${YELLOW}${1}${END}" +} + +yellowb() { + YELLOW_B="\033[1;33m" + printf "${YELLOW_B}${1}${END}" +} + +blue() { + BLUE="\033[0;34m" + printf "${BLUE}${1}${END}" +} + +blueb() { + BLUE_B="\033[1;34m" + printf "${BLUE_B}${1}${END}" +} + +bluei() { + BLUE_I="\033[0;94m" + printf "${BLUE_I}${1}${END}" +} + +purple() { + PURPLE="\033[0;35m" + printf "${PURPLE}${1}${END}" +} + + +purpleb() { + PURPLE_B="\033[1;35m" + printf "${PURPLE_B}${1}${END}" +} + +lightblue() { + LIGHT_BLUE="\033[0;36m" + printf "${LIGHT_BLUE}${1}${END}" +} + +lightblueb() { + LIGHT_BLUE_B="\033[1;36m" + printf "${LIGHT_BLUE_B}${1}${END}" +} + +COLOR_LIST=' +black +blackb +white +whiteb +red +redb +green +greenb +yellow +yellowb +blue +blueb +purple +purpleb +lightblue +lightblueb +blacki +bluei +' +list_colors() { + for c in $COLOR_LIST; do + printf '%s\n' "$("$c" "$c")" + done +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'c:h' flag; do + case "$flag" in + c) + EXISTS=false + for c in $COLOR_LIST; do + if [ "$OPTARG" = "$c" ]; then + EXISTS=true + break + fi + done + if [ "$EXISTS" = false ]; then + printf 'Invalid color: %s\n' "$OPTARG" >&2 + exit 2 + fi + COLOR_FN="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +TEXT="${1:-}" +assert_arg "$COLOR_FN" '-c COLOR' +assert_arg "$TEXT" 'TEXT' + + +"$COLOR_FN" "$TEXT" diff --git a/bin/copy b/bin/copy new file mode 100755 index 0000000..64e1e32 --- /dev/null +++ b/bin/copy @@ -0,0 +1,67 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + copy [-n] < STDIN + copy -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -n remove newlines + -h, --help show this message + + Examples: + + Copy numbers to clipboard: + seq 10 | copy + + Copy string without newline: + echo 'with automatic newline' | copy -n + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +TRIM=false +while getopts 'nh' flag; do + case "$flag" in + n) + TRIM=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ "$TRIM" = true ]; then + cat - | tr -d '\n' | xclip -sel clip +else + cat - | xclip -sel clip +fi diff --git a/bin/e b/bin/e new file mode 100755 index 0000000..76b4899 --- /dev/null +++ b/bin/e @@ -0,0 +1,79 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + e [FILE] + e -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help + + + Flexibly run a text editor, either directly on in a pipe. + + Examples: + + Edit "file.txt": + + $ e file.txt + + Manipulate the content of a pipe midway: + + $ seq 10 | e | grep 5 + + The editor used is either $VISUAL or $EDITOR, with a fallback to + vi in case any of those variables aren't defined. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +CMD="${VISUAL:-${EDITOR:-vi}}" + +if [ ! -t 0 ]; then + F="$(mkstemp)" + cat > "$F" + exec 0&1 + exec 1>/dev/tty + $CMD "$F" + cat "$F" >&3 +else + $CMD "$@" +fi diff --git a/bin/email b/bin/email new file mode 100755 index 0000000..0a1fd15 --- /dev/null +++ b/bin/email @@ -0,0 +1,74 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + mail -s SUBJECT ADDRESS... < BODY + mail -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -s SUBJECT the email subject + -h, --help show this message + + ADDRESS the email addresses to send the email to + BODY the text to be sent as the body + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 's:h' flag; do + case "$flag" in + s) + SUBJECT="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + { + printf 'Missing %s.\n' "$2" + printf '\n' + usage + } >&2 + exit 2 + fi +} + +assert_arg "${SUBJECT:-}" '-s SUBJECT' +assert_arg "${1:-}" 'ADDRESS' + +printf 'Subject: %s\n\n%s' \ + "$(echo "$SUBJECT" | tr -d '\n')" \ + "$(cat)" | + msmtpq -a euandreh "$@" diff --git a/bin/gc b/bin/gc new file mode 100755 index 0000000..ec6a8f1 --- /dev/null +++ b/bin/gc @@ -0,0 +1,105 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + gc + gc -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +disk() { + df -h . | + awk 'NR == 2 { printf "%s - %s/%s\n", $4, $3, $2 }' +} + + +gc_guix() { + pass show velhinho/0-andreh-password | sudo -S guix system delete-generations + guix home delete-generations + guix gc -d +} + +gc_nohup() { + find ~/ -type f -name 'nohup.out' -exec rm -vf "{}" \; +} + +gc_trash() { + yes | trash-empty +} + +gc_tmpdir() { + find /tmp/ -type f -atime +10 -exec rm -vf "{}" \; ||: +} + +gc_docker() { + if command -v docker; then + yes | docker system prune -a + docker rmi "$(docker images -a -q)" ||: + docker rm "$(docker ps -a -f status=exited -q)" ||: + docker stop "$(docker ps -a -q)" ||: + docker rm "$(docker ps -a -q)" ||: + yes | docker volume prune + yes | docker container prune + fi +} + +gc_email() { + notmuch search --output=files --exclude=false tag:killed | + xargs -I{} rm -vf "{}" +} + + +BEFORE="$(disk)" +gc_guix +gc_nohup +gc_trash +gc_tmpdir +gc_docker +gc_email +wait +AFTER="$(disk)" + +printf 'Disk space:\n' +printf ' before: %s\n' "$BEFORE" +printf ' after: %s\n' "$AFTER" diff --git a/bin/grun b/bin/grun new file mode 100755 index 0000000..5884e9e --- /dev/null +++ b/bin/grun @@ -0,0 +1,102 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + grun [-r RECIPIENT] FILENAME -- COMMAND... + grun -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -r RECIPIENT the recipient to encrypt to. Can be given + multiple for multiple recipients. + -h, --help show this message + + COMMAND A command to be executed, that accepts input + in STDIN and emits result in STDOUT, and emits + errors as non-zero return codes. + FILENAME The GPG-encrypted file to be processed. If it + doesn't exist yet, it will be created. + + Examples: + + Edit "secrets.txt.gpg" using `vipe` and the default recipient: + + $ grun secrets.txt.gpg -- vipe + + Delete lines containing "FIXME" in todos.gpg: + + $ grun -r ABC123DEF321 todos.gpg -- sed '/FIXME/d' + + If COMMAND emits a non-zero return code, the file is left + unmodified. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'rh' flag; do + case "$flag" in + r) + RECIPIENTS_FLAG="${RECIPIENTS_FLAG:-} -r $OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +FILENAME="${1:-}" +assert_arg "$FILENAME" 'FILENAME' +shift + +if [ "${1:-}" != '--' ]; then + printf 'Missing "--" separator\n\n' >&2 + usage >&2 + exit 2 +fi +shift + +assert_arg "${1:-}" 'COMMAND' + + +if [ ! -e "$FILENAME" ]; then + OUT="$(printf '' | "$@")" +else + OUT="$(gpg -dq "$FILENAME" | "$@")" +fi + +echo "$OUT" | gpg -e ${RECIPIENTS_FLAG:--r eu@euandre.org} | sponge "$FILENAME" diff --git a/bin/max b/bin/max new file mode 100755 index 0000000..84585ee --- /dev/null +++ b/bin/max @@ -0,0 +1,61 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + max NUMBER... + max -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Get the maximum number from the given values. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ -z "${1:-}" ]; then + echo 0 + exit +fi + +N="$1" +for n in "$@"; do + N=$((N > n ? N : n)) +done +echo "$N" diff --git a/bin/min b/bin/min new file mode 100755 index 0000000..7868623 --- /dev/null +++ b/bin/min @@ -0,0 +1,61 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + min NUMBER... + min -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Get the minimun number from the given values. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ -z "${1:-}" ]; then + echo 0 + exit +fi + +N="$1" +for n in "$@"; do + N=$((N < n ? N : n)) +done +echo "$N" diff --git a/bin/mkdtemp b/bin/mkdtemp new file mode 100755 index 0000000..9c7ddd8 --- /dev/null +++ b/bin/mkdtemp @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + mkstemp + mkstemp -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Create a new temporary file and echo its name back. + EOF +} + +name="$(tmpname)" +mkdir "$name" +echo "$name" diff --git a/bin/mkstemp b/bin/mkstemp new file mode 100755 index 0000000..ec92c14 --- /dev/null +++ b/bin/mkstemp @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + mkstemp + mkstemp -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Create a new temporary file and echo its name back. + EOF +} + +name="$(tmpname)" +touch "$name" +echo "$name" diff --git a/bin/msg b/bin/msg new file mode 100755 index 0000000..f3e893e --- /dev/null +++ b/bin/msg @@ -0,0 +1,90 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + msg -X XMPP_MESSAGE -s -S SOUND_MESSAGE -m EMAIL -D DESKTOP -b + msg -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -X XMPP_MESSAGE send XMPP using the `xmpp` command + -s play ~/Desktop/medium.ogg sound + -S SOUND_MESSAGE say SOUND_MESSAGE using `speak` + -m EMAIL_SUBJECT send email with EMAIL_SUBJECT and empty body + -D DESKTOP_MESSAGE the desktop message for `notify-send` + -b print terminal bell + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +sound() { + play ~/Desktop/medium.ogg 2>/dev/null & +} + +ACTION_DONE=false +while getopts 'X:sS:m:D:bh' flag; do + case "$flag" in + X) + xmpp -m "$OPTARG" eu@euandreh.xyz + ACTION_DONE=true + ;; + s) + sound + ACTION_DONE=true + ;; + S) + echo "$OPTARG" | speak -v pt-BR + ACTION_DONE=true + ;; + m) + echo "" | email -s "$OPTARG" eu@euandre.org + ACTION_DONE=true + ;; + D) + notify-send "$OPTARG" + ACTION_DONE=true + ;; + b) + printf '\a' + ACTION_DONE=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done + +if [ "$ACTION_DONE" = false ]; then + sound + usage + help +fi + +wait diff --git a/bin/open b/bin/open new file mode 100755 index 0000000..df1ad56 --- /dev/null +++ b/bin/open @@ -0,0 +1,101 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + open FILE... + open -h +EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Examples: + + Open an HTML file on the current $BROWSER: + open index.html + + Open multiple PDF files (with zathura): + open *.pdf +EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ -z "${1:-}" ]; then + usage >&2 + exit 2 +fi + +for f in "$@"; do + case "$f" in + *.ico|*.jpg|*.jpeg|*.png) + feh "$f" + ;; + https://www.youtube.com/watch*) + nohup mpv "$f" 1>&2 2>/dev/null & + ;; + *.flac|*.ogg|*.mkv|*.avi|*.mp4) + nohup mpv "$f" 1>&2 2>/dev/null & + ;; + http*|*.svg|*.html) + "$BROWSER" "$f" + ;; + gopher://*) + amfora "$f" + ;; + gemini://*) + telescope "$f" + ;; + *.pdf|*.djvu|*.ps|*.epub) + nohup zathura "$f" 1>&2 2>/dev/null & + ;; + *.txt) + less "$f" + ;; + *.midi) + timidity "$f" + ;; + mailto:*) + alot compose "$f" + ;; + *) + DIR="$(cd -- "$(dirname -- "$0")"; pwd)" + CMD="$(without-env PATH "$DIR" -- command -v xdg-open)" + "$CMD" "$f" + ;; + esac +done diff --git a/bin/pre b/bin/pre new file mode 100755 index 0000000..233ac1a --- /dev/null +++ b/bin/pre @@ -0,0 +1,72 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + pre [-c COLOR] PREFIX + pre -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -c COLOR ANSI color to be used on the prefix text + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +COLOR='' +while getopts 'c:h' flag; do + case "$flag" in + c) + COLOR="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +PREFIX="${1:-}" +assert_arg "$PREFIX" 'PREFIX' + +while read -r line; do + if [ -z "$COLOR" ]; then + printf '%s: %s\n' "$PREFIX" "$line" + else + printf '%s: %s\n' "$(color -c "$COLOR" "$PREFIX")" "$line" + fi +done diff --git a/bin/print b/bin/print new file mode 100755 index 0000000..735d8ba --- /dev/null +++ b/bin/print @@ -0,0 +1,151 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + print [-d] [-q QUALITY] [FILE...] + print -h +EOF +} + +help() { + cat <<-'EOF' + + Options: + -d print duplex/double-sided + -q QUALITY choose the print quality, either: + low, medium (default) or high. + -h, --help show this message + + Examples: + + Print the given PostScript file with default quality: + $ print f1.ps + + Print multiple PDF files with high quality: + $ print -dq high *.pdf + + Print the file from STDIN, double-sided: + $ print -d < f2.ps + + Print multiple source code files: + $ print src/*.{c,h} +EOF +} + +mkdtemp() { + name="$(echo 'mkstemp(template)' | + m4 -D template="${TMPDIR:-/tmp}/m4-tmpname.")" + rm -f "$name" + mkdir "$name" + echo "$name" +} + +n_pages() { + pdftk "$1" dump_data | awk '/NumberOfPages/ { print $2 }' +} + +main() { + if file -b "$FILE" | grep -q PostScript; then + ps2pdf "$FILE" "$NEWDIR"/in.pdf + elif file -b "$FILE" | grep -q PDF; then + cp "$FILE" "$NEWDIR"/in.pdf + else + enscript -o- "$FILE" | ps2pdf - "$NEWDIR"/in.pdf + fi + cd "$NEWDIR" + + if [ -z "$DUPLEX" ]; then + lp in.pdf + cd - > /dev/null + return + fi + + if [ "$(n_pages in.pdf)" = '1' ]; then + lp in.pdf + return + fi + + pdftk A=in.pdf cat Aodd output odd.pdf + pdftk A=in.pdf cat Aeven output even.pdf + + NODD="$(n_pages odd.pdf)" + NEVEN="$(n_pages even.pdf)" + + printf 'Printing odd pages...\n' >&2 + lp odd.pdf + printf 'Has printing finished yet? Once it does, reload the pages and hit it enter to continue. ' + read -r < /dev/tty + lp even.pdf + + if [ "$NODD" != "$NEVEN" ]; then + printf '\n' | lp + fi + + cd - > /dev/null +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +lpoptions -o PrintQuality=standard +DUPLEX= +while getopts 'dq:h' flag; do + case "$flag" in + d) + DUPLEX=1 + ;; + q) + case "$OPTARG" in + low) + lpoptions -o PrintQuality=draft + ;; + medium) + lpoptions -o PrintQuality=standard + ;; + high) + lpoptions -o PrintQuality=high + ;; + *) + echo "Bad QUALITY option: \"$OPTARG\"" >&2 + exit 2 + ;; + esac + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +NEWDIR="$(mkdtemp)" +if [ -z "${1:-}" ]; then + FILE="$NEWDIR"/STDIN + cat - > "$FILE" + main +else + for f in "$@"; do + FILE="$f" + main + done +fi diff --git a/bin/qr b/bin/qr new file mode 100755 index 0000000..4821a46 --- /dev/null +++ b/bin/qr @@ -0,0 +1,58 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + qr [-s PIXEL_SIZE] + qr -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -s PIXEL_SIZE size of the pixel (default 10) + -h, --help show this help message + + Read data from STDIN and present a QR image with said data. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +PIXEL_SIZE=10 +while getopts 's:h' flag; do + case "$flag" in + s) + PIXEL_SIZE="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +cat | qrencode -s "$PIXEL_SIZE" -o- | feh - diff --git a/bin/rfc b/bin/rfc new file mode 100755 index 0000000..a483595 --- /dev/null +++ b/bin/rfc @@ -0,0 +1,117 @@ +#!/bin/sh +set -eu + +TARBALL_URL='https://www.rfc-editor.org/in-notes/tar/RFC-all.tar.gz' + +usage() { + cat <<-'EOF' + Usage: + rfc [-w] RFC_NUMBER + rfc -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -w Show the path to the RFC file instead of displaying + its contents. + -h, --help show this message + + Lookup the given RFC + in $XDG_DATA_HOME/doc/rfc/ (defaults to ~/.local/share), + and feed it into the $PAGER, akin to doing: + + $ $PAGER $XDG_DATA_HOME/doc/rfc/rfc$RFC_NUMBER.txt + + If the $XDG_DATA_HOME/doc/rfc/ directory doesn't exist, it tries to + create it by downloading the latest RFC tarball [0] and placing all .txt + files there. + EOF + + printf '\n[0]: %s\n' "$TARBALL_URL" +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'wh' flag; do + case "$flag" in + w) + WHERE=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +RFC_NUMBER="${1:-}" +if [ -z "$RFC_NUMBER" ]; then + echo 'Missing argument RFC_NUMBER' >&2 + usage >&2 + exit 2 +fi + +D="${XDG_DATA_HOME:-$HOME/.local/share}/doc/rfc" +if [ ! -e "$D" ]; then + printf 'RFC directory does not exist:\n\t%s/\n\n' "$D" + printf 'Do you want to download the files to create it? [Y/n] ' + read -r yesno + if [ "$yesno" != 'n' ] && [ "$yesno" != 'N' ]; then + CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/rfc-cli" + mkdir -p "$CACHE_DIR" + wget -cO "$CACHE_DIR"/RFC-all.tar.gz "$TARBALL_URL" + rm -rf "$CACHE_DIR/tmp" + mkdir -p "$CACHE_DIR/tmp" + tar \ + -C "$CACHE_DIR/tmp" \ + -xvf "$CACHE_DIR"/RFC-all.tar.gz \ + --wildcards \ + 'rfc*.txt' + mkdir -p "$(dirname "$D")" + mv "$CACHE_DIR/tmp" "$D" + fi +fi + +F="$D/rfc${RFC_NUMBER}.txt" +if [ ! -e "$F" ]; then + printf 'Given RFC_NUMBER "%s" does not exist at:\n%s\n' \ + "$RFC_NUMBER" "$F" >&2 + exit 2 +fi + +if [ "${WHERE:-}" = true ]; then + printf '%s\n' "$F" + exit +fi + +view() { + if [ -t 1 ]; then + ${PAGER:-cat} + else + cat + fi +} + +view < "$F" diff --git a/bin/tmpname b/bin/tmpname new file mode 100755 index 0000000..d83fc87 --- /dev/null +++ b/bin/tmpname @@ -0,0 +1,52 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + tmpname + tmpname -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Generate a temporary name. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +echo "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)" diff --git a/bin/uuid b/bin/uuid new file mode 100755 index 0000000..74d0fba --- /dev/null +++ b/bin/uuid @@ -0,0 +1,53 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + uuid + uuid -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Generate UUID from /dev/random. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +od -xN20 /dev/random | + awk 'NR == 1 { OFS="-"; print $2$3,$4,$5,$6,$7$8$9; exit }' diff --git a/bin/with-email b/bin/with-email new file mode 100755 index 0000000..9d6326b --- /dev/null +++ b/bin/with-email @@ -0,0 +1,84 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + with-email [-s SUBJECT] COMMAND... + with-email -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -s SUBJECT set the subject of the email + -h, --help show this message + + COMMAND the command to be wrapped + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +SUBJECT='NO SUBJECT' +while getopts 's:h' flag; do + case "$flag" in + s) + SUBJECT="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +assert_arg "${1:-}" 'COMMAND...' + +now() { + date '+%Y-%m-%dT%H:%M:%S%Z' +} + +OUT="$(mkstemp)" +{ + printf 'Running command: %s\n' "$*" + printf 'Starting at: %s\n' "$(now)" + printf '\n' + + STATUS=0 + "$@" 2>&1 || STATUS=$? + + printf '\n' + printf '\nFinished at: %s\n' "$(now)" +} 2>&1 1>"$OUT" + +email -s "(exit status: $STATUS) - $SUBJECT" eu@euandre.org < "$OUT" diff --git a/bin/without-env b/bin/without-env new file mode 100755 index 0000000..45c41ca --- /dev/null +++ b/bin/without-env @@ -0,0 +1,76 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + without-env ENVVAR PATH -- COMMAND... + without-env [-h] + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + Examples: + + Execute "command -V" filtering ~/bin, to get where "w3m" is + in $PATH, other than ~/bin: + $ without-env PATH ~/bin -- command -v w3m + + Compile foo.c, excluding ~/.local/include + from $C_INCLUDE_PATH: + $ without-env C_INCLUDE_PATH ~/.local/include -- cc -co foo.o foo.c + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s\n' "$2" >&2 + exit 2 + fi +} + +assert_arg "${1:-}" 'ENVVAR' +assert_arg "${2:-}" 'PATH' +assert_arg "${3:-}" '--' + +eval "export $1=\"\$(echo \"\$$1\" | sed \"s|\$2:||g\")\"" +shift # drop $1 +shift # drop $2 +shift # drop -- + +"$@" diff --git a/bin/xdg-open b/bin/xdg-open new file mode 120000 index 0000000..ce4a72b --- /dev/null +++ b/bin/xdg-open @@ -0,0 +1 @@ +open \ No newline at end of file diff --git a/bin/xmpp b/bin/xmpp new file mode 100755 index 0000000..472e9ca --- /dev/null +++ b/bin/xmpp @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 + +import os +import sys +import getopt +import logging +import slixmpp + +USAGE = """\ +Usage: + xmpp [-d] [-F FROM_JID] -m MESSAGE TO_JID... + xmpp -h""" + +HELP = """ +Options: + -d run in DEBUG mode + -m MESSAGE the text of the message to be sent + -h, --help show this message + + FROM_JID the address used to send the message from + TO_JID the addresses where to send the message to""" + +class SendMsgBot(slixmpp.ClientXMPP): + def __init__(self, jid, password, on_start): + slixmpp.ClientXMPP.__init__(self, jid, password) + + self.on_start = on_start + self.add_event_handler("session_start", self.start) + + def start(self, event): + self.on_start(self) + self.disconnect(wait=True) + +def main(): + logging.basicConfig(level=logging.INFO) + from_ = "bot@euandreh.xyz" + message = "" + + for s in sys.argv: + if s == "--": + break + elif s == "--help": + print(USAGE) + print(HELP) + sys.exit() + + try: + opts, args = getopt.getopt(sys.argv[1:], 'm:F:dh') + except getopt.GetoptError as err: + print(err, file=sys.stderr) + print(USAGE, file=sys.stderr) + sys.exit(2) + for o, a in opts: + if o == "-m": + message = a + elif o == "-F": + from_ = a + elif o == "-d": + logging.basicConfig(level=logging.DEBUG) + elif o == "-h": + print(USAGE) + print(HELP) + sys.exit() + else: + assert False, "unhandled option" + + if message == "": + print("Missing -m MESSAGE", file=sys.stderr) + print(USAGE, file=sys.stderr) + sys.exit(2) + + if args == []: + print("Missing TO_JID", file=sys.stderr) + print(USAGE, file=sys.stderr) + sys.exit(2) + + passcmd = "pass show VPS/kuvira/XMPP/" + from_ + " | head -n1 | tr -d '\\n'" + password = os.popen(passcmd).read() + + def on_start(self): + for to in args: + self.send_message(mto=to, mbody=message, mtype='chat') + + xmpp = SendMsgBot(from_, password, on_start) + xmpp.connect() + xmpp.process(forever=False) + +if __name__ == "__main__": + main() diff --git a/etc/afew/config b/etc/afew/config new file mode 100644 index 0000000..94341e9 --- /dev/null +++ b/etc/afew/config @@ -0,0 +1,6 @@ +[SpamFilter] +[KillThreadsFilter] +[ListMailsFilter] +[ArchiveSentMailsFilter] +[MeFilter] +[InboxFilter] diff --git a/etc/alot/config b/etc/alot/config new file mode 120000 index 0000000..a92319d --- /dev/null +++ b/etc/alot/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/alot/config \ No newline at end of file diff --git a/etc/bash/check.sh b/etc/bash/check.sh new file mode 100755 index 0000000..7c12dec --- /dev/null +++ b/etc/bash/check.sh @@ -0,0 +1,57 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + check.sh + check.sh -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +shellcheck -xe 1090,1091 \ + "$XDG_CONFIG_HOME"/bash/rc \ + "$XDG_CONFIG_HOME"/bash/vcs-ps1.sh \ + "$XDG_CONFIG_HOME"/bash/check.sh \ + "$XDG_CONFIG_HOME"/bash/privrc.sh + +sh -eu ~/.profile diff --git a/etc/bash/inputrc b/etc/bash/inputrc new file mode 100644 index 0000000..f5c7095 --- /dev/null +++ b/etc/bash/inputrc @@ -0,0 +1,2 @@ +"\e[B": history-search-forward +"\e[A": history-search-backward diff --git a/etc/bash/privrc.sh b/etc/bash/privrc.sh new file mode 120000 index 0000000..243a4bd --- /dev/null +++ b/etc/bash/privrc.sh @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/privrc.sh \ No newline at end of file diff --git a/etc/bash/vcs-ps1.sh b/etc/bash/vcs-ps1.sh new file mode 100644 index 0000000..f2103da --- /dev/null +++ b/etc/bash/vcs-ps1.sh @@ -0,0 +1,158 @@ +#!/bin/sh + +repo_status_git() { + BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" + OUT="$(git status --short --branch --porcelain)" + BRANCH_LINE="$(echo "$OUT" | head -n 1)" + DIFF_LINES="$(echo "$OUT" | tail -n +2)" + + IS_AHEAD=false + IS_BEHIND=false + if echo "$BRANCH_LINE" | grep -q 'ahead'; then + IS_AHEAD=true + fi + if echo "$BRANCH_LINE" | grep -q 'behind'; then + IS_BEHIND=true + fi + + LINE='' + + if [ "$IS_AHEAD" = true ] && [ "$IS_BEHIND" = true ]; then + LINE="^^^ $BRANCH_NAME vvv" + elif [ "$IS_AHEAD" = true ]; then + LINE="^ $BRANCH_NAME ^" + elif [ "$IS_BEHIND" = true ]; then + LINE="v $BRANCH_NAME v" + else + LINE="$BRANCH_NAME" + fi + + HAS_DIFF=false + HAS_UNTRACKED=false + if echo "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then + HAS_DIFF=true + fi + if echo "$DIFF_LINES" | grep -q '^[?][?]'; then + HAS_UNTRACKED=true + fi + + if [ "$HAS_DIFF" = true ]; then + COLOR_FN=redb + LINE="{$LINE}" + elif [ "$IS_AHEAD" = true ] || [ "$IS_BEHIND" = true ]; then + COLOR_FN=bluei + LINE="[$LINE]" + elif [ "$HAS_UNTRACKED" = true ]; then + COLOR_FN=lightblue + LINE="{$LINE}" + else + COLOR_FN=green + LINE="($LINE)" + fi + + color -c "$COLOR_FN" "$LINE" + + BRANCH_COUNT="$(git branch --list | wc -l)" + if [ "$BRANCH_COUNT" -gt 1 ]; then + color -c lightblue "<$BRANCH_COUNT>" + fi + + STASH_COUNT="$(git stash list | wc -l)" + if [ "$STASH_COUNT" != 0 ]; then + color -c red "*$STASH_COUNT" + fi + + color -c blacki " - git/$(git rev-parse HEAD)" +} + +repo_status_fossil() { + BRANCH_NAME="$(fossil branch current)" + + if [ -n "$(fossil extras)" ]; then + HAS_UNTRACKED=1 + fi + + BRANCH_MARKER="$BRANCH_NAME" + + if [ -n "${HAS_UNTRACKED:-}" ]; then + COLOR_FN=lightblue + LINE="($BRANCH_MARKER)" + else + COLOR_FN=green + LINE="($BRANCH_MARKER)" + fi + + color -c "$COLOR_FN" "$LINE" + + color -c blacki " - fossil/$(fossil info | awk '/^checkout:/ { print $2 }')" +} + +repo_status_mercurial() { + BRANCH_NAME="$(hg branch)" +} + +repo_status() { + dir="$(basename "$PWD")" + if [ -d .git ]; then + repo_status_git + elif [ -f "$dir.fossil" ]; then + repo_status_fossil + elif [ -d .hg ]; then + repo_status_mercurial + fi +} + + +error_marker() { + STATUS=$? + if [ "$STATUS" != 0 ]; then + color -c redb " (!! $STATUS !!) " + fi +} + +timestamp() { + color -c blacki '\T' +} + +path() { + color -c yellowb '\w/' +} + +guix_env() { + if [ "$GUIX_ENVIRONMENT" != '' ]; then + printf '\n' + color -c blacki '~> ' + color -c purple 'guix environment ' + printf '(' + color -c blueb "$GUIX_ENVIRONMENT" + printf ')' + fi +} + +in_nix_shell() { + if [ "$IN_NIX_SHELL" != '' ]; then + printf '\n' + color -c blacki '~> ' + color -c purpleb "$IN_NIX_SHELL " + color -c purple 'nix-shell ' + printf '(' + color -c blueb "${name:-}" + printf ')' + fi +} + +PS1='`error_marker`'$(timestamp)' '$(path)' `repo_status``guix_env``in_nix_shell` +$ ' + + +vcs_status() { + git status "$@" +} + +vcs_diff() { + git diff "$@" +} + +vcs_diff_staged() { + git diff --staged "$@" +} diff --git a/etc/gnupg/gpg.conf b/etc/gnupg/gpg.conf new file mode 100644 index 0000000..d4498fe --- /dev/null +++ b/etc/gnupg/gpg.conf @@ -0,0 +1 @@ +keyserver pool.sks-keyservers.net diff --git a/etc/gnupg/sshcontrol b/etc/gnupg/sshcontrol new file mode 100644 index 0000000..1ae03ed --- /dev/null +++ b/etc/gnupg/sshcontrol @@ -0,0 +1 @@ +750154E135FD7B11FDDF0107CC0904F92EBD2AE4 diff --git a/etc/guix/channels.scm b/etc/guix/channels.scm new file mode 100644 index 0000000..304db35 --- /dev/null +++ b/etc/guix/channels.scm @@ -0,0 +1,20 @@ +(append + (list + (channel + (name 'xyz-euandreh) + (url "git://euandreh.xyz/package-repository.git/") + (branch "main") + (introduction + (make-channel-introduction + "d749e053e6db365069cb9b2ef47a78b06f9e7361" + (openpgp-fingerprint + "5BDA E9B8 B2F6 C6BC BB0D 6CE5 81F9 0EC3 CD35 6060")))) + (channel + (name 'nonguix) + (url "https://gitlab.com/nonguix/nonguix") + (introduction + (make-channel-introduction + "897c1a470da759236cc11798f4e0a5f7d4d59fbc" + (openpgp-fingerprint + "2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))) + %default-channels) diff --git a/etc/guix/home.scm b/etc/guix/home.scm new file mode 100644 index 0000000..607a059 --- /dev/null +++ b/etc/guix/home.scm @@ -0,0 +1,152 @@ +(use-modules + (curth0) + (gnu home services) + (gnu home services shells) + (gnu packages) + (gnu packages mail) + (gnu packages gnupg) + (gnu services) + (guix gexp) + (guix packages) + (guix utils)) + +(define msmtp-non-hardcoded + (package + (inherit msmtp) + (name "msmtp-non-hardcoded") + (arguments + (substitute-keyword-arguments (package-arguments msmtp) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'install-additional-files 'patch-hardcoded-paths + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out"))) + (substitute* (string-append out "/bin/msmtpq") + (("^LOG=.*$") "LOG=${XDG_LOG_HOME:-$HOME/.local/var/log}/msmtpq.log\n") + (("^Q=.*$") "Q=${XDG_DATA_HOME:-$HOME/.local/share}/msmtp/queue\n") + (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) + +(define (xdg-config-home s) + (string-append (getenv "XDG_CONFIG_HOME") "/" s)) + +(define gitconfig (mixed-text-file "gitconfig" #"- + [user] + email = eu@euandre.org + name = EuAndreh + signingkey = 81F90EC3CD356060 + [transfer] + fsckobjects = true + [push] + default = current + [commit] + gpgsign = true + verbose = true + [init] + defaultBranch = main + [sendemail] + assume8bitEncoding = UTF-8 + smtpserveroption = -a + smtpserveroption = euandreh + annotate = yes + confirm = never + smtpserver = "# msmtp-non-hardcoded "/bin/msmtpq\n")) + +(define gpg-agent.conf (mixed-text-file "gpg-agent.conf" #"- + default-cache-ttl 172800 + default-cache-ttl-ssh 172800 + max-cache-ttl 604800 + max-cache-ttl-ssh 604800 + enable-ssh-support + pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) + +(define config-files + `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) + ("git/config" ,gitconfig))) + +(define (dot-config) + (define (prefix-with-config s) + (string-append (substring (getenv "XDG_CONFIG_HOME") + (+ 1 (string-length (getenv "HOME")))) + "/" + s)) + (map (lambda (t) + (list (prefix-with-config (first t)) + (second t))) + config-files)) + +(home-environment + (packages + (append + (map (compose list specification->package+output symbol->string) + '(man-pages + posix-man-pages + + tree + openssh + mailutils + entr + git + git:send-email + tmux + rsync + gnupg + pulseaudio + password-store + playerctl + pinentry-gtk2 + bmake + fzf + ranger + blueman + ledger + curl + xclip + cloc + strace + file + urlscan + rlwrap + direnv + borg + khal + khard + libfaketime + qrencode + feh + sox + xset + graphviz + moreutils + shellcheck + gettext + groff + + clojure + openjdk + sbcl + perl + perl-mojolicious + + st + i3status + dmenu + + weechat + alot + notmuch + isync + w3m + afew + + zathura + zathura-djvu + zathura-pdf-poppler + zathura-ps + firefox)) + (list msmtp-non-hardcoded))) + (services + (list (service home-bash-service-type + (home-bash-configuration + (bashrc + (list (plain-file "bashrc.sh" ". $XDG_CONFIG_HOME/bash/rc"))))) + (simple-service 'config-files home-files-service-type (dot-config))))) diff --git a/etc/guix/system.scm b/etc/guix/system.scm new file mode 100644 index 0000000..3bd7235 --- /dev/null +++ b/etc/guix/system.scm @@ -0,0 +1,102 @@ +(use-modules + (curth0) + (gnu bootloader) + (gnu bootloader grub) + (gnu packages) + (gnu services base) + (gnu services desktop) + (gnu services security-token) + (gnu services xorg) + (gnu system keyboard) + (gnu system file-systems) + (gnu system mapped-devices) + (guix gexp) + (nongnu packages linux) + (nongnu system linux-initrd)) + +(operating-system + (kernel linux) + (initrd microcode-initrd) + (firmware (list linux-firmware)) + (locale "fr_FR.UTF-8") + (timezone "America/Sao_Paulo") + (keyboard-layout + (keyboard-layout "br" #:options '("caps:swapescape" "esperanto:qwerty"))) + (host-name "velhinho") + (users + (append + (let ((user-groups '("wheel" "netdev" "audio" "video"))) + (list + (user-account + (name "andreh") + (comment "EuAndreh") + (group "users") + (supplementary-groups user-groups)) + (user-account + (name "other") + (comment "Other Self") + (group "users") + (supplementary-groups user-groups)))) + %base-user-accounts)) + (packages + (append + (map (compose list specification->package+output symbol->string) + '(nss-certs + i3-wm)) + %base-packages)) + (services + (append + (list + (service bluetooth-service-type) + (service pcscd-service-type) + (service gnome-desktop-service-type) + (set-xorg-configuration + (xorg-configuration + (keyboard-layout keyboard-layout) + (extra-config (list #"- + Section "InputClass" + Identifier "touchpad" + Driver "libinput" + MatchIsTouchpad "on" + Option "Tapping" "on" + EndSection + "#))))) + (modify-services %desktop-services + (guix-service-type config => + (guix-configuration + (inherit config) + (substitute-urls + (append '("https://substitutes.nonguix.org") + %default-substitute-urls)) + (authorized-keys + (append (list (plain-file "non-guix.pub" #"- + (public-key + (ecc + (curve Ed25519) + (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#))) + "#)) + %default-authorized-guix-keys))))))) + (bootloader + (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets (list "/boot/efi")) + (keyboard-layout keyboard-layout))) + (mapped-devices + (list + (mapped-device + (source (uuid "6b0d38a6-d93e-4f8e-a59a-7729f5adf892")) + (target "cryptroot") + (type luks-device-mapping)))) + (file-systems + (append + (list + (file-system + (mount-point "/boot/efi") + (device (uuid "1B26-9F4E" 'fat32)) + (type "vfat")) + (file-system + (mount-point "/") + (device "/dev/mapper/cryptroot") + (type "ext4") + (dependencies mapped-devices))) + %base-file-systems))) diff --git a/etc/hg/hgrc b/etc/hg/hgrc new file mode 100644 index 0000000..656f40b --- /dev/null +++ b/etc/hg/hgrc @@ -0,0 +1,2 @@ +[ui] +username = EuAndreh diff --git a/etc/i3/config b/etc/i3/config new file mode 100644 index 0000000..0b41311 --- /dev/null +++ b/etc/i3/config @@ -0,0 +1,186 @@ +set $mod Mod4 + + +# font pango:monospace 8 + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +font pango:DejaVu Sans Mono 8 + +# Start XDG autostart .desktop files using dex. See also +# https://wiki.archlinux.org/index.php/XDG_Autostart +exec --no-startup-id dex --autostart --environment i3 + +# The combination of xss-lock, nm-applet and pactl is a popular choice, so +# they are included here as an example. Modify as you see fit. + +# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the +# screen before suspend. Use loginctl lock-session to lock your screen. +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork + +# NetworkManager is the most popular way to manage wireless networks on Linux, +# and nm-applet is a desktop environment-independent system tray GUI for it. +exec --no-startup-id nm-applet +exec --no-startup-id blueman-applet +exec --no-startup-id poweralertd +exec dunst + +# Use pactl to adjust volume in PulseAudio. +set $refresh_i3status killall -SIGUSR1 i3status +bindsym F1 exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym F2 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status +bindsym F3 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status + +bindsym F4 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` position 5- +bindsym Shift+F4 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` previous +bindsym F5 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` play-pause +Bindsym Shift+F5 exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/rotate-mpris-player.sh +bindsym F6 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` position 5+ +bindsym Shift+F6 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` next + +# FIXME bad path +bindsym F7 exec --no-startup-id ~/.local/bin/brightness -1 +bindsym F8 exec --no-startup-id ~/.local/bin/brightness +1 + + + +bindsym $mod+Shift+s exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/toggle-pulseaudio-sink.sh && $refresh_i3status + + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +bindsym $mod+Return exec st +bindsym $mod+Shift+q kill +bindsym $mod+p exec --no-startup-id dmenu_run + + + + +# FIXME: better placement of these files +bindsym $mod+o exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-emoji.sh +bindsym $mod+v exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-clipmenu.sh +bindsym $mod+i exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass.sh +bindsym $mod+Control+i exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass-login.sh + + + + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# bindsym $mod+h split h # what is this? + +# split in vertical orientation +# FIXME: what is this? It was in conflict with dmenu-clipmenu +# bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e 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'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + # bindsym Left resize shrink width 10 px or 10 ppt + # bindsym Down resize grow height 10 px or 10 ppt + # bindsym Up resize shrink height 10 px or 10 ppt + # bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Caps_Lock mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + position top + status_command i3status +} + +default_border pixel +default_floating_border pixel diff --git a/etc/info/infokey b/etc/info/infokey new file mode 100644 index 0000000..90edc50 --- /dev/null +++ b/etc/info/infokey @@ -0,0 +1,7 @@ +^e down-line +^y up-line + +#var +link-style=cyan +active-link-style=blue,bold +match-style=underline,bold,bggreen diff --git a/etc/khal/config b/etc/khal/config new file mode 120000 index 0000000..dfae173 --- /dev/null +++ b/etc/khal/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/khal/config \ No newline at end of file diff --git a/etc/khard/khard.conf b/etc/khard/khard.conf new file mode 120000 index 0000000..f015b29 --- /dev/null +++ b/etc/khard/khard.conf @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/khard/khard.conf \ No newline at end of file diff --git a/etc/mailcaps/config b/etc/mailcaps/config new file mode 100644 index 0000000..aeea68d --- /dev/null +++ b/etc/mailcaps/config @@ -0,0 +1 @@ +text/html; w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput diff --git a/etc/mbsync/config b/etc/mbsync/config new file mode 120000 index 0000000..68a3234 --- /dev/null +++ b/etc/mbsync/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/mbsync/config \ No newline at end of file diff --git a/etc/msmtp/config b/etc/msmtp/config new file mode 120000 index 0000000..45cd0ac --- /dev/null +++ b/etc/msmtp/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/msmtp/config \ No newline at end of file diff --git a/etc/newsboat/urls b/etc/newsboat/urls new file mode 120000 index 0000000..3c453f5 --- /dev/null +++ b/etc/newsboat/urls @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/newsboat/urls \ No newline at end of file diff --git a/etc/notmuch/default/config b/etc/notmuch/default/config new file mode 120000 index 0000000..3b9d2f4 --- /dev/null +++ b/etc/notmuch/default/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/notmuch/default/config \ No newline at end of file diff --git a/etc/notmuch/default/hooks/post-new b/etc/notmuch/default/hooks/post-new new file mode 120000 index 0000000..7992789 --- /dev/null +++ b/etc/notmuch/default/hooks/post-new @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/notmuch/post-new \ No newline at end of file diff --git a/etc/python/pythonrc.py b/etc/python/pythonrc.py new file mode 100644 index 0000000..1fc3bfe --- /dev/null +++ b/etc/python/pythonrc.py @@ -0,0 +1,15 @@ +import os +import atexit +import readline + +history = os.path.join(os.environ["XDG_STATE_HOME"], "python-history") + +try: + readline.read_history_file(history) +except OSError: + pass + +def write_history(): + readline.write_history_file(history) + +atexit.register(write_history) diff --git a/etc/ranger/rc.conf b/etc/ranger/rc.conf new file mode 100644 index 0000000..ed2b538 --- /dev/null +++ b/etc/ranger/rc.conf @@ -0,0 +1 @@ +map DD shell trash %s diff --git a/etc/sbcl/sbclrc.lisp b/etc/sbcl/sbclrc.lisp new file mode 100644 index 0000000..df7f57a --- /dev/null +++ b/etc/sbcl/sbclrc.lisp @@ -0,0 +1,6 @@ +;;; The following lines added by ql:add-to-init-file: +#-quicklisp +(let ((quicklisp-init (merge-pathnames "dev/quicklisp/setup.lisp" + (user-homedir-pathname)))) + (when (probe-file quicklisp-init) + (load quicklisp-init))) diff --git a/etc/ssh/known_hosts b/etc/ssh/known_hosts new file mode 100644 index 0000000..ad6b0b2 --- /dev/null +++ b/etc/ssh/known_hosts @@ -0,0 +1,74 @@ +|1|G2vfdmQ84glwobYXZZ0d+cCMVRE=|DZJYmWjbeP52J4K7+Bsz2e0dgBA= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +|1|yosAhKlbZt51FfD2VvQJiVijSBA=|BFEig1gqq4EwCHEHagEASQZQmNI= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +|1|5yKbUaAB5AFz4MINtTVhVAPwMtU=|LwcI5Z8hXwwKxtkk4KDpeZduyPQ= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +|1|sfEM3JnFec93XEzMf9A6TkthgdI=|oZX7oe9eBKYMrXLcoFydh70my5A= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +|1|F/E3nafzrpMZEzyN8iA++okJ7Q4=|T00Gk7F90YmbaTMSOGjP8yhls94= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMylg2eib0byVT2R7dVFkxdhXO5pvgllnszKhlHiEP15ee8IjMYNPvz2A605hUdIxXtsBgjf+u7jlubh6mbx/YA= +|1|jSpDKjDomux2z3O/ok/UPGGQ8xs=|ZP60naGKQnpK6yHGD+B/+ykB05c= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMylg2eib0byVT2R7dVFkxdhXO5pvgllnszKhlHiEP15ee8IjMYNPvz2A605hUdIxXtsBgjf+u7jlubh6mbx/YA= +|1|PJybLcZRkpN9IyDsqaNjGO6lE5Y=|K0nchvCA7XV91J2X6l0h2DwOmyI= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +|1|zzdSJf8JIMfi5sKbc/mNcBy/RB8=|0GxC/CesxJHcRdt8MuPVjfab06k= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +|1|X5OmtKdXZh2kC//XCXEEOim7tgE=|Rh5ro2oEB4MN8MP6PRbG3QBR0Kk= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +46.101.43.82 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLIGIc5X12Y61eVcKJnNzCvrPeSKgyKgElqGl7QDeGeynE33sRVoNAg9aqkgXdc2MkN+nFhEWELkjPuBKYsyp2I= +hinarioespirita.org,167.99.34.30 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= +pt.hinarioespirita.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= +mtm.hinarioespirita.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEnGFkXNEF6RHihT3szgVEBAhRKXlI6YKSUOQFzhuNVkMOBgEfr+OaXpFV3zQ3/Dp875skdTOZaA9DjQ0EeUS+M= +77.109.148.18 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +35.231.145.151 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +git.sr.ht,173.195.146.142 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +192.168.33.10 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCL+hEiW/Va2L6y5Y4MyxRBXHJw/9bIC02M3wGVe1zaD3DT8wsAUcJ2QO1lJILudvMInx+SaPyJmwBvUn58YR2c= +173.195.146.152 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +2001:1620:2019::218 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKBxDZv64oRMzRkywjmRRrml2pr0XFSZhlL46nUSmM60 +140.82.114.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +140.82.113.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +140.82.113.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +140.82.114.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +2604:bf00:710:0:5054:ff:fe7d:8fa8 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +azusa.runners.sr.ht,2604:bf00:710:0:ae1f:6bff:fead:55a ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPzxK5AM1FdMI9gZVDpw2O5iiS/49QokWpzANFntVt0Qig4qdBt4K7B0O6MrwggLh3A+zBlsXCMoWtvFtPQgLxA= +18.228.52.138 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +18.231.5.6 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +2604:bf00:710:0:5054:ff:fe36:ebc6 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCj6y+cJlqK3BHZRLZuM+KP2zGPrh4H66DacfliU1E2DHAd1GGwF4g1jwu3L8gOZUTIvUptqWTkmglpYhFp4Iy4= +18.228.67.229 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +hg.sr.ht,2604:bf00:710:0:5054:ff:fe25:1aa6 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL4aNGa+KnvMA0QoWrIVuI2QBU0Q/xX48sMBl3VtP/zPOGMvS50zGVMaA00RSzfcI2X0v/aUTsVm2vBNo/V1gTg= +euandre.org,2a03:b0c0:3:d0::387:b001 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF6wlJqwd7KWLzLovwnwbTmNfO4E4yVDyqxAAlUkn9eDsTtzV1RYNDsaLPWv4mweJqP4crZPFxg40sFVeMDbkC0= +2606:4700:90:0:f22e:fbec:5bed:a9b9 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +46.101.160.115 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF6wlJqwd7KWLzLovwnwbTmNfO4E4yVDyqxAAlUkn9eDsTtzV1RYNDsaLPWv4mweJqP4crZPFxg40sFVeMDbkC0= +173.195.146.249 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPzxK5AM1FdMI9gZVDpw2O5iiS/49QokWpzANFntVt0Qig4qdBt4K7B0O6MrwggLh3A+zBlsXCMoWtvFtPQgLxA= +2604:a880:800:14::32:4000 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK8YTumqLFAL5MJ0AcDtFG9dWfbkJKU7FUDlH0xEgAZvHGU57TBr9DIQy2OHrxCxuhk9bZEUX8+vJiRXE05+Rzs= +2001:19f0:7001:5cec:5400:2ff:feec:9940 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPYRWlGutc+bRJ+N0sXHxhgnDsRvRoauQ92yM1U7N+8a +2001:19f0:6c01:2cf0:5400:2ff:feec:99c5 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMGiiEXB+koPS1vgGkwdExk2Q5fGv3Yc5rf8jVHB2FB7 +45.32.155.96 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN +45.77.65.204 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN +136.244.85.68 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfPxSXxvq3MHuMvthg+q69ooniSeqXbit1UiW0gbLZN +199.247.0.136 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +euandreh.xyz ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +136.244.80.130 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +209.250.232.122 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +git.euandreh.xyz ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +80.240.24.148 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +95.179.246.150 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +45.77.52.185 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +199.247.2.245 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +140.82.112.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +104.238.176.223 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +172.65.251.78 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= +140.82.112.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +45.32.158.17 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +95.179.253.243 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +95.179.163.103 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +217.69.2.177 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +arrobaponto.org,104.238.167.189 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +104.238.176.81 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +git.arrobaponto.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +173.199.70.52 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= +[remembering.euandreh.xyz]:23841 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +167.71.86.194 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCXg/l/grol/OAY95VphKbVn4yXUStSWpxQjnka7PWXzWyForfX+fpmY+p72r1Uimx5oXIFISt8uSZW/tvD61iQ= +[localhost]:10022 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLHACdQJXUj5e4Znyh7KdTjB1RLznSfStRw6cuHZlu8rhANVfkjt300Fum9Jv6yLra6W4v2FLALWfcYpOlUzt9c= +107.191.63.70 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMONpsqwH79f/MsjtsOPitT5C+3hPPJqVh42oHMKOen6 +217.69.11.49 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr +[arrobaponto.org]:23213 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr +anoncvs.netbsd.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA3QiBl8leG9fqIJpKeNov0PKq5YryFFiroMWOPUv4hDFn8R0jC07YVaR/OSBrr37CTmGX5AFceXPzoFnLlwCqWR7rXg4NR75FTlTp9CG9EBAEtU8mee27KDrUFBTZdfVl2+aRYoAI5fTXA+0vpIO68Cq843vRWUZCcwinS4cNLUU= +git.2f30.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSLZ4G5w4NysBUmAHmr6/V9om42IHSUCtqrNdhWoYQ0 +[arrobaponto.org]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 +[199.247.13.53]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 +[2001:19f0:6801:988:5400:3ff:fea1:b566]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 +[gerrit.wikimedia.org]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCF8pwFLehzCXhbF1jfHWtd9d1LFq2NirplEBQYs7AOrGwQ/6ZZI0gvZFYiEiaw1o+F1CMfoHdny1VfWOJF3mJ1y9QMKAacc8/Z3tG39jBKRQCuxmYLO1SWymv7/Uvx9WQlkNRoTdTTa9OJFy6UqvLQEXKYaokfMIUHZ+oVFf1CgQ== +2001:19f0:5:1d65:5400:3ff:fee3:7463 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF2EgU3IgCwv1ynnWfxFm0SHTSoE0AYG3MJT/TpN3pBz diff --git a/etc/tmux/tmux.conf b/etc/tmux/tmux.conf new file mode 100644 index 0000000..dd718ca --- /dev/null +++ b/etc/tmux/tmux.conf @@ -0,0 +1,81 @@ +# Use personal prefix over "C-b" +unbind C-b +set -g prefix C-v + +# Turn on mouse mode +# https://groups.google.com/forum/#!msg/tmux-users/TRwPgEOVqho/Ck_oth_SDgAJ +# https://github.com/tmux/tmux/blob/310f0a960ca64fa3809545badc629c0c166c6cd2/CHANGES#L12 +set -g mouse on + +# Bind "C-x r" to reload the configuration file +bind-key r source-file $XDG_CONFIG_HOME/tmux/tmux.conf \; display-message "$XDG_CONFIG_HOME/tmux.conf reloaded" + +# Holy answer that properly implements copying from tmux! +# https://unix.stackexchange.com/a/349020/276661 +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xclip -selection clipboard -i" \; +bind-key y send-keys -X copy-pipe "xclip -selection clipboard -i" \; display-message "Copied system clipboard! Hooray! Long-live tmux!" + +# Moving around panes +bind-key -n M-h select-pane -L +bind-key -n M-j select-pane -D +bind-key -n M-k select-pane -U +bind-key -n M-l select-pane -R + +# Resizing panes +bind-key -n M-H resize-pane -L 5 +bind-key -n M-J resize-pane -D 5 +bind-key -n M-K resize-pane -U 5 +bind-key -n M-L resize-pane -R 5 + +# Reorder windows +bind-key -n C-S-Left swap-window -t -1\; select-window -t -1 +bind-key -n C-S-Right swap-window -t +1\; select-window -t +1 +# +# To change the number of a window, use: PREFIX-., and pick a new unused number +# + +# Join windows +bind-key -n C-S-M-Left join-pane -s :-0 -t :-1 +bind-key -n C-S-M-Right join-pane -s :-0 -t :+1 + +# "M m" to actually clear the pane history +bind -n M-m send-keys -R \; clear-history + +# Keybinding to activate pane typing sync +# https://stackoverflow.com/questions/25909964/tmux-how-to-toggle-on-and-off-options-with-the-same-key +bind-key b setw synchronize-panes \; display-message "synchronize-panes toggle" + +setw -g mode-keys vi # Move around with vi keys +set-option -g status-key "vi" # Use vi mode for status bar command (like after typing "C-x [" one can search with "/") +set-option -g status-bg "#666666" # Status bar background color +set-option -g status-fg "#aaaaaa" # Status bar foreground color +set-option -g status-left-length 50 # session name in status bar length =[annex]= part +set-option -g history-limit 150000 # How many lines of history to keep +set-option -g status-right "" + +# Set the panes initial index value to 1 instead of 0 +# 0 is too far from ` ;) +set -g base-index 1 +set-window-option -g pane-base-index 1 + +# Automatically set window title +set-window-option -g automatic-rename on +set-option -g set-titles on + +# Set "correct term" +# https://wiki.archlinux.org/index.php/Tmux +set -g default-terminal screen-256color + +# No delay for escape key press +# https://mutelight.org/practical-tmux#faster-command-sequences +set -sg escape-time 0 + +# Display pane numbers for longer +# https://unix.stackexchange.com/questions/307696/how-to-increase-tmux-pane-numbers-display-time-ctrl-b-q +set -g display-panes-time 2500 + +bind-key t resize-pane -x 80 + +bind -n M-r attach-session -t . -c '#{pane_current_path}' \; display-message "CWD for session updated to #{pane_current_path}!" + +bind-key u capture-pane \; save-buffer /tmp/tmux-urlscan-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan < /tmp/tmux-urlscan-buffer"' diff --git a/etc/weechat/irc.conf b/etc/weechat/irc.conf new file mode 120000 index 0000000..7dff360 --- /dev/null +++ b/etc/weechat/irc.conf @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/weechat/irc.conf \ No newline at end of file -- cgit v1.2.3 From 3b7b8e15be9cb72754c48033a8e90a3a97f0cab6 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 12:09:52 -0300 Subject: etc/backlight-device: Add file --- etc/backlight-device | 1 + 1 file changed, 1 insertion(+) create mode 100644 etc/backlight-device diff --git a/etc/backlight-device b/etc/backlight-device new file mode 100644 index 0000000..a493aeb --- /dev/null +++ b/etc/backlight-device @@ -0,0 +1 @@ +acpi_video0 \ No newline at end of file -- cgit v1.2.3 From e4d7311d4eea2bf67d48bdd256a2f05b6d56b030 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 12:34:45 -0300 Subject: etc/xmonad/: Migrate existing files from dotfiles --- etc/xmonad/xmobarrc | 26 ++++++++++++++ etc/xmonad/xmonad.hs | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 etc/xmonad/xmobarrc create mode 100644 etc/xmonad/xmonad.hs diff --git a/etc/xmonad/xmobarrc b/etc/xmonad/xmobarrc new file mode 100644 index 0000000..1526b60 --- /dev/null +++ b/etc/xmonad/xmobarrc @@ -0,0 +1,26 @@ +Config { + font = "xft:DejaVu Sans Mono:size=9" + , commands = [ + Run Cpu ["-L","3","-H","50", "--normal","#5ea2a4","--high","red"] 10 + , Run Memory ["-t","Mem: %"] 30 + , Run Swap [] 30 + , Run Date "%A, %e %B %Y, %H:%M:%S" "date" 10 + , Run DiskU [("/", "/")] [] 600 + , Run Wireless "wlp0s20f3" [] 100 + , Run Volume "default" "Master" [] 10 + , Run Battery [ + "-t", ": % - ", + "--", + "-O", "AC", + "-i", "Full", + "-o", "Bat", + "-p", "orange", + "-h", "green", + "-l", "red"] + 10 + , Run CommandReader "~/dev/libre/dotfiles/xmonad/scripts/xmobar-mpris.sh" "mpris" + , Run CommandReader "~/dev/libre/dotfiles/xmonad/scripts/xmobar-notifications.sh" "notifications" + , Run CommandReader "~/dev/libre/dotfiles/xmonad/scripts/xmobar-mail.sh" "notmuch" + ] + , template = " %date% | %default:Master%| %mpris% } { %notifications% | %notmuch% | %wlp0s20f3wi% | %battery% | %memory% * %swap% | %cpu% | %disku% " +} diff --git a/etc/xmonad/xmonad.hs b/etc/xmonad/xmonad.hs new file mode 100644 index 0000000..d459ced --- /dev/null +++ b/etc/xmonad/xmonad.hs @@ -0,0 +1,100 @@ +import XMonad +import XMonad.Actions.SpawnOn(spawnHere) +import XMonad.Hooks.ManageDocks +import XMonad.Util.EZConfig(additionalKeysP) +import XMonad.Layout.NoBorders +import XMonad.Hooks.SetWMName +import XMonad.Hooks.ManageHelpers +import XMonad.Util.Run(spawnPipe) +import XMonad.Layout.ResizableTile +import XMonad.Layout.ResizableTile(MirrorResize(MirrorShrink, MirrorExpand)) + +main :: IO () +main = do + xmproc <- spawnPipe "xmobar $XDG_CONFIG_HOME/xmonad/xmobarrc" + xmonad $ def + -- Fullscreen handling: + -- https://stackoverflow.com/questions/20446348/xmonad-toggle-fullscreen-xmobar + { manageHook = manageDocks <+> (isFullscreen --> doFullFloat) <+> (className =? "trayer" --> doIgnore) <+> manageHook def + , handleEventHook = handleEventHook def <+> docksEventHook + , layoutHook = myLayoutHook + , modMask = mod4Mask -- User Super instead of Alt + , terminal = myTerminal + , startupHook = myStartup + } `additionalKeysP` myKeyPBindings + +myTerminal :: String +myTerminal = "st" + +dbg :: String +dbg = "xmessage 'xmonad EuAndreh debug'" + +myKeyPBindings :: [(String, X ())] +myKeyPBindings = + [ -- Volume + ("", spawn "amixer -q sset Master toggle") + , ("", spawn "amixer -q sset Master 5%- unmute") + , ("", spawn "amixer -q sset Master 5%+ unmute") + + -- Playback + , ("", spawn "playerctl --player=$(cat ~/.cache/euandreh/mpris-player.txt) position 5-") + , ("S-", spawn "playerctl --player=$(cat ~/.cache/euandreh/mpris-player.txt) previous") + , ("", spawn "~/dev/libre/dotfiles/xmonad/scripts/playerctl-play-pause.sh") + , ("S-", spawn "~/dev/libre/dotfiles/xmonad/scripts/rotate-mpris-player.sh") + , ("", spawn "playerctl --player=$(cat ~/.cache/euandreh/mpris-player.txt) position 5+") + , ("S-", spawn "playerctl --player=$(cat ~/.cache/euandreh/mpris-player.txt) next") + + -- Brightness + , ("", spawn "~/dev/libre/dotfiles/xmonad/scripts/brightness.sh -10") + , ("S-", spawn "~/dev/libre/dotfiles/xmonad/scripts/zero-brightness.sh") + , ("", spawn "~/dev/libre/dotfiles/xmonad/scripts/brightness.sh +10") + + , ("M-p", spawnHere "exe=$(dmenu_path | dmenu) && exec $exe") + , ("M-o", spawnHere "~/dev/libre/dotfiles/xmonad/scripts/dmenu-emoji.sh") + , ("M-v", spawnHere "~/dev/libre/dotfiles/xmonad/scripts/dmenu-clipmenu.sh") + , ("M-i", spawn "~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass.sh") + , ("C-M-i", spawnHere "~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass-login.sh") + + -- Lock screen + , ("C-M-l", spawn "dm-tool switch-to-greeter") + + -- print whole screen + , ("M-", spawn "escrotum ~/Downloads/Screenshots/%Y-%m-%d-%T-screenshot.png") + -- print screen of clicked window + , ("C-M-", spawn "escrotum ~/Downloads/Screenshots/%Y-%m-%d-%T-screenshot.png -s") + + -- xrandr single monitor setup + , ("C-M-1", spawn "~/dev/libre/dotfiles/xmonad/scripts/single-monitor.sh") + + -- xrandr three monitor setup + , ("C-M-3", spawn "~/dev/libre/dotfiles/xmonad/scripts/three-monitors.sh") + + -- Toggle appearence of xmobar + -- https://stackoverflow.com/a/27646652 + , ("M-f", sendMessage ToggleStruts) + + , ("M-ç", spawn dbg) + + -- Vertically resize, taken from: + -- https://stackoverflow.com/questions/25857674/xmonad-vertical-resize-tile-window + , ("M-a", sendMessage MirrorExpand) + , ("M-z", sendMessage MirrorShrink) + + + -- Toggle PulseAudio sink + , ("M-s", spawn "~/dev/libre/dotfiles/xmonad/scripts/toggle-pulseaudio-sink.sh") + ] + +myLayoutHook = + smartBorders $ avoidStruts $ (tiled ||| Mirror tiled ||| Full) + where + tiled = ResizableTall nmaster delta ratio [] + nmaster = 1 + delta = 3/100 + ratio = 1/2 + +myStartup :: X () +myStartup = do + -- Taken from: + -- https://stackoverflow.com/questions/30742662/java-swing-gui-not-displaying-in-xmonad + setWMName "LG3D" -- cgit v1.2.3 From 5d2b4afc1df30654c08955210f7a5846dfd4cb77 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 13:29:38 -0300 Subject: .usr/etc/guile/init.scm: Add Guile initialization file Enable readline support and colourization. --- etc/guile/init.scm | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 etc/guile/init.scm diff --git a/etc/guile/init.scm b/etc/guile/init.scm new file mode 100644 index 0000000..9e962e8 --- /dev/null +++ b/etc/guile/init.scm @@ -0,0 +1,6 @@ +(use-modules + (ice-9 colorized) + (ice-9 readline)) + +(activate-colorized) +(activate-readline) -- cgit v1.2.3 From 4ff22399b8de363d6c2dd9f8affe8f17654e437a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 13:50:12 -0300 Subject: etc/myrepos/config: Add link to private repo --- etc/myrepos/config | 1 + 1 file changed, 1 insertion(+) create mode 120000 etc/myrepos/config diff --git a/etc/myrepos/config b/etc/myrepos/config new file mode 120000 index 0000000..e0e6a26 --- /dev/null +++ b/etc/myrepos/config @@ -0,0 +1 @@ +/home/andreh/dev/private/dotfiles/myrepos/config \ No newline at end of file -- cgit v1.2.3 From 3c2329d53d0985ea5d5d1cf59b51370ec35ddec2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 17:14:17 -0300 Subject: Move symlink to private files to a relative location To avoid hardcoding both "/home/andreh" and "dev/private/dotfiles". --- etc/alot/config | 2 +- etc/bash/privrc.sh | 2 +- etc/khal/config | 2 +- etc/khard/khard.conf | 2 +- etc/mbsync/config | 2 +- etc/msmtp/config | 2 +- etc/myrepos/config | 2 +- etc/newsboat/urls | 2 +- etc/notmuch/default/config | 2 +- etc/notmuch/default/hooks/post-new | 2 +- etc/weechat/irc.conf | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/etc/alot/config b/etc/alot/config index a92319d..745714d 120000 --- a/etc/alot/config +++ b/etc/alot/config @@ -1 +1 @@ -/home/andreh/dev/private/dotfiles/alot/config \ No newline at end of file +../../var/lib/private/tilde/alot/config \ No newline at end of file diff --git a/etc/bash/privrc.sh b/etc/bash/privrc.sh index 243a4bd..f946f34 120000 --- a/etc/bash/privrc.sh +++ b/etc/bash/privrc.sh @@ -1 +1 @@ -/home/andreh/dev/private/dotfiles/privrc.sh \ No newline at end of file +../../var/lib/private/tilde/privrc.sh \ No newline at end of file diff --git a/etc/khal/config b/etc/khal/config index dfae173..f0e4012 120000 --- a/etc/khal/config +++ b/etc/khal/config @@ -1 +1 @@ -/home/andreh/dev/private/dotfiles/khal/config \ No newline at end of file +../../var/lib/private/tilde/khal/config \ No newline at end of file diff --git a/etc/khard/khard.conf b/etc/khard/khard.conf index f015b29..56c4c53 120000 --- a/etc/khard/khard.conf +++ b/etc/khard/khard.conf @@ -1 +1 @@ -/home/andreh/dev/private/dotfiles/khard/khard.conf \ No newline at end of file +../../var/lib/private/tilde/khard/khard.conf \ No newline at end of file diff --git a/etc/mbsync/config b/etc/mbsync/config index 68a3234..a447e0e 120000 --- a/etc/mbsync/config +++ b/etc/mbsync/config @@ -1 +1 @@ -/home/andreh/dev/private/dotfiles/mbsync/config \ No newline at end of file +../../var/lib/private/tilde/mbsync/config \ No newline at end of file diff --git a/etc/msmtp/config b/etc/msmtp/config index 45cd0ac..e05c85a 120000 --- a/etc/msmtp/config +++ b/etc/msmtp/config @@ -1 +1 @@ -/home/andreh/dev/private/dotfiles/msmtp/config \ No newline at end of file +../../var/lib/private/tilde/msmtp/config \ No newline at end of file diff --git a/etc/myrepos/config b/etc/myrepos/config index e0e6a26..0f9e030 120000 --- a/etc/myrepos/config +++ b/etc/myrepos/config @@ -1 +1 @@ -/home/andreh/dev/private/dotfiles/myrepos/config \ No newline at end of file +../../var/lib/private/tilde/myrepos/config \ No newline at end of file diff --git a/etc/newsboat/urls b/etc/newsboat/urls index 3c453f5..c7c1b2d 120000 --- a/etc/newsboat/urls +++ b/etc/newsboat/urls @@ -1 +1 @@ -/home/andreh/dev/private/dotfiles/newsboat/urls \ No newline at end of file +../../var/lib/private/tilde/newsboat/urls \ No newline at end of file diff --git a/etc/notmuch/default/config b/etc/notmuch/default/config index 3b9d2f4..a315fdc 120000 --- a/etc/notmuch/default/config +++ b/etc/notmuch/default/config @@ -1 +1 @@ -/home/andreh/dev/private/dotfiles/notmuch/default/config \ No newline at end of file +../../../var/lib/private/tilde/notmuch/default/config \ No newline at end of file diff --git a/etc/notmuch/default/hooks/post-new b/etc/notmuch/default/hooks/post-new index 7992789..5d96e3e 120000 --- a/etc/notmuch/default/hooks/post-new +++ b/etc/notmuch/default/hooks/post-new @@ -1 +1 @@ -/home/andreh/dev/private/dotfiles/notmuch/post-new \ No newline at end of file +../../../../var/lib/private/tilde/notmuch/default/hooks/post-new \ No newline at end of file diff --git a/etc/weechat/irc.conf b/etc/weechat/irc.conf index 7dff360..d42fdad 120000 --- a/etc/weechat/irc.conf +++ b/etc/weechat/irc.conf @@ -1 +1 @@ -/home/andreh/dev/private/dotfiles/weechat/irc.conf \ No newline at end of file +../../var/lib/private/tilde/weechat/irc.conf \ No newline at end of file -- cgit v1.2.3 From b248902af25312c9d7d8d1fb3d82e8da4643c994 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 18:34:58 -0300 Subject: bin/msg: Move audio files to $XDG_DATA_HOME/msg/ --- bin/msg | 4 ++-- share/msg/low.ogg | Bin 0 -> 12217 bytes share/msg/medium.ogg | Bin 0 -> 99826 bytes 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 share/msg/low.ogg create mode 100644 share/msg/medium.ogg diff --git a/bin/msg b/bin/msg index f3e893e..3bcc98e 100755 --- a/bin/msg +++ b/bin/msg @@ -14,7 +14,7 @@ help() { Options: -X XMPP_MESSAGE send XMPP using the `xmpp` command - -s play ~/Desktop/medium.ogg sound + -s play $XDG_DATA_HOME/msg/medium.ogg sound -S SOUND_MESSAGE say SOUND_MESSAGE using `speak` -m EMAIL_SUBJECT send email with EMAIL_SUBJECT and empty body -D DESKTOP_MESSAGE the desktop message for `notify-send` @@ -39,7 +39,7 @@ for flag in "$@"; do done sound() { - play ~/Desktop/medium.ogg 2>/dev/null & + play $XDG_DATA_HOME/msg/medium.ogg 2>/dev/null & } ACTION_DONE=false diff --git a/share/msg/low.ogg b/share/msg/low.ogg new file mode 100644 index 0000000..0e91525 Binary files /dev/null and b/share/msg/low.ogg differ diff --git a/share/msg/medium.ogg b/share/msg/medium.ogg new file mode 100644 index 0000000..22cb563 Binary files /dev/null and b/share/msg/medium.ogg differ -- cgit v1.2.3 From dfc34b2dcfdbc9b2187eb3ea39774916eedc2b08 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:21:45 -0300 Subject: bin/mkdtemp: Fix name in usage text --- bin/mkdtemp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mkdtemp b/bin/mkdtemp index 9c7ddd8..d012175 100755 --- a/bin/mkdtemp +++ b/bin/mkdtemp @@ -4,8 +4,8 @@ set -eu usage() { cat <<-'EOF' Usage: - mkstemp - mkstemp -h + mkdtemp + mkdtemp -h EOF } -- cgit v1.2.3 From 5d967b9fe891798ca0b782da6c8eeb93cd777084 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:22:10 -0300 Subject: bin/{open,print}: Fix indentation of heredoc strings --- bin/open | 24 ++++++++++++------------ bin/print | 38 +++++++++++++++++++------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/bin/open b/bin/open index df1ad56..d2eedd3 100755 --- a/bin/open +++ b/bin/open @@ -3,26 +3,26 @@ set -eu usage() { cat <<-'EOF' - Usage: - open FILE... - open -h -EOF + Usage: + open FILE... + open -h + EOF } help() { cat <<-'EOF' - Options: - -h, --help show this message + Options: + -h, --help show this message - Examples: + Examples: - Open an HTML file on the current $BROWSER: - open index.html + Open an HTML file on the current $BROWSER: + $ open index.html - Open multiple PDF files (with zathura): - open *.pdf -EOF + Open multiple PDF files (with zathura): + $ open *.pdf + EOF } for flag in "$@"; do diff --git a/bin/print b/bin/print index 735d8ba..e0d3d6e 100755 --- a/bin/print +++ b/bin/print @@ -3,35 +3,35 @@ set -eu usage() { cat <<-'EOF' - Usage: - print [-d] [-q QUALITY] [FILE...] - print -h -EOF + Usage: + print [-d] [-q QUALITY] [FILE...] + print -h + EOF } help() { cat <<-'EOF' - Options: - -d print duplex/double-sided - -q QUALITY choose the print quality, either: - low, medium (default) or high. - -h, --help show this message + Options: + -d print duplex/double-sided + -q QUALITY choose the print quality, either: + low, medium (default) or high. + -h, --help show this message - Examples: + Examples: - Print the given PostScript file with default quality: - $ print f1.ps + Print the given PostScript file with default quality: + $ print f1.ps - Print multiple PDF files with high quality: - $ print -dq high *.pdf + Print multiple PDF files with high quality: + $ print -dq high *.pdf - Print the file from STDIN, double-sided: - $ print -d < f2.ps + Print the file from STDIN, double-sided: + $ print -d < f2.ps - Print multiple source code files: - $ print src/*.{c,h} -EOF + Print multiple source code files: + $ print src/*.{c,h} + EOF } mkdtemp() { -- cgit v1.2.3 From 756341b4a7c735e6c5a5f3f947c5243adea67151 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:46:04 -0300 Subject: etc/bash/rc: Setup working version alongside ~/.profile --- etc/bash/rc | 346 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 346 insertions(+) create mode 100644 etc/bash/rc diff --git a/etc/bash/rc b/etc/bash/rc new file mode 100644 index 0000000..96c9312 --- /dev/null +++ b/etc/bash/rc @@ -0,0 +1,346 @@ +#!/bin/sh + +if [ -r /etc/bashrc ]; then + . /etc/bashrc +fi + +case $- in + *i*) + stty -ixon # Disable C-s/C-q mode + ;; + *) + # return + ;; +esac + +XDG_PREFIX=~/.usr +export XDG_CACHE_HOME="$XDG_PREFIX/var/cache" +export XDG_CONFIG_HOME="$XDG_PREFIX/etc" +export XDG_DATA_HOME="$XDG_PREFIX/share" +export XDG_STATE_HOME="$XDG_PREFIX/state" +export XDG_LOG_HOME="$XDG_PREFIX/var/log" +export XDG_DATA_DIRS="$XDG_DATA_HOME/flatpak/exports/share:/var/lib/flatpak/exports/share${XDG_DATA_DIRS:+:}${XDG_DATA_DIRS:-}" + + +mkdir -p \ + "$XDG_CONFIG_HOME" \ + "$XDG_CACHE_HOME" \ + "$XDG_DATA_HOME" \ + "$XDG_STATE_HOME" \ + "$XDG_LOG_HOME" + +HISTSIZE= +HISTFILE="$XDG_STATE_HOME/bash-history" + +export SRC=~/dev +export EDITOR='vi' +export VISUAL="$EDITOR" +export PAGER='less -R' +export BROWSER='firefox' +export MAILDIR=~/Maildir + +export GUILE_HISTORY="$XDG_STATE_HOME/guile-history" +export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" +export INPUTRC="$XDG_CONFIG_HOME/bash/inputrc" +export RLWRAP_HOME="$XDG_CACHE_HOME/rlwrap" +export LESSHISTFILE="$XDG_STATE_HOME/lesshst" +export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/default/config" +export PASSWORD_STORE_DIR="$SRC/others/password-store" +export MAILCAPS="$XDG_CONFIG_HOME/mailcaps/config" +export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc.py" +export EXINIT=' + " set number + set autoindent + set ruler + set showmode + set showmatch +' + +HOSTNAME="$(hostname)" +export BORG_PASSCOMMAND="pass show $HOSTNAME/borg/passphrase" +export BORG_REPO="suyin:borg/$HOSTNAME" +export BORG_REMOTE_PATH='borg1' + +N_PROCS=$(($(nproc) * 2 + 1)) +export MAKEFLAGS="-j $N_PROCS" +export GOPATH="$SRC/go" +export CFLAGS='-std=c99 -Wall -Wextra -Wpedantic -g -flto -Werror' +export CC=musl-gcc +export AR=gcc-ar +export LEX=flex +export LDFLAGS='-flto' +export LISP='sbcl --eval' + +add_prefix() { + export C_INCLUDE_PATH="$1/include${C_INCLUDE_PATH:+:}${C_INCLUDE_PATH:-}" + export LIBRARY_PATH="$1/lib${LIBRARY_PATH:+:}${LIBRARY_PATH:-}" + export INFOPATH="$1/share/info${INFOPATH:+:}${INFOPATH:-}" + export MANPATH="$1/share/man${MANPATH:+:}${MANPATH:-}" + export PATH="$1/bin${PATH:+:}${PATH:-}" +} +export PREFIX="$XDG_PREFIX/var/mkg" +add_prefix "$PREFIX" + +export PATH="$XDG_PREFIX/bin:$PREFIX/bin:$HOME/dev/libre/website/bin:$PATH" + +# FIXME +export GUILE_LOAD_PATH="$HOME/dev/libre/servers/src/infrastructure/lib:$GUILE_LOAD_PATH" + + +# +# Aliases +# + +unalias -a + +alias r='reload' +alias rr='rreload' + +alias p='ping euandre.org -c 3' +alias c='tmux send-keys -R \; clear-history' +alias o='open' +alias mm='msmtp-queue -r' +alias s='vcs_status' +alias d='vcs_diff' +alias ds='vcs_diff_staged' + +alias mk='make clean && make dev-check' +alias wmk='aux/with-container "make clean && make dev-check"' +alias tt='mk && wmk' +alias todos='make public && open public/TODOs.html' +alias valgrind='valgrind --show-error-list=yes --show-leak-kinds=all --leak-check=full --track-origins=yes --error-exitcode=1' +alias check='sh "$XDG_CONFIG_HOME"/bash/check.sh' + +alias l='ls -lahF --color' +alias grep='grep --color=auto' +alias diff='diff --color=auto' +alias watch='watch --color ' +alias man='MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man' +alias less='less -R' +alias tree='tree -C' +alias make='make -e' +alias mv='mv -i' +alias rm='rm -i' + +alias sqlite='rlwrap sqlite3' +alias sbcl='rlwrap sbcl' +alias perl='rlwrap perl' +alias guile='guile -l "$XDG_CONFIG_HOME"/guile/init.scm' + +alias flush='sync && echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null' + + + +# +# PS1 +# + +. "$XDG_CONFIG_HOME"/bash/vcs-ps1.sh + + + +# FIXME: fix "history" commands +# g '^\w.*json_destroy(' +g() { + # shellcheck disable=2086 + fn=$(git grep -n -- "$1" ${2:-} | \ + cut -d: -f -2 | \ + fzf --select-1 \ + --exit-0 \ + --preview "echo {} | \ + cut -d: -f1 | \ + xargs -I% awk -v bounds=25 -v pat=\"$1\" -v n=\$(echo {} | cut -d: -f2) ' + (n - bounds < NR) && (NR < n + bounds) && (NR != n) { print } + NR==n { gsub(pat, \"\033[1;33m&\033[1;000m\"); print } + ' %") + if [ -n "$fn" ]; then + f="$(echo "$fn" | cut -d: -f1)" + n="$(echo "$fn" | cut -d: -f2)" + # shellcheck disable=2068 + history -s g "$@" + history -s vi "+$n" "$f" + vi "+$n" "$f" + fi +} + +f() { + # FIXME: speed + # profile="f-shell-function$(pwd | sed -e 's_/_-_g')" + # file="$(git ls-files | grep ${2:-.} | remembering -p "$profile" -c "fzf --select-1 --exit-0 --preview 'cat {}'")" + # shellcheck disable=2086 + file="$(git ls-files | grep ${2:-.} | fzf --select-1 --exit-0 --preview 'cat {}')" + if [ -n "$file" ]; then + # shellcheck disable=2068 + # history -s f $@ + history -s "$1" "$file" + "$1" "$file" + fi +} + +# FIXME: use $XDG_CONFIG_HOME +V_FILES="$(echo ' +~/Documents/txt/TODOs.md +~/Documents/txt/scratch.txt +'"$(find ~/Documents/txt/*.md -not -name TODOs.md | + sed "s|^$HOME|~|" | + LANG=POSIX.UTF-8 sort)"' +~/dev/libre/package-repository/dependencies.dot +~/dev/others/dinheiros/dinheiros.ledger +~/dev/libre/dotfiles/sh/fake-symlinks.sh +~/.config/bash/rc +~/.config/guix/home.scm +~/.config/guix/system.scm +~/.config/guix/channels.scm +' | tr ' ' '\n' | grep .)" + +v() { + f="$(echo "$V_FILES" | fzf --select-1 --exit-0 --query "$1")" + if [ -n "$f" ]; then + history -s vi "$f" + vi "$HOME/${f#'~/'}" + fi +} + +cn() { + CHOICE="$(git log --oneline | fzf)" + git log --oneline | grep -nF "$CHOICE" | cut -d: -f1 +} + +cm() { + n="$(cn)" + git rev-parse "HEAD~$((n - 1))" +} + + + +genpassword() { + length="${1-99}" + tr -cd '[:alnum:]' < /dev/urandom | fold -w "$length" | head -n1 +} + +deps() { + cd ~/dev/libre/package-repository/ || return 1 + rm -f public/dependencies.svg + make public/dependencies.svg > /dev/null + if [ "${1:-}" != '-q' ]; then + open public/dependencies.svg + fi + cd - > /dev/null || return 1 +} +(deps -q &) 2>/dev/null + +rdeps() { + echo ~/dev/libre/package-repository/dependencies.dot | + entr -cs '. ~/.profile' +} + +re() { + if [ "$1" = -h ]; then + echo "Usage: re 's/foo/bar/g' [FILES]" + return + fi + SEPARATOR="$(echo "$1" | cut -c2)" + REGEX="$(echo "$1" | cut -d"$SEPARATOR" -f2)" + if [ -n "${2:-}" ]; then + git grep -l "$REGEX" | xargs -I% sh -c "sed '$1' % | sponge %" + else + sed "$1" "$2" | sponge "$2" + fi +} + +container_dump() { + TARGET_NAME="$(basename "$PWD")" + OUT="$(mktemp -d)" + cp "$(./aux/guix/with-container.sh -C)" "$OUT/docker.tar.gz" + cd "$OUT" || exit 1 + tar xvf docker.tar.gz + # FIXME: Remove doas + doas docker tag \ + "$(doas docker load < docker.tar.gz | grep latest | cut -d: -f2)" \ + "$TARGET_NAME" +} + +svg() { + guix graph "$1" | dot -Tsvg > "$1".svg + open "$1".svg +} + +serve() { + open http://localhost:8000 + if [ -d public ]; then + python3 -m http.server -d public + else + python3 -m http.server + fi +} + +reload() { + . ~/.profile +} + +rreload() { + reload + xset r rate 225 100 # FIXME: move xorg conf + scp \ + ~/dev/libre/package-repository/public/dependencies.svg \ + kuvira:/opt/www/euandreh.xyz/static/package-repository/ +} + +tpd() { + D="$(mkdtemp)" + cd "$D" || return 1 +} + +m() { + notmuch new + mbsync EuAndreh & + mbsync EuAndrehXYZ & + mbsync Nubank & + wait + notmuch new +} + +_edit_without_executing() { + F="$(mkstemp)" + printf '%s\n' "$READLINE_LINE" > "$F" + "${VISUAL:-${EDITOR:-vi}}" "$F" + READLINE_LINE="$(cat "$F")" + READLINE_POINT="${#READLINE_LINE}" + rm -f "$F" +} + +if set -o | grep 'on' | grep -Eq '^(vi|emacs)'; then + bind -x '"\C-x\C-e":_edit_without_executing' +fi + +eval "$(direnv hook bash)" + + + +# +# GPG and SSH agents configuration +# + +SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) +GPG_TTY=$(tty) +export GPG_TTY SSH_AUTH_SOCK +gpgconf --launch gpg-agent +gpg --export-ssh-key eu@euandre.org > "$XDG_CONFIG_HOME"/ssh/id_rsa.pub +chmod 600 "$XDG_CONFIG_HOME"/ssh/id_rsa.pub + + + +# +# Extra rc code to be loaded, stored in private repository +# + +if [ -r "$XDG_CONFIG_HOME"/bash/privrc.sh ]; then + . "$XDG_CONFIG_HOME"/bash/privrc.sh +fi + + + +# FIXME: completion +for f in "$HOME_ENVIRONMENT"/profile/etc/bash_completion.d/*; do + . "$f" +done -- cgit v1.2.3 From ede271268a7e3e2978cf3f47e38510728fba409b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:47:25 -0300 Subject: etc/guix/home.scm: Use spaces for indentation of heredocs --- etc/guix/home.scm | 59 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 607a059..28b3101 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -29,35 +29,38 @@ (define (xdg-config-home s) (string-append (getenv "XDG_CONFIG_HOME") "/" s)) -(define gitconfig (mixed-text-file "gitconfig" #"- - [user] - email = eu@euandre.org - name = EuAndreh - signingkey = 81F90EC3CD356060 - [transfer] - fsckobjects = true - [push] - default = current - [commit] - gpgsign = true - verbose = true - [init] - defaultBranch = main - [sendemail] - assume8bitEncoding = UTF-8 - smtpserveroption = -a - smtpserveroption = euandreh - annotate = yes - confirm = never - smtpserver = "# msmtp-non-hardcoded "/bin/msmtpq\n")) +(define gitconfig + (mixed-text-file "gitconfig" #"- + [user] + email = eu@euandre.org + name = EuAndreh + signingkey = 81F90EC3CD356060 + [transfer] + fsckobjects = true + [push] + default = current + [commit] + gpgsign = true + verbose = true + [init] + defaultBranch = main + [sendemail] + assume8bitEncoding = UTF-8 + smtpserveroption = -a + smtpserveroption = euandreh + annotate = yes + confirm = never + smtpserver = "# msmtp-non-hardcoded "/bin/msmtpq\n")) + +(define gpg-agent.conf + (mixed-text-file "gpg-agent.conf" #"- + default-cache-ttl 172800 + default-cache-ttl-ssh 172800 + max-cache-ttl 604800 + max-cache-ttl-ssh 604800 + enable-ssh-support + pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) -(define gpg-agent.conf (mixed-text-file "gpg-agent.conf" #"- - default-cache-ttl 172800 - default-cache-ttl-ssh 172800 - max-cache-ttl 604800 - max-cache-ttl-ssh 604800 - enable-ssh-support - pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) (define config-files `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) -- cgit v1.2.3 From 2c80db6dfae51e955c61ac8469ab9e5d6a28e02d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:49:02 -0300 Subject: etc/guix/home.scm: Setup home-shell-profile-service-type --- etc/guix/home.scm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 28b3101..2122cb2 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -148,8 +148,8 @@ firefox)) (list msmtp-non-hardcoded))) (services - (list (service home-bash-service-type - (home-bash-configuration - (bashrc - (list (plain-file "bashrc.sh" ". $XDG_CONFIG_HOME/bash/rc"))))) - (simple-service 'config-files home-files-service-type (dot-config))))) + (list + (simple-service 'my-shell-profile home-shell-profile-service-type + (list (plain-file "my-profile" ". ~/.usr/etc/bash/rc"))) + (simple-service 'config-files home-files-service-type dot-config) + (simple-service 'home-cron home-mcron-service-type jobs)))) -- cgit v1.2.3 From 95164a1c432cb77f638dba89576839ca11cfd31b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:49:49 -0300 Subject: etc/guix/home.scm: Use modified *-with-options packages --- etc/guix/home.scm | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 2122cb2..4235add 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -16,16 +16,66 @@ (name "msmtp-non-hardcoded") (arguments (substitute-keyword-arguments (package-arguments msmtp) - ((#:phases phases) + ((#:phases phases '%standard-phases) `(modify-phases ,phases (add-after 'install-additional-files 'patch-hardcoded-paths (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out"))) (substitute* (string-append out "/bin/msmtpq") - (("^LOG=.*$") "LOG=${XDG_LOG_HOME:-$HOME/.local/var/log}/msmtpq.log\n") - (("^Q=.*$") "Q=${XDG_DATA_HOME:-$HOME/.local/share}/msmtp/queue\n") + (("^LOG=.*$") "LOG=$XDG_LOG_HOME/msmtpq.log\n") + (("^Q=.*$") "Q=$XDG_DATA_HOME/msmtp/queue\n") (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) +(define (with-options pkg bin opts) + (package + (inherit pkg) + (arguments + (substitute-keyword-arguments (package-arguments pkg) + ((#:phases phases '%standard-phases) + `(modify-phases ,phases + (add-after 'install 'wrap-with-flags + (lambda* (#:key outputs #:allow-other-keys) + (define (wrap-options prog options) + (let ((wrapped-file (string-append (dirname prog) "/." (basename prog) "-orig"))) + (rename-file prog wrapped-file) + (call-with-output-file prog + (lambda (port) + (format port + "#!/bin/sh~%~%exec \"~a\" ~a \"$@\"~%" + (canonicalize-path wrapped-file) + options))) + (chmod prog #o755))) + (wrap-options (string-append (assoc-ref outputs "out") + "/bin/" + ,bin) + ,opts))))))))) + +(define isync-with-options + (with-options isync "mbsync" "--config=\"$XDG_CONFIG_HOME\"/mbsync/config")) + +(define wget-with-options + (with-options wget "wget" "--hsts-file=\"$XDG_STATE_HOME\"/wget-hsts")) + +(define sbcl-with-options + (with-options sbcl "sbcl" "--userinit \"$XDG_CONFIG_HOME\"/sbcl/sbclrc.lisp")) + +(define tmux-with-options + (with-options tmux "tmux" "-f \"$XDG_CONFIG_HOME\"/tmux/tmux.conf")) + +(define myrepos-with-options + (with-options myrepos "mr" "-c \"$XDG_CONFIG_HOME\"/myrepos/config")) + +(define texinfo-with-options + (with-options texinfo "info" "--init-file \"$XDG_CONFIG_HOME\"/info/infokey")) + +(define mpv-with-options + (with-options mpv "mpv" (string-append "--script=" + (getenv "HOME") ;; (getenv "GUIX_PROFILE") ;; FIXME + "/.guix-home/profile/lib/mpris.so"))) + +(define openssh-with-options + (with-options openssh "ssh" "-F \"$XDG_CONFIG_HOME\"/ssh/config")) + (define (xdg-config-home s) (string-append (getenv "XDG_CONFIG_HOME") "/" s)) @@ -146,7 +196,15 @@ zathura-pdf-poppler zathura-ps firefox)) - (list msmtp-non-hardcoded))) + (list msmtp-non-hardcoded + isync-with-options + wget-with-options + sbcl-with-options + tmux-with-options + myrepos-with-options + texinfo-with-options + mpv-with-options + openssh-with-options))) (services (list (simple-service 'my-shell-profile home-shell-profile-service-type -- cgit v1.2.3 From 86d3d77f8d191f8a8820f787fc3973f19ebc880b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:50:33 -0300 Subject: etc/guix/home.scm: Add ssh.conf --- etc/guix/home.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 4235add..5235d30 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -111,6 +111,17 @@ enable-ssh-support pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) +(define ssh.conf + (plain-file "ssh.conf" + (string-replace-substring #"- + Host * + UserKnownHostsFile @XDG_CONFIG_HOME@/ssh/known_hosts + + Include ~/dev/libre/servers/src/infrastructure/ssh.conf + Include ~/dev/others/lawtech/src/infrastructure/ssh.conf + "# + "@XDG_CONFIG_HOME@" + (getenv "XDG_CONFIG_HOME")))) (define config-files `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) -- cgit v1.2.3 From 7f2f8f72fd7484b5d04c3756efbbe74719422203 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:51:03 -0300 Subject: etc/guix/home.scm: Add a bunch of packages --- etc/guix/home.scm | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 112 insertions(+), 9 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 5235d30..d3763b2 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -142,26 +142,49 @@ (packages (append (map (compose list specification->package+output symbol->string) - '(man-pages + '(nss-certs + bash + coreutils + findutils + diffutils + grep + sed + tar + gawk + bc + nvi + + man-pages posix-man-pages - tree - openssh - mailutils - entr + bash-completion ;; FIXME: should this exist? IIUC, this is a misleading name + git git:send-email - tmux - rsync + git:gui + git-open + git-remote-gcrypt + mercurial + fossil + subversion + cvs + gnupg + rsync + tree + diffoscope + mailutils + entr pulseaudio password-store playerctl pinentry-gtk2 bmake + make fzf ranger blueman + pavucontrol ledger curl xclip @@ -183,29 +206,109 @@ moreutils shellcheck gettext + lilypond groff + jq + recutils + units + ncurses + trash-cli + lsof + autojump + unzip + powertop + md4c + timidity++ + + flatpak + dunst + + sqlite clojure openjdk - sbcl perl perl-mojolicious + python + python-slixmpp + valgrind + gcc-toolchain + clang + node + quickjs + m4 + go + xrandr + arandr st i3status + xmobar + ghc + ghc-xmonad-contrib + xmonad + xmessage dmenu + clipmenu weechat alot notmuch - isync w3m afew + qtox + telescope + imagemagick + ffmpeg + pandoc + ;; mktorrent-latest + jekyll + flac + mediainfo + libnotify + espeak-ng + procps + zenity + util-linux + guile + gzip + xz + bzip2 + lzip + which + libxml2 + inetutils + psmisc + less + nano + patch + + poezio + freetalk + mcabber + profanity + newsboat + mpv-mpris + + poweralertd + keepassxc + + xbacklight zathura zathura-djvu zathura-pdf-poppler zathura-ps + dino + poedit + transmission + transmission:gui + audacity + inkscape + frescobaldi + libreoffice + rhythmbox + ungoogled-chromium firefox)) (list msmtp-non-hardcoded isync-with-options -- cgit v1.2.3 From 176be2b32fa0de43a7fac138fffe68abe0962dc4 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:51:28 -0300 Subject: etc/guix/home.scm: use-modules --- etc/guix/home.scm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index d3763b2..71d6b68 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -1,12 +1,23 @@ (use-modules (curth0) + (gnu home) (gnu home services) + (gnu home services mcron) (gnu home services shells) (gnu packages) - (gnu packages mail) (gnu packages gnupg) + (gnu packages mail) + (gnu packages music) + (gnu packages wget) + (gnu packages lisp) + (gnu packages ssh) + (gnu packages texinfo) + (gnu packages tmux) + (gnu packages version-control) + (gnu packages video) (gnu services) (guix gexp) + (guix modules) (guix packages) (guix utils)) -- cgit v1.2.3 From 920473d9d4ee2d18649124476a1e1e33f39b513e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:51:58 -0300 Subject: etc/guix/home.scm: Include "dot-config" and "jobs" variables --- etc/guix/home.scm | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 71d6b68..3255f51 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -136,18 +136,34 @@ (define config-files `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) - ("git/config" ,gitconfig))) - -(define (dot-config) - (define (prefix-with-config s) - (string-append (substring (getenv "XDG_CONFIG_HOME") - (+ 1 (string-length (getenv "HOME")))) - "/" - s)) - (map (lambda (t) - (list (prefix-with-config (first t)) - (second t))) - config-files)) + ("git/config" ,gitconfig) + ("ssh/config" ,ssh.conf))) + +(define dot-config + (let ((prefix-with-config + (lambda (s) + (string-append (substring (getenv "XDG_CONFIG_HOME") + (+ 1 (string-length (getenv "HOME")))) + "/" + s)))) + (map (lambda (t) + (list (prefix-with-config (first t)) + (second t))) + config-files))) + + +(define jobs + '() + #; + (list + ;; FIXME + #~(job "* * * * *" "echo foi > ~/foi") + #~(job "* * * * *" "backup -h 2>&1 > ~/bk") + #~(job "* * * * *" "which backup -h 2>&1 > ~/which-bk") + #~(job "* * * * *" "echo $PATH 2>&1 > ~/path") + #~(job "* * * * *" "echo 123") + #~(job "* * * * *" "echo 123 > k") + #~(job "* * * * *" "date > ~/job"))) (home-environment (packages -- cgit v1.2.3 From cb715edd11f8ec2da16bcaadefa98b496548540e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:53:10 -0300 Subject: etc/guix/system.scm: Include virtualization and printing services --- etc/guix/system.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 3bd7235..14b864f 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -50,6 +50,11 @@ (service bluetooth-service-type) (service pcscd-service-type) (service gnome-desktop-service-type) + (service libvirt-service-type) + (service virtlog-service-type) + (service cups-service-type + (cups-configuration + (web-interface? #t))) (set-xorg-configuration (xorg-configuration (keyboard-layout keyboard-layout) -- cgit v1.2.3 From 46154996979b4d8e0a588c2cb218880c3933278d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:54:20 -0300 Subject: etc/guix/system.scm: Add xmonad-current custom package --- etc/guix/system.scm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 14b864f..1401ab0 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -14,6 +14,20 @@ (nongnu packages linux) (nongnu system linux-initrd)) +(define xmonad-current + (package + (inherit xmonad) + (arguments + (substitute-keyword-arguments (package-arguments xmonad) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'install-xsession 'set-desktop-name + (lambda* (#:key outputs #:allow-other-keys) + (substitute* (string-append (assoc-ref outputs "out") + "/share/xsessions/xmonad.desktop") + (("Name=xmonad-next") "Name=xmonad")))))))))) + + (operating-system (kernel linux) (initrd microcode-initrd) @@ -43,7 +57,10 @@ (map (compose list specification->package+output symbol->string) '(nss-certs i3-wm)) - %base-packages)) + (list xmonad-current) + (remove (lambda (package) + (equal? "wget" (package-name package))) + %base-packages))) (services (append (list -- cgit v1.2.3 From 41447ba934d1ba6715fbad3cdcb935ecf1f313c7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:55:04 -0300 Subject: etc/guix/system.scm: Include WIP udev-rules service extension --- etc/guix/system.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 1401ab0..f0d15bb 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -27,6 +27,11 @@ "/share/xsessions/xmonad.desktop") (("Name=xmonad-next") "Name=xmonad")))))))))) +(define backlight-device + (call-with-input-file + (string-append (getenv "XDG_CONFIG_HOME") + "/backlight-device") + read-line)) (operating-system (kernel linux) @@ -72,6 +77,17 @@ (service cups-service-type (cups-configuration (web-interface? #t))) + #; + (udev-rules-service + 'backlight + (udev-rule + "backlight.rule" + (string-replace + #"- + ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="@DEVICE@", GROUP="video", MODE="0664" + "# + "@DEVICE@" + backlight-device))) (set-xorg-configuration (xorg-configuration (keyboard-layout keyboard-layout) -- cgit v1.2.3 From 06761d3b46965e44d4fdc25771f839df6fd02269 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:55:45 -0300 Subject: etc/guix/system.scm: Add custom X config for controlling screen backlight --- etc/guix/system.scm | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index f0d15bb..666c15e 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -91,14 +91,21 @@ (set-xorg-configuration (xorg-configuration (keyboard-layout keyboard-layout) - (extra-config (list #"- - Section "InputClass" - Identifier "touchpad" - Driver "libinput" - MatchIsTouchpad "on" - Option "Tapping" "on" - EndSection - "#))))) + (extra-config + (list + #"- + Section "InputClass" + Identifier "touchpad" + Driver "libinput" + MatchIsTouchpad "on" + Option "Tapping" "on" + EndSection + Section "Device" + Identifier "Intel Graphics" + Driver "intel" + Option "Backlight" "intel_backlight" + EndSection + "#))))) (modify-services %desktop-services (guix-service-type config => (guix-configuration -- cgit v1.2.3 From 56bd224465fb617d4a38530c6a9feea62d8c2c95 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:56:01 -0300 Subject: etc/guix/system.scm: use-modules --- etc/guix/system.scm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 666c15e..8502af7 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -1,18 +1,25 @@ (use-modules - (curth0) + (curth0) ;; FIXME: properly install this + (ice-9 rdelim) (gnu bootloader) (gnu bootloader grub) (gnu packages) + (gnu packages wm) (gnu services base) + (gnu services cups) (gnu services desktop) (gnu services security-token) + (gnu services virtualization) (gnu services xorg) (gnu system keyboard) (gnu system file-systems) (gnu system mapped-devices) (guix gexp) + (guix packages) + (guix utils) (nongnu packages linux) - (nongnu system linux-initrd)) + (nongnu system linux-initrd) + (srfi srfi-1)) (define xmonad-current (package -- cgit v1.2.3 From 030081f03d5ecce1aaa9f26aa6e7c0e38b06fa9f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:56:19 -0300 Subject: etc/guix/system.scm: Add nonguix substitutes --- etc/guix/system.scm | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 8502af7..2baeabe 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -118,16 +118,21 @@ (guix-configuration (inherit config) (substitute-urls - (append '("https://substitutes.nonguix.org") - %default-substitute-urls)) + (append + '("https://substitutes.nonguix.org") + %default-substitute-urls)) (authorized-keys - (append (list (plain-file "non-guix.pub" #"- - (public-key - (ecc - (curve Ed25519) - (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#))) - "#)) - %default-authorized-guix-keys))))))) + (append + (list + (plain-file + "non-guix.pub" + #"- + (public-key + (ecc + (curve Ed25519) + (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#))) + "#)) + %default-authorized-guix-keys))))))) (bootloader (bootloader-configuration (bootloader grub-efi-bootloader) -- cgit v1.2.3 From c1217a264bda51d667695e5517eae9bd772f08c5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:56:58 -0300 Subject: etc/i3/config: Add FIXME marker --- etc/i3/config | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/i3/config b/etc/i3/config index 0b41311..1de9ac8 100644 --- a/etc/i3/config +++ b/etc/i3/config @@ -31,6 +31,7 @@ bindsym F1 exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $re bindsym F2 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status bindsym F3 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status +# FIXME paths in ~/.cache bindsym F4 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` position 5- bindsym Shift+F4 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` previous bindsym F5 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` play-pause -- cgit v1.2.3 From 4cddcc6dfebadb135b356697f0032149f9f5990c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 20:57:33 -0300 Subject: etc/i3status/config: Setup working i3status bar configuration --- etc/i3status/config | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 etc/i3status/config diff --git a/etc/i3status/config b/etc/i3status/config new file mode 100644 index 0000000..7bc854e --- /dev/null +++ b/etc/i3status/config @@ -0,0 +1,26 @@ +order += "wireless _first_" +order += "battery all" +order += "disk /" +order += "memory" +order += "tztime local" + +wireless _first_ { + format_up = "%essid ~%quality" +} + +battery all { + format = "bat: %status %percentage %remaining" +} + +disk "/" { + format = "disk: %avail" +} + +memory { + format = "mem: %used/%total" + threshold_degraded = "1G" +} + +tztime local { + format = "%A, %Y-%m-%d %H:%M:%S" +} -- cgit v1.2.3 From 78f534b62b8b94b23aa9e73e4c2986d90136c8c6 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 21:08:35 -0300 Subject: bin/password: Add executable, a replacement for the genpassword function --- bin/password | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ etc/bash/rc | 5 ----- 2 files changed, 57 insertions(+), 5 deletions(-) create mode 100755 bin/password diff --git a/bin/password b/bin/password new file mode 100755 index 0000000..718ba1c --- /dev/null +++ b/bin/password @@ -0,0 +1,57 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + password [LENGTH] + password -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + LENGTH the size of the password (default: 99) + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +LENGTH="${1-99}" +tr -cd '[:alnum:]' < /dev/random | + fold -w "$LENGTH" | + head -n1 | + tr -d '\n' diff --git a/etc/bash/rc b/etc/bash/rc index 96c9312..8588089 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -213,11 +213,6 @@ cm() { -genpassword() { - length="${1-99}" - tr -cd '[:alnum:]' < /dev/urandom | fold -w "$length" | head -n1 -} - deps() { cd ~/dev/libre/package-repository/ || return 1 rm -f public/dependencies.svg -- cgit v1.2.3 From 99986580b6946444d2291bbc1389f0f953929fc1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 21:14:28 -0300 Subject: etc/guix/home.scm: Replace tabs with spaces --- etc/guix/home.scm | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 3255f51..9428f8f 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -179,7 +179,7 @@ tar gawk bc - nvi + nvi man-pages posix-man-pages @@ -294,21 +294,21 @@ mediainfo libnotify espeak-ng - procps - zenity - util-linux - guile - gzip - xz - bzip2 - lzip - which - libxml2 - inetutils - psmisc - less - nano - patch + procps + zenity + util-linux + guile + gzip + xz + bzip2 + lzip + which + libxml2 + inetutils + psmisc + less + nano + patch poezio freetalk -- cgit v1.2.3 From 13f94e65a4691fef4fc95fca04af3443d5df99ed Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 21:15:53 -0300 Subject: etc/bash/check.sh: Do not assert loading ~/.profile goes without error There are files not under my control, such as completion files, that invariably fail the assertion. --- etc/bash/check.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/etc/bash/check.sh b/etc/bash/check.sh index 7c12dec..1114bd1 100755 --- a/etc/bash/check.sh +++ b/etc/bash/check.sh @@ -53,5 +53,3 @@ shellcheck -xe 1090,1091 \ "$XDG_CONFIG_HOME"/bash/vcs-ps1.sh \ "$XDG_CONFIG_HOME"/bash/check.sh \ "$XDG_CONFIG_HOME"/bash/privrc.sh - -sh -eu ~/.profile -- cgit v1.2.3 From 38e6f082461b392818db3340fadda9b1d639a1a5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 12 May 2022 21:16:45 -0300 Subject: etc/bash/check.sh: Add assert for FIXME markers --- etc/bash/check.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etc/bash/check.sh b/etc/bash/check.sh index 1114bd1..7b9b921 100755 --- a/etc/bash/check.sh +++ b/etc/bash/check.sh @@ -53,3 +53,8 @@ shellcheck -xe 1090,1091 \ "$XDG_CONFIG_HOME"/bash/vcs-ps1.sh \ "$XDG_CONFIG_HOME"/bash/check.sh \ "$XDG_CONFIG_HOME"/bash/privrc.sh + +if git grep FIXME; then + printf 'Leftover FIXME markers\n' >&2 + exit 1 +fi -- cgit v1.2.3 From 936a17d2926f871c25cfd7bcfcc444064fdaf15e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 May 2022 14:36:32 -0300 Subject: etc/bash/vcs-ps1.sh: Include `shell_level` in $PS1 variable --- etc/bash/vcs-ps1.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/etc/bash/vcs-ps1.sh b/etc/bash/vcs-ps1.sh index f2103da..4b440be 100644 --- a/etc/bash/vcs-ps1.sh +++ b/etc/bash/vcs-ps1.sh @@ -110,6 +110,19 @@ error_marker() { fi } +shell_level() { + if [ -n "${SHLVL:-}" ]; then + if [ -n "${TMUX:-}" ]; then + LVL=$((SHLVL - 1)) + else + LVL="$SHLVL" + fi + if [ "$LVL" != 1 ]; then + color -c white "[$LVL] " + fi + fi +} + timestamp() { color -c blacki '\T' } @@ -141,7 +154,7 @@ in_nix_shell() { fi } -PS1='`error_marker`'$(timestamp)' '$(path)' `repo_status``guix_env``in_nix_shell` +PS1='`error_marker`'$(timestamp)' '$(path)' `shell_level``repo_status``guix_env``in_nix_shell` $ ' -- cgit v1.2.3 From 801077a6add14d83dd1725b2cd2039d00dcb0726 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 May 2022 14:37:09 -0300 Subject: etc/guix/home.scm: Rename "jobs" to "cronjobs" --- etc/guix/home.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 9428f8f..8660c32 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -152,7 +152,7 @@ config-files))) -(define jobs +(define cronjobs '() #; (list @@ -351,4 +351,4 @@ (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" ". ~/.usr/etc/bash/rc"))) (simple-service 'config-files home-files-service-type dot-config) - (simple-service 'home-cron home-mcron-service-type jobs)))) + (simple-service 'home-cron home-mcron-service-type cronjobs)))) -- cgit v1.2.3 From 370b5c675444b48d990169f1e2b584db011cda12 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 May 2022 15:05:38 -0300 Subject: etc/bash/rc: Replace hardcoded ~/.config paths with $XDG_CONFIG_HOME in `v()` function --- etc/bash/rc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/etc/bash/rc b/etc/bash/rc index 8588089..cb86b94 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -177,7 +177,6 @@ f() { fi } -# FIXME: use $XDG_CONFIG_HOME V_FILES="$(echo ' ~/Documents/txt/TODOs.md ~/Documents/txt/scratch.txt @@ -187,17 +186,18 @@ V_FILES="$(echo ' ~/dev/libre/package-repository/dependencies.dot ~/dev/others/dinheiros/dinheiros.ledger ~/dev/libre/dotfiles/sh/fake-symlinks.sh -~/.config/bash/rc -~/.config/guix/home.scm -~/.config/guix/system.scm -~/.config/guix/channels.scm +$XDG_CONFIG_HOME/bash/rc +$XDG_CONFIG_HOME/guix/home.scm +$XDG_CONFIG_HOME/guix/system.scm +$XDG_CONFIG_HOME/guix/channels.scm ' | tr ' ' '\n' | grep .)" v() { f="$(echo "$V_FILES" | fzf --select-1 --exit-0 --query "$1")" if [ -n "$f" ]; then history -s vi "$f" - vi "$HOME/${f#'~/'}" + sh -c "vi $f" + # vi "$HOME/${f#'~/'}" fi } -- cgit v1.2.3 From bdce3faed65a043de28aba0271eb9a329ab64747 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 May 2022 15:06:45 -0300 Subject: etc/bash/rc: Include `f ...` and `v ...` in shell history --- etc/bash/rc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/bash/rc b/etc/bash/rc index cb86b94..08ed9f0 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -171,7 +171,7 @@ f() { file="$(git ls-files | grep ${2:-.} | fzf --select-1 --exit-0 --preview 'cat {}')" if [ -n "$file" ]; then # shellcheck disable=2068 - # history -s f $@ + history -s f "$@" history -s "$1" "$file" "$1" "$file" fi @@ -195,6 +195,7 @@ $XDG_CONFIG_HOME/guix/channels.scm v() { f="$(echo "$V_FILES" | fzf --select-1 --exit-0 --query "$1")" if [ -n "$f" ]; then + history -s v "$@" history -s vi "$f" sh -c "vi $f" # vi "$HOME/${f#'~/'}" -- cgit v1.2.3 From e3c2736b4e0e286d4038a6044d66a58d02ec111d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 May 2022 15:08:14 -0300 Subject: etc/bash/rc: Link ~/.bashrc to ~/.profile and add set $ENV to ~/.profile Make .profile the only configuration file for shells. It concentrates not only environment variables as login files should, but also aliases, functions, etc. Setting $ENV to ~/.profile makes interactive calls to `sh` load this files, and symlinking ~/.bashrc makes interactive calls to `bash` do the same. Ultimately, I find that the separation of environment variables to login files, usually in ~/.bash_profile, to make sense when thinking about user sessions and logins, but not something I benefit from. Staying logged in for multiple days, I modify environment variables that I want to affect my existing and new terminal sessions, and having to do extra work for getting those new values (such as an extra command that sources ~/.profile) isn't interesting to me. --- etc/bash/rc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/bash/rc b/etc/bash/rc index 08ed9f0..c406d34 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -3,6 +3,8 @@ if [ -r /etc/bashrc ]; then . /etc/bashrc fi +ln -fs .profile ~/.bashrc +export ENV=~/.profile case $- in *i*) -- cgit v1.2.3 From 08d65f4f9bccfdc5d31153f54d273185368f83e9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 May 2022 18:39:21 -0300 Subject: bin/email: Fix name from "mail" to "email" in usage string --- bin/email | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/email b/bin/email index 0a1fd15..dcfdfa4 100755 --- a/bin/email +++ b/bin/email @@ -4,8 +4,8 @@ set -eu usage() { cat <<-'EOF' Usage: - mail -s SUBJECT ADDRESS... < BODY - mail -h + email -s SUBJECT ADDRESS... < BODY + email -h EOF } -- cgit v1.2.3 From 54a04048470e1b30ebf914ad00682e45c8d25ee3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 May 2022 18:41:08 -0300 Subject: etc/mailcaps/config: Stop w3m from creating ~/.w3m/ --- etc/mailcaps/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/mailcaps/config b/etc/mailcaps/config index aeea68d..60f7286 100644 --- a/etc/mailcaps/config +++ b/etc/mailcaps/config @@ -1 +1 @@ -text/html; w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput +text/html; env HOME=$XDG_DATA_HOME/w3m w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput -- cgit v1.2.3 From e06b5316f4bd665b8a44473005357135cc9d573f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 May 2022 18:41:31 -0300 Subject: etc/i3/config: Update WIP paths --- etc/i3/config | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/etc/i3/config b/etc/i3/config index 1de9ac8..fbde61e 100644 --- a/etc/i3/config +++ b/etc/i3/config @@ -32,16 +32,16 @@ bindsym F2 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $re bindsym F3 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status # FIXME paths in ~/.cache -bindsym F4 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` position 5- -bindsym Shift+F4 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` previous -bindsym F5 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` play-pause +bindsym F4 exec --no-startup-id playerctl --player=`cat ~/.usr/var/cache/euandreh-mpris-player.txt` position 5- +bindsym Shift+F4 exec --no-startup-id playerctl --player=`cat ~/.usr/var/cache/euandreh-mpris-player.txt` previous +bindsym F5 exec --no-startup-id playerctl --player=`cat ~/.usr/var/cache/euandreh-mpris-player.txt` play-pause Bindsym Shift+F5 exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/rotate-mpris-player.sh -bindsym F6 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` position 5+ -bindsym Shift+F6 exec --no-startup-id playerctl --player=`cat ~/.cache/euandreh-mpris-player.txt` next +bindsym F6 exec --no-startup-id playerctl --player=`cat ~/.usr/var/cache/euandreh-mpris-player.txt` position 5+ +bindsym Shift+F6 exec --no-startup-id playerctl --player=`cat ~/.usr/var/cache/euandreh-mpris-player.txt` next # FIXME bad path -bindsym F7 exec --no-startup-id ~/.local/bin/brightness -1 -bindsym F8 exec --no-startup-id ~/.local/bin/brightness +1 +bindsym F7 exec --no-startup-id ~/.usr/bin/brightness -1 +bindsym F8 exec --no-startup-id ~/.usr/bin/brightness +1 -- cgit v1.2.3 From ebc397a661ae6c3536f20ffa2106dc6fabe22569 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 May 2022 18:59:44 -0300 Subject: etc/guix/system.scm: Do not include users in the "wheel" group by default --- etc/guix/system.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 2baeabe..1965708 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -51,13 +51,14 @@ (host-name "velhinho") (users (append - (let ((user-groups '("wheel" "netdev" "audio" "video"))) + (let ((user-groups '("netdev" "audio" "video")) + (admin-groups '("wheel"))) (list (user-account (name "andreh") (comment "EuAndreh") (group "users") - (supplementary-groups user-groups)) + (supplementary-groups (append admin-groups user-groups))) (user-account (name "other") (comment "Other Self") -- cgit v1.2.3 From c0b014a598a15a31e503f62ba498c5a39da661a6 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 May 2022 19:00:24 -0300 Subject: etc/guix/system.scm: Replace xmonad-current with xmonad-next --- etc/guix/system.scm | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 1965708..cb57af5 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -21,19 +21,6 @@ (nongnu system linux-initrd) (srfi srfi-1)) -(define xmonad-current - (package - (inherit xmonad) - (arguments - (substitute-keyword-arguments (package-arguments xmonad) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'install-xsession 'set-desktop-name - (lambda* (#:key outputs #:allow-other-keys) - (substitute* (string-append (assoc-ref outputs "out") - "/share/xsessions/xmonad.desktop") - (("Name=xmonad-next") "Name=xmonad")))))))))) - (define backlight-device (call-with-input-file (string-append (getenv "XDG_CONFIG_HOME") @@ -69,8 +56,9 @@ (append (map (compose list specification->package+output symbol->string) '(nss-certs - i3-wm)) - (list xmonad-current) + i3-wm + xmonad-next)) + (list) (remove (lambda (package) (equal? "wget" (package-name package))) %base-packages))) -- cgit v1.2.3 From 74922c865056904bb940de5c0cba6ae55e144d63 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 May 2022 19:13:25 -0300 Subject: etc/guix/home.scm: Remove inetutils package The `ping` command requires privileges to do ICMP shennanigans. --- etc/guix/home.scm | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 8660c32..54bcf56 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -304,7 +304,6 @@ lzip which libxml2 - inetutils psmisc less nano -- cgit v1.2.3 From e737dcb2b25b653994e052f3412ffcc787709ecb Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 14 May 2022 01:40:53 -0300 Subject: bin/msg: Include an empty space in the body of the email to get a valid email --- bin/msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/msg b/bin/msg index 3bcc98e..405d406 100755 --- a/bin/msg +++ b/bin/msg @@ -58,7 +58,7 @@ while getopts 'X:sS:m:D:bh' flag; do ACTION_DONE=true ;; m) - echo "" | email -s "$OPTARG" eu@euandre.org + echo " " | email -s "$OPTARG" eu@euandre.org ACTION_DONE=true ;; D) -- cgit v1.2.3 From 2b01e50b3e38ec6c8fffb8977d19cdbb40e70d3b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 14 May 2022 01:41:20 -0300 Subject: bin/brightness: Use consistent quoting only around variables --- bin/brightness | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/brightness b/bin/brightness index 8e178ad..7da0bde 100755 --- a/bin/brightness +++ b/bin/brightness @@ -10,4 +10,4 @@ OLD_BRIGHTNESS="$(cat "$HANDLER"/brightness)" MAX_BRIGHTNESS="$(cat "$HANDLER"/max_brightness)" SUM=$((OLD_BRIGHTNESS + BRIGHTNESS_DIFF)) NEW_BRIGHTNESS="$(clamp -- "$SUM" 0 "$MAX_BRIGHTNESS")" -echo "$NEW_BRIGHTNESS" > "$HANDLER"/brightness || sudo chmod 666 "$HANDLER/brightness" +echo "$NEW_BRIGHTNESS" > "$HANDLER"/brightness || sudo chmod 666 "$HANDLER"/brightness -- cgit v1.2.3 From e7d5cf3d112fe67a67ac974e7691caa4dd2dcd82 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 14 May 2022 01:43:25 -0300 Subject: bin/brightness: Put device information in $BACKLIGHT_DEVICE variable instead of file --- bin/brightness | 3 +-- etc/backlight-device | 1 - etc/bash/rc | 1 + etc/guix/system.scm | 8 +------- 4 files changed, 3 insertions(+), 10 deletions(-) delete mode 100644 etc/backlight-device diff --git a/bin/brightness b/bin/brightness index 7da0bde..10bd198 100755 --- a/bin/brightness +++ b/bin/brightness @@ -3,8 +3,7 @@ set -eu BRIGHTNESS_DIFF="$1" -DEVICE="$(cat "$XDG_CONFIG_HOME"/backlight-device)" -HANDLER="/sys/class/backlight/$DEVICE" +HANDLER=/sys/class/backlight/"$BACKLIGHT_DEVICE" OLD_BRIGHTNESS="$(cat "$HANDLER"/brightness)" MAX_BRIGHTNESS="$(cat "$HANDLER"/max_brightness)" diff --git a/etc/backlight-device b/etc/backlight-device deleted file mode 100644 index a493aeb..0000000 --- a/etc/backlight-device +++ /dev/null @@ -1 +0,0 @@ -acpi_video0 \ No newline at end of file diff --git a/etc/bash/rc b/etc/bash/rc index c406d34..50347d2 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -40,6 +40,7 @@ export VISUAL="$EDITOR" export PAGER='less -R' export BROWSER='firefox' export MAILDIR=~/Maildir +export BACKLIGHT_DEVICE='acpi_video0' export GUILE_HISTORY="$XDG_STATE_HOME/guile-history" export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" diff --git a/etc/guix/system.scm b/etc/guix/system.scm index cb57af5..73a5ae8 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -21,12 +21,6 @@ (nongnu system linux-initrd) (srfi srfi-1)) -(define backlight-device - (call-with-input-file - (string-append (getenv "XDG_CONFIG_HOME") - "/backlight-device") - read-line)) - (operating-system (kernel linux) (initrd microcode-initrd) @@ -83,7 +77,7 @@ ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="@DEVICE@", GROUP="video", MODE="0664" "# "@DEVICE@" - backlight-device))) + (getenv "BACKLIGHT_DEVICE")))) (set-xorg-configuration (xorg-configuration (keyboard-layout keyboard-layout) -- cgit v1.2.3 From f4dcd358549b1b11d29fbc373807d0adb698f0d7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 14 May 2022 04:56:51 -0300 Subject: bin/msg: Run notifications in parallel --- bin/msg | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/msg b/bin/msg index 405d406..32f4fd9 100755 --- a/bin/msg +++ b/bin/msg @@ -39,34 +39,34 @@ for flag in "$@"; do done sound() { - play $XDG_DATA_HOME/msg/medium.ogg 2>/dev/null & + play $XDG_DATA_HOME/msg/medium.ogg 2>/dev/null } ACTION_DONE=false while getopts 'X:sS:m:D:bh' flag; do case "$flag" in X) - xmpp -m "$OPTARG" eu@euandreh.xyz + xmpp -m "$OPTARG" eu@euandreh.xyz & ACTION_DONE=true ;; s) - sound + sound & ACTION_DONE=true ;; S) - echo "$OPTARG" | speak -v pt-BR + echo "$OPTARG" | speak -v pt-BR & ACTION_DONE=true ;; m) - echo " " | email -s "$OPTARG" eu@euandre.org + echo " " | email -s "$OPTARG" eu@euandre.org & ACTION_DONE=true ;; D) - notify-send "$OPTARG" + notify-send "$OPTARG" & ACTION_DONE=true ;; b) - printf '\a' + printf '\a' & ACTION_DONE=true ;; h) -- cgit v1.2.3 From 9ed975fe3a9d146766f560cf66a872f8e9de5ba7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 14 May 2022 05:04:48 -0300 Subject: etc/bash/rc: Show pretty tilde path in $V_FILES, in a better order --- etc/bash/rc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/etc/bash/rc b/etc/bash/rc index 50347d2..e4c1356 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -180,20 +180,20 @@ f() { fi } -V_FILES="$(echo ' +V_FILES="$(echo " ~/Documents/txt/TODOs.md ~/Documents/txt/scratch.txt -'"$(find ~/Documents/txt/*.md -not -name TODOs.md | +$XDG_CONFIG_HOME/bash/rc +$XDG_CONFIG_HOME/guix/home.scm +$XDG_CONFIG_HOME/guix/system.scm +$(find ~/Documents/txt/*.md -not -name TODOs.md | sed "s|^$HOME|~|" | - LANG=POSIX.UTF-8 sort)"' + LANG=POSIX.UTF-8 sort) ~/dev/libre/package-repository/dependencies.dot ~/dev/others/dinheiros/dinheiros.ledger ~/dev/libre/dotfiles/sh/fake-symlinks.sh -$XDG_CONFIG_HOME/bash/rc -$XDG_CONFIG_HOME/guix/home.scm -$XDG_CONFIG_HOME/guix/system.scm $XDG_CONFIG_HOME/guix/channels.scm -' | tr ' ' '\n' | grep .)" +" | tr ' ' '\n' | grep . | sed 's|^/home/andreh|~|')" v() { f="$(echo "$V_FILES" | fzf --select-1 --exit-0 --query "$1")" -- cgit v1.2.3 From a16f7adf13383792c4cede00a3071d20129ea2e2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 14 May 2022 22:59:47 -0300 Subject: etc/bash/rc: Set $HISTCONTROL variable. --- etc/bash/rc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/bash/rc b/etc/bash/rc index e4c1356..4d8dbe8 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -34,6 +34,8 @@ mkdir -p \ HISTSIZE= HISTFILE="$XDG_STATE_HOME/bash-history" +HISTCONTROL=ignorespace:ignoredups + export SRC=~/dev export EDITOR='vi' export VISUAL="$EDITOR" -- cgit v1.2.3 From 715e15eb95e9c41dce6017fb624c6580171240cf Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 18:14:38 -0300 Subject: etc/bash/rc: Move stty modification to the end of the file; remove dead "case" --- etc/bash/rc | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/etc/bash/rc b/etc/bash/rc index 4d8dbe8..c5356cc 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -6,15 +6,6 @@ fi ln -fs .profile ~/.bashrc export ENV=~/.profile -case $- in - *i*) - stty -ixon # Disable C-s/C-q mode - ;; - *) - # return - ;; -esac - XDG_PREFIX=~/.usr export XDG_CACHE_HOME="$XDG_PREFIX/var/cache" export XDG_CONFIG_HOME="$XDG_PREFIX/etc" @@ -330,6 +321,7 @@ gpg --export-ssh-key eu@euandre.org > "$XDG_CONFIG_HOME"/ssh/id_rsa.pub chmod 600 "$XDG_CONFIG_HOME"/ssh/id_rsa.pub +stty -ixon # Disable C-s/C-q mode # # Extra rc code to be loaded, stored in private repository -- cgit v1.2.3 From 8dbde8ccddd91dd4a6fd7097ea9dab84b31e1c5c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 18:17:08 -0300 Subject: etc/bash/rc(cosmetic): Move comment on extra files into if statement --- etc/bash/rc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/etc/bash/rc b/etc/bash/rc index c5356cc..aaeec1e 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -323,11 +323,9 @@ chmod 600 "$XDG_CONFIG_HOME"/ssh/id_rsa.pub stty -ixon # Disable C-s/C-q mode -# -# Extra rc code to be loaded, stored in private repository -# if [ -r "$XDG_CONFIG_HOME"/bash/privrc.sh ]; then + # Extra rc code to be loaded, stored in private repository . "$XDG_CONFIG_HOME"/bash/privrc.sh fi -- cgit v1.2.3 From bf6b4e686dd387ee9ef0bcc2a8fb893a1007edaf Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 18:21:06 -0300 Subject: etc/bash/rc: Move $V_FILES into v() function, use heredocs instead of strings Having the $V_FILES variable inside the v() function allows it to be a little bit more dynamic: files manually added to the list while editing the file aren't included as new values without `reload`ing the rc file, but new files created in the ~/Documents/txt/ directory are. --- etc/bash/rc | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/etc/bash/rc b/etc/bash/rc index aaeec1e..0dbca5a 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -173,22 +173,23 @@ f() { fi } -V_FILES="$(echo " -~/Documents/txt/TODOs.md -~/Documents/txt/scratch.txt -$XDG_CONFIG_HOME/bash/rc -$XDG_CONFIG_HOME/guix/home.scm -$XDG_CONFIG_HOME/guix/system.scm -$(find ~/Documents/txt/*.md -not -name TODOs.md | - sed "s|^$HOME|~|" | - LANG=POSIX.UTF-8 sort) -~/dev/libre/package-repository/dependencies.dot -~/dev/others/dinheiros/dinheiros.ledger -~/dev/libre/dotfiles/sh/fake-symlinks.sh -$XDG_CONFIG_HOME/guix/channels.scm -" | tr ' ' '\n' | grep . | sed 's|^/home/andreh|~|')" - v() { + V_FILES="$( + cat <<-EOF | sed "s|$HOME|~|" + ~/Documents/txt/TODOs.md + ~/Documents/txt/scratch.txt + $XDG_CONFIG_HOME/bash/rc + $XDG_CONFIG_HOME/guix/home.scm + $XDG_CONFIG_HOME/guix/system.scm + $(find ~/Documents/txt/*.md -not -name TODOs.md | + sed "s|^$HOME|~|" | + LANG=POSIX.UTF-8 sort) + ~/dev/libre/package-repository/dependencies.dot + ~/dev/others/dinheiros/dinheiros.ledger + ~/dev/libre/dotfiles/sh/fake-symlinks.sh + $XDG_CONFIG_HOME/guix/channels.scm + EOF + )" f="$(echo "$V_FILES" | fzf --select-1 --exit-0 --query "$1")" if [ -n "$f" ]; then history -s v "$@" -- cgit v1.2.3 From 6babbf3083f535ff454a9cb7caf7b3bbc894a190 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 18:23:34 -0300 Subject: etc/bash/rc: Indent v() function body, remove commented code --- etc/bash/rc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/etc/bash/rc b/etc/bash/rc index 0dbca5a..7f1d75d 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -190,13 +190,12 @@ v() { $XDG_CONFIG_HOME/guix/channels.scm EOF )" - f="$(echo "$V_FILES" | fzf --select-1 --exit-0 --query "$1")" - if [ -n "$f" ]; then - history -s v "$@" - history -s vi "$f" - sh -c "vi $f" - # vi "$HOME/${f#'~/'}" - fi + f="$(echo "$V_FILES" | fzf --select-1 --exit-0 --query "$1")" + if [ -n "$f" ]; then + history -s v "$@" + history -s vi "$f" + sh -c "vi $f" + fi } cn() { -- cgit v1.2.3 From 0c58f29df976ed79700edfa0774dad6c8e0a2b1e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 18:47:00 -0300 Subject: etc/bash/check.sh: Assert clean tilde repositories --- etc/bash/check.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/etc/bash/check.sh b/etc/bash/check.sh index 7b9b921..2b8971f 100755 --- a/etc/bash/check.sh +++ b/etc/bash/check.sh @@ -52,9 +52,21 @@ shellcheck -xe 1090,1091 \ "$XDG_CONFIG_HOME"/bash/rc \ "$XDG_CONFIG_HOME"/bash/vcs-ps1.sh \ "$XDG_CONFIG_HOME"/bash/check.sh \ - "$XDG_CONFIG_HOME"/bash/privrc.sh + "$XDG_CONFIG_HOME"/bash/privrc.sh \ + "$XDG_CONFIG_HOME"/notmuch/default/hooks/post-new if git grep FIXME; then printf 'Leftover FIXME markers\n' >&2 exit 1 fi + +if ! git diff --quiet || ! git diff --quiet --staged; then + printf 'Dirty tilde repository.\n' >&2 + exit 1 +fi + +PRIV="$XDG_CONFIG_HOME/../var/lib/private/tilde" +if ! git -C "$PRIV" diff --quiet || ! git -C "$PRIV" diff --quiet --staged; then + printf 'Dirty private tilde repository.\n' >&2 + exit 1 +fi -- cgit v1.2.3 From 31d3352674f1a5dec97a340270d8a5aa891ac683 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 18:52:35 -0300 Subject: bin/grun: s/FIXME/TODO/ to simplify etc/bash/check.sh tests --- bin/grun | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/grun b/bin/grun index 5884e9e..4b6217d 100755 --- a/bin/grun +++ b/bin/grun @@ -29,9 +29,9 @@ help() { $ grun secrets.txt.gpg -- vipe - Delete lines containing "FIXME" in todos.gpg: + Delete lines containing "TODO" in todos.gpg: - $ grun -r ABC123DEF321 todos.gpg -- sed '/FIXME/d' + $ grun -r ABC123DEF321 todos.gpg -- sed '/TODO/d' If COMMAND emits a non-zero return code, the file is left unmodified. -- cgit v1.2.3 From a3e4714f2d87fa52cae05493abc6753bc622eabc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 18:57:04 -0300 Subject: etc/bash/check.sh: Move to the root of the Git directory before running tests --- etc/bash/check.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/bash/check.sh b/etc/bash/check.sh index 2b8971f..d66c277 100755 --- a/etc/bash/check.sh +++ b/etc/bash/check.sh @@ -47,6 +47,8 @@ while getopts 'h' flag; do done shift $((OPTIND - 1)) +cd -- "$(dirname -- "$0")" +cd -- "$(git rev-parse --show-toplevel)" shellcheck -xe 1090,1091 \ "$XDG_CONFIG_HOME"/bash/rc \ -- cgit v1.2.3 From 2413aa6c4f4d1556ac2e37394c78492a29129728 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 18:59:35 -0300 Subject: etc/bash/check.sh: Exclude the file from FIXME check --- etc/bash/check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/bash/check.sh b/etc/bash/check.sh index d66c277..5c410c8 100755 --- a/etc/bash/check.sh +++ b/etc/bash/check.sh @@ -57,7 +57,7 @@ shellcheck -xe 1090,1091 \ "$XDG_CONFIG_HOME"/bash/privrc.sh \ "$XDG_CONFIG_HOME"/notmuch/default/hooks/post-new -if git grep FIXME; then +if git grep FIXME -- ":(exclude)$XDG_CONFIG_HOME/bash/check.sh"; then printf 'Leftover FIXME markers\n' >&2 exit 1 fi -- cgit v1.2.3 From 48afc040f39007ed4a177ab6a4b3fbe48114f981 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 19:17:09 -0300 Subject: etc/bash/rc: Remove FIXME marker from bash-completion handling Moved to help-guix@gnu.org. See <165265271797.19845.1907620860408175547@localhost>. Also, only load completion files when running interactively, as there is no way to make that code behave, it's totally out of my control. --- etc/bash/rc | 15 +++++++++------ etc/guix/home.scm | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/etc/bash/rc b/etc/bash/rc index 7f1d75d..f81e350 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -329,9 +329,12 @@ if [ -r "$XDG_CONFIG_HOME"/bash/privrc.sh ]; then . "$XDG_CONFIG_HOME"/bash/privrc.sh fi - - -# FIXME: completion -for f in "$HOME_ENVIRONMENT"/profile/etc/bash_completion.d/*; do - . "$f" -done +case $- in + *i*) + for f in "$HOME_ENVIRONMENT"/profile/etc/bash_completion.d/*; do + . "$f" + done + ;; + *) + ;; +esac diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 54bcf56..4820850 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -184,7 +184,7 @@ man-pages posix-man-pages - bash-completion ;; FIXME: should this exist? IIUC, this is a misleading name + bash-completion git git:send-email -- cgit v1.2.3 From b158ca31c296f28f09a0a6bc4d329e64243e5860 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 19:22:09 -0300 Subject: etc/guix/home.scm: Move FIXME marker to TODOs.md --- etc/guix/home.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 4820850..f0f9f92 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -81,7 +81,7 @@ (define mpv-with-options (with-options mpv "mpv" (string-append "--script=" - (getenv "HOME") ;; (getenv "GUIX_PROFILE") ;; FIXME + (getenv "HOME") "/.guix-home/profile/lib/mpris.so"))) (define openssh-with-options -- cgit v1.2.3 From d36b73dbb51cba8380293d19322b249476c36127 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 19:23:02 -0300 Subject: etc/guix/system.scm: Remove duplicate FIXME marker from curth0 It is already present on the GUILE_LOAD_PATH hack in etc/bash/rc. --- etc/guix/system.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 73a5ae8..e4627cc 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -1,5 +1,5 @@ (use-modules - (curth0) ;; FIXME: properly install this + (curth0) (ice-9 rdelim) (gnu bootloader) (gnu bootloader grub) -- cgit v1.2.3 From 1074194307e83a6ae882872352159ec3b0f80e53 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 15 May 2022 19:50:22 -0300 Subject: Use TinyCC as the default value of $CC --- etc/bash/rc | 2 +- etc/guix/home.scm | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/bash/rc b/etc/bash/rc index f81e350..28c3813 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -61,7 +61,7 @@ N_PROCS=$(($(nproc) * 2 + 1)) export MAKEFLAGS="-j $N_PROCS" export GOPATH="$SRC/go" export CFLAGS='-std=c99 -Wall -Wextra -Wpedantic -g -flto -Werror' -export CC=musl-gcc +export CC=tcc export AR=gcc-ar export LEX=flex export LDFLAGS='-flto' diff --git a/etc/guix/home.scm b/etc/guix/home.scm index f0f9f92..5e56009 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -261,6 +261,7 @@ valgrind gcc-toolchain clang + tcc node quickjs m4 -- cgit v1.2.3 From d51aa1dd6ffe5ca8ef6f44d3fb82fa8ac33d047a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 16 May 2022 00:08:51 -0300 Subject: bin/backup: Fix indentation of help text --- bin/backup | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/backup b/bin/backup index cab37dc..16673eb 100755 --- a/bin/backup +++ b/bin/backup @@ -14,13 +14,13 @@ help() { Options: - -v enable verbose mode, useful for - interactive sessions - -C COMMENT the comment text to be attached to the archive - -h, --help show this message + -v enable verbose mode, useful for + interactive sessions + -C COMMENT the comment text to be attached to the archive + -h, --help show this message - ARCHIVE_TAG the tag used to create the new - backup (default: "cronjob") + ARCHIVE_TAG the tag used to create the new + backup (default: "cronjob") The repository is expected to have been created with: -- cgit v1.2.3 From 6afc86bcdaea2d96923c9c6664ccb303c3d737b2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 16 May 2022 00:09:05 -0300 Subject: bin/backup: Remove EXIT trap --- bin/backup | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bin/backup b/bin/backup index 16673eb..01cca40 100755 --- a/bin/backup +++ b/bin/backup @@ -99,12 +99,6 @@ ARCHIVE_TAG="${1:-}" assert_arg "$ARCHIVE_TAG" 'ARCHIVE_TAG' -finish() { - STATUS=$? - printf '\n>>>\n>>> exit status: %s\n>>>\n\n' "$STATUS" >&2 -} -trap finish EXIT - run() { borg create \ $VERBOSE_FLAGS \ -- cgit v1.2.3 From a6e719d167497f406dc494c117e6f032d451f828 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 16 May 2022 00:09:17 -0300 Subject: bin/backup: Fix WARNING message for exit code 0 --- bin/backup | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/backup b/bin/backup index 01cca40..018e080 100755 --- a/bin/backup +++ b/bin/backup @@ -111,8 +111,10 @@ run() { ~/ STATUS=$? - if [ "$STATUS" = 0 ] || [ "$STATUS" = 1 ]; then - echo 'WARNING, but no ERROR.' >&2 + if [ "$STATUS" = 0 ]; then + return 0 + elif [ "$STATUS" = 1 ]; then + printf 'WARNING, but no ERROR.\n' >&2 return 0 else return "$STATUS" -- cgit v1.2.3 From 004616122241810cf4fd63be8237fc0422b1b2f9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 16 May 2022 00:30:01 -0300 Subject: etc/bash/vcs-ps1.sh: Better checking of empty shell variables --- etc/bash/vcs-ps1.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/bash/vcs-ps1.sh b/etc/bash/vcs-ps1.sh index 4b440be..6e74e1d 100644 --- a/etc/bash/vcs-ps1.sh +++ b/etc/bash/vcs-ps1.sh @@ -132,7 +132,7 @@ path() { } guix_env() { - if [ "$GUIX_ENVIRONMENT" != '' ]; then + if [ -n "${GUIX_ENVIRONMENT:-}" ]; then printf '\n' color -c blacki '~> ' color -c purple 'guix environment ' @@ -143,7 +143,7 @@ guix_env() { } in_nix_shell() { - if [ "$IN_NIX_SHELL" != '' ]; then + if [ -n "${IN_NIX_SHELL:-}" ]; then printf '\n' color -c blacki '~> ' color -c purpleb "$IN_NIX_SHELL " -- cgit v1.2.3 From 34f799dd65990604bb3e6dc9b9bbcb9d806315ab Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 16 May 2022 00:33:00 -0300 Subject: bin/backup: Use $XDG_CACHE_HOME over hard-coded ~/.cache/ --- bin/backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/backup b/bin/backup index 018e080..8d40b42 100755 --- a/bin/backup +++ b/bin/backup @@ -103,7 +103,7 @@ run() { borg create \ $VERBOSE_FLAGS \ --comment "$COMMENT" \ - --exclude ~/.cache/ \ + --exclude "$XDG_CACHE_HOME" \ --exclude ~/Downloads/ \ --stats \ --compression lzma,9 \ -- cgit v1.2.3 From 216e3be99dc8ef308f10e9aa409bf028bf0f8fc1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 16 May 2022 00:42:41 -0300 Subject: bin/backup: Print "borg create" debug statement --- bin/backup | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/backup b/bin/backup index 8d40b42..e8d4b73 100755 --- a/bin/backup +++ b/bin/backup @@ -100,6 +100,7 @@ assert_arg "$ARCHIVE_TAG" 'ARCHIVE_TAG' run() { + set -x borg create \ $VERBOSE_FLAGS \ --comment "$COMMENT" \ @@ -110,6 +111,7 @@ run() { "::{hostname}-{now}-$ARCHIVE_TAG" \ ~/ STATUS=$? + set +x if [ "$STATUS" = 0 ]; then return 0 -- cgit v1.2.3 From c5518ec7b288f6f7d1795198d2da735acc33cbaa Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 16 May 2022 01:09:12 -0300 Subject: etc/bash/rc: Don't source /etc/bashrc from user file Let this file be soruced by /etc/* files, or not be sourced at all. --- etc/bash/rc | 3 --- 1 file changed, 3 deletions(-) diff --git a/etc/bash/rc b/etc/bash/rc index 28c3813..e7c6d99 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -1,8 +1,5 @@ #!/bin/sh -if [ -r /etc/bashrc ]; then - . /etc/bashrc -fi ln -fs .profile ~/.bashrc export ENV=~/.profile -- cgit v1.2.3 From e6301e05fce35fac4b46f8b1886c514cd8285e72 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 16 May 2022 01:12:44 -0300 Subject: etc/bash/rc: manually load $XDG_CONFIG_HOME/guix/current/etc/profile Guix sources the hardcoded ~/.config/guix/current in /etc/profile, so my custom path needs to be loaded manually. --- etc/bash/rc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/bash/rc b/etc/bash/rc index e7c6d99..a70b770 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -19,9 +19,13 @@ mkdir -p \ "$XDG_STATE_HOME" \ "$XDG_LOG_HOME" +GUIX_PROFILE="$XDG_CONFIG_HOME"/guix/current +if [ -r "$GUIX_PROFILE"/etc/profile ]; then + . "$GUIX_PROFILE"/etc/profile +fi + HISTSIZE= HISTFILE="$XDG_STATE_HOME/bash-history" - HISTCONTROL=ignorespace:ignoredups export SRC=~/dev -- cgit v1.2.3 From c2a8a8786a140b3c6cc830ce0a86afff68477846 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 16 May 2022 01:29:52 -0300 Subject: etc/bash/rc: explicitly set $HISTSIZE to -1 to represent the infinite value --- etc/bash/rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/bash/rc b/etc/bash/rc index a70b770..3990ebe 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -24,7 +24,7 @@ if [ -r "$GUIX_PROFILE"/etc/profile ]; then . "$GUIX_PROFILE"/etc/profile fi -HISTSIZE= +HISTSIZE=-1 HISTFILE="$XDG_STATE_HOME/bash-history" HISTCONTROL=ignorespace:ignoredups -- cgit v1.2.3 From 776275d9a76d4c5936a3f2ba1c3d3fe73ba2e946 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 16 May 2022 01:36:06 -0300 Subject: etc/bash/rc: Use "-e" instead of "-r" before sourcing files I previously had the impression that "-r" tested for a "readable file", when it actually works on directories too. So I'm sticking to the more general "-e" instead. --- etc/bash/rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/bash/rc b/etc/bash/rc index 3990ebe..1cfd404 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -20,7 +20,7 @@ mkdir -p \ "$XDG_LOG_HOME" GUIX_PROFILE="$XDG_CONFIG_HOME"/guix/current -if [ -r "$GUIX_PROFILE"/etc/profile ]; then +if [ -e "$GUIX_PROFILE"/etc/profile ]; then . "$GUIX_PROFILE"/etc/profile fi @@ -325,7 +325,7 @@ chmod 600 "$XDG_CONFIG_HOME"/ssh/id_rsa.pub stty -ixon # Disable C-s/C-q mode -if [ -r "$XDG_CONFIG_HOME"/bash/privrc.sh ]; then +if [ -e "$XDG_CONFIG_HOME"/bash/privrc.sh ]; then # Extra rc code to be loaded, stored in private repository . "$XDG_CONFIG_HOME"/bash/privrc.sh fi -- cgit v1.2.3 From 28a914b305ec616792f4aff6b6198bfbf0ad7e0c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 16 May 2022 20:35:43 -0300 Subject: etc/guix/current: Add guix profile symlink --- etc/guix/current | 1 + 1 file changed, 1 insertion(+) create mode 120000 etc/guix/current diff --git a/etc/guix/current b/etc/guix/current new file mode 120000 index 0000000..720f941 --- /dev/null +++ b/etc/guix/current @@ -0,0 +1 @@ +/var/guix/profiles/per-user/andreh/current-guix \ No newline at end of file -- cgit v1.2.3 From 6252a67b158103ed601a981296bc23e1526f1703 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 18 May 2022 03:45:55 -0300 Subject: bin/msg: Use a single MESSAGE for all actions that take an argument --- bin/msg | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 15 deletions(-) diff --git a/bin/msg b/bin/msg index 32f4fd9..137c62c 100755 --- a/bin/msg +++ b/bin/msg @@ -4,7 +4,7 @@ set -eu usage() { cat <<-'EOF' Usage: - msg -X XMPP_MESSAGE -s -S SOUND_MESSAGE -m EMAIL -D DESKTOP -b + msg [-X|-s|-S|-m|-D|-b] [MESSAGE] msg -h EOF } @@ -13,12 +13,12 @@ help() { cat <<-'EOF' Options: - -X XMPP_MESSAGE send XMPP using the `xmpp` command - -s play $XDG_DATA_HOME/msg/medium.ogg sound - -S SOUND_MESSAGE say SOUND_MESSAGE using `speak` - -m EMAIL_SUBJECT send email with EMAIL_SUBJECT and empty body - -D DESKTOP_MESSAGE the desktop message for `notify-send` - -b print terminal bell + -X send MESSAGE using the `xmpp` command + -s play $XDG_DATA_HOME/msg/medium.ogg sound + -S say MESSAGE using `speak` + -m send email with MESSAGE as subject and empty body + -D send desktop MESSAGE via `notify-send` + -b print terminal bell -h, --help show this message EOF } @@ -39,34 +39,41 @@ for flag in "$@"; do done sound() { - play $XDG_DATA_HOME/msg/medium.ogg 2>/dev/null + play "$XDG_DATA_HOME"/msg/medium.ogg 2>/dev/null } +XMPP=false +SOUND=false +SPEAK=false +MAIL=false +DESKTOP=false +BELL=false ACTION_DONE=false -while getopts 'X:sS:m:D:bh' flag; do +SHOW_USAGE=false +while getopts 'XsSmDbh' flag; do case "$flag" in X) - xmpp -m "$OPTARG" eu@euandreh.xyz & + XMPP=true ACTION_DONE=true ;; s) - sound & + SOUND=true ACTION_DONE=true ;; S) - echo "$OPTARG" | speak -v pt-BR & + SPEAK=true ACTION_DONE=true ;; m) - echo " " | email -s "$OPTARG" eu@euandre.org & + MAIL=true ACTION_DONE=true ;; D) - notify-send "$OPTARG" & + DESKTOP=true ACTION_DONE=true ;; b) - printf '\a' & + BELL=true ACTION_DONE=true ;; h) @@ -80,11 +87,47 @@ while getopts 'X:sS:m:D:bh' flag; do ;; esac done +shift $((OPTIND - 1)) if [ "$ACTION_DONE" = false ]; then sound usage help + exit +fi + + +MESSAGE="${1:-}" + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s.\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + +if [ "$XMPP" = true ]; then + assert_arg "$MESSAGE" '-X MESSAGE' + xmpp -m "$MESSAGE" eu@euandreh.xyz & +fi +if [ "$SOUND" = true ]; then + sound & +fi +if [ "$SPEAK" = true ]; then + assert_arg "$MESSAGE" '-S MESSAGE' + echo "$MESSAGE" | speak -v pt-BR & +fi +if [ "$MAIL" = true ]; then + assert_arg "$MESSAGE" '-m MESSAGE' + echo " " | email -s "$MESSAGE" eu@euandre.org & +fi +if [ "$DESKTOP" = true ]; then + assert_arg "$MESSAGE" '-D MESSAGE' + notify-send "$MESSAGE" & +fi +if [ "$BELL" = true ]; then + printf '\a' & fi wait -- cgit v1.2.3 From e209690c83300c915e13d9fdfe8a32d6e5b1c9f0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 18 May 2022 03:47:52 -0300 Subject: bin/msg: Add example to help message --- bin/msg | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/msg b/bin/msg index 137c62c..d8ae7fd 100755 --- a/bin/msg +++ b/bin/msg @@ -20,6 +20,18 @@ help() { -D send desktop MESSAGE via `notify-send` -b print terminal bell -h, --help show this message + + MESSAGE the text to be sent by the relevant channel + + Examples: + + Ring a terminal bell and play a sound: + + $ msg -sb + + Send an email and an XMPP message: + + $ msg -mX 'The message goes here' EOF } -- cgit v1.2.3 From 2d973e56abd242d76e6aae403ae71ef7a2c9fb2e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 21 May 2022 10:00:44 -0300 Subject: bin/e: Launch fzf prompt with personal files when no argument is given --- bin/e | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/e b/bin/e index 76b4899..b163eda 100755 --- a/bin/e +++ b/bin/e @@ -75,5 +75,14 @@ if [ ! -t 0 ]; then $CMD "$F" cat "$F" >&3 else - $CMD "$@" + if [ $# -eq 0 ]; then + f="$(fzf --select-1 --exit-0 < "$XDG_DATA_HOME"/euandreh/e.list.txt)" + if [ -n "$f" ]; then + # FIXME + history -s e "$f" + sh -c "$CMD $f" + fi + else + $CMD "$@" + fi fi -- cgit v1.2.3 From b5a97ccffb1139a08ba284982f3a1394738352b9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 21 May 2022 10:04:47 -0300 Subject: etc/guix/{home,system}.scm: Use proper packaged "guile-heredoc" package --- etc/guix/home.scm | 3 ++- etc/guix/system.scm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 5e56009..e4ebe58 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -1,5 +1,5 @@ (use-modules - (curth0) + ((xyz euandreh heredoc) #:prefix heredoc:) (gnu home) (gnu home services) (gnu home services mcron) @@ -20,6 +20,7 @@ (guix modules) (guix packages) (guix utils)) +(heredoc:enable-syntax) (define msmtp-non-hardcoded (package diff --git a/etc/guix/system.scm b/etc/guix/system.scm index e4627cc..b568d66 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -1,5 +1,5 @@ (use-modules - (curth0) + ((xyz euandreh heredoc) #:prefix heredoc:) (ice-9 rdelim) (gnu bootloader) (gnu bootloader grub) @@ -20,6 +20,7 @@ (nongnu packages linux) (nongnu system linux-initrd) (srfi srfi-1)) +(heredoc:enable-syntax) (operating-system (kernel linux) -- cgit v1.2.3 From 44087cc7ba03c0010589713726974f8c9eb481c2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 21 May 2022 10:05:51 -0300 Subject: etc/guix/home.scm: Explicitly load srfi-1 instead of inheriting it from curth0 --- etc/guix/home.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index e4ebe58..2fca54d 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -19,7 +19,8 @@ (guix gexp) (guix modules) (guix packages) - (guix utils)) + (guix utils) + ((srfi srfi-1) #:prefix s1:)) (heredoc:enable-syntax) (define msmtp-non-hardcoded -- cgit v1.2.3 From 973e50971901c0492c48c13c68aa2266706ab2a7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 2 Jun 2022 15:02:29 -0300 Subject: bin/tmp: Move from website repository, now pointing to kuvira --- bin/tmp | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100755 bin/tmp diff --git a/bin/tmp b/bin/tmp new file mode 100755 index 0000000..e2d16b7 --- /dev/null +++ b/bin/tmp @@ -0,0 +1,76 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + tmp FILE... + tmp -d + tmp -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -d delete the remote "tmp/" folder + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +REMOTE='euandreh.xyz' +DIR='/opt/www/euandreh.xyz/static/tmp' +while getopts 'dh' flag; do + case "$flag" in + d) + printf 'Deleting %s:%s...\n' "$REMOTE" "$DIR/" >&2 + ssh "$REMOTE" rm -rf "$DIR" + exit + ;; + h) + usage + help + exit + ;; + *) + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) +FILE="${1:-}" + +if [ -z "$FILE" ]; then + printf 'Missing FILE.\n\n' >&2 + usage >&2 + exit 2 +fi + +for f in "$@"; do + FILENAME="$(basename "$f")" + # shellcheck disable=2029 + ssh "$REMOTE" "mkdir -p '$DIR' && cat > '$DIR/$FILENAME'" < "$f" + + LINK="$(printf 'https://%s/tmp/%s' "$REMOTE" "$FILENAME")" + open "$LINK" + if [ $# = 1 ]; then + printf '%s' "$LINK" | copy + printf 'Copied %s to the clipboard!\n' "$LINK" >&2 + fi +done -- cgit v1.2.3 From 44f1d73861a9f5b26ff18d963e9cb44e291e5040 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 15 Jun 2022 18:12:29 -0300 Subject: mv share/msg: medium -> good, low -> bad --- share/msg/bad.ogg | Bin 0 -> 12217 bytes share/msg/good.ogg | Bin 0 -> 99826 bytes share/msg/low.ogg | Bin 12217 -> 0 bytes share/msg/medium.ogg | Bin 99826 -> 0 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 share/msg/bad.ogg create mode 100644 share/msg/good.ogg delete mode 100644 share/msg/low.ogg delete mode 100644 share/msg/medium.ogg diff --git a/share/msg/bad.ogg b/share/msg/bad.ogg new file mode 100644 index 0000000..0e91525 Binary files /dev/null and b/share/msg/bad.ogg differ diff --git a/share/msg/good.ogg b/share/msg/good.ogg new file mode 100644 index 0000000..22cb563 Binary files /dev/null and b/share/msg/good.ogg differ diff --git a/share/msg/low.ogg b/share/msg/low.ogg deleted file mode 100644 index 0e91525..0000000 Binary files a/share/msg/low.ogg and /dev/null differ diff --git a/share/msg/medium.ogg b/share/msg/medium.ogg deleted file mode 100644 index 22cb563..0000000 Binary files a/share/msg/medium.ogg and /dev/null differ -- cgit v1.2.3 From 8c7d3c182872b6bcd03b45f0f1e25a83aae9de92 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 15 Jun 2022 18:15:36 -0300 Subject: bin/boop: Add working version --- bin/boop | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 bin/boop diff --git a/bin/boop b/bin/boop new file mode 100755 index 0000000..2b45422 --- /dev/null +++ b/bin/boop @@ -0,0 +1,74 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + boop -- COMMAND... + boop -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + COMMAND the commands to be executed + + + Examples: + + Play the positive sound: + + $ boop echo 123 + + Fail with the underlying 127 return code: + + $ boop ech 123 + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +set +e +"$@" +STATUS=$? +set -e + +if [ "$STATUS" = 0 ]; then + play "$XDG_DATA_HOME"/msg/good.ogg 2>/dev/null +else + play "$XDG_DATA_HOME"/msg/bad.ogg 2>/dev/null +fi + +exit "$STATUS" -- cgit v1.2.3 From aa8c4792665a2e5f0aad9b0400706692b6891402 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 10 Jul 2022 23:14:53 -0300 Subject: bin/rfc: Support incremental update of local RFCs repository --- bin/rfc | 124 ++++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 82 insertions(+), 42 deletions(-) diff --git a/bin/rfc b/bin/rfc index a483595..168c59e 100755 --- a/bin/rfc +++ b/bin/rfc @@ -1,12 +1,21 @@ #!/bin/sh set -eu -TARBALL_URL='https://www.rfc-editor.org/in-notes/tar/RFC-all.tar.gz' +D="${XDG_DATA_HOME:-$HOME/.local/share}/doc/rfc" +PROMPT_DB="$( + cat <<-EOF + RFC directory does not exist: + $D/ + + Do you want to download the files to create it? + EOF +)" usage() { cat <<-'EOF' Usage: rfc [-w] RFC_NUMBER + rfc -u rfc -h EOF } @@ -15,8 +24,9 @@ help() { cat <<-'EOF' Options: - -w Show the path to the RFC file instead of displaying - its contents. + -w show the path to the RFC file instead of displaying + its contents + -u update the local RFC database -h, --help show this message Lookup the given RFC @@ -25,14 +35,66 @@ help() { $ $PAGER $XDG_DATA_HOME/doc/rfc/rfc$RFC_NUMBER.txt - If the $XDG_DATA_HOME/doc/rfc/ directory doesn't exist, it tries to - create it by downloading the latest RFC tarball [0] and placing all .txt + If the $XDG_DATA_HOME/doc/rfc/ directory doesn't exist, it gets + created it by downloading the latest RFC files and placing all .txt files there. + + + Examples: + + + Show RFC 1234 in $PAGER: + + $ rfc 1234 + + + Print path to RFC 2222: + + $ rfc 2222 + + + Download the latest RFCs: + + $ rfc -u EOF +} - printf '\n[0]: %s\n' "$TARBALL_URL" +view() { + if [ -t 1 ]; then + ${PAGER:-cat} + else + cat + fi +} + +update() { + rsync -avzP --delete ftp.rfc-editor.org::rfcs-text-only "$D" + STATUS=$? + if [ "$STATUS" != 0 ]; then + exit "$STATUS" + fi } +check_local_db() { + if [ ! -e "$D" ]; then + if prompt "$PROMPT_DB"; then + update + else + echo 'No local RFC database to operate on.' >&2 + exit 1 + fi + fi +} + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s.\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + + for flag in "$@"; do case "$flag" in --) @@ -48,11 +110,14 @@ for flag in "$@"; do esac done -while getopts 'wh' flag; do +while getopts 'wuh' flag; do case "$flag" in w) WHERE=true ;; + u) + UPDATE=true + ;; h) usage help @@ -67,34 +132,16 @@ done shift $((OPTIND - 1)) RFC_NUMBER="${1:-}" -if [ -z "$RFC_NUMBER" ]; then - echo 'Missing argument RFC_NUMBER' >&2 - usage >&2 - exit 2 -fi +F="$D/rfc${RFC_NUMBER}.txt" -D="${XDG_DATA_HOME:-$HOME/.local/share}/doc/rfc" -if [ ! -e "$D" ]; then - printf 'RFC directory does not exist:\n\t%s/\n\n' "$D" - printf 'Do you want to download the files to create it? [Y/n] ' - read -r yesno - if [ "$yesno" != 'n' ] && [ "$yesno" != 'N' ]; then - CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/rfc-cli" - mkdir -p "$CACHE_DIR" - wget -cO "$CACHE_DIR"/RFC-all.tar.gz "$TARBALL_URL" - rm -rf "$CACHE_DIR/tmp" - mkdir -p "$CACHE_DIR/tmp" - tar \ - -C "$CACHE_DIR/tmp" \ - -xvf "$CACHE_DIR"/RFC-all.tar.gz \ - --wildcards \ - 'rfc*.txt' - mkdir -p "$(dirname "$D")" - mv "$CACHE_DIR/tmp" "$D" - fi + +if [ "${UPDATE:-}" = true ]; then + update + exit fi -F="$D/rfc${RFC_NUMBER}.txt" +assert_arg "$RFC_NUMBER" + if [ ! -e "$F" ]; then printf 'Given RFC_NUMBER "%s" does not exist at:\n%s\n' \ "$RFC_NUMBER" "$F" >&2 @@ -104,14 +151,7 @@ fi if [ "${WHERE:-}" = true ]; then printf '%s\n' "$F" exit +else + view < "$F" + exit fi - -view() { - if [ -t 1 ]; then - ${PAGER:-cat} - else - cat - fi -} - -view < "$F" -- cgit v1.2.3 From c37792e80f73ee46d50132f3048cd42cbd32b6fe Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 10 Jul 2022 23:15:44 -0300 Subject: bin/prompt: Add initial working version --- bin/prompt | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 bin/prompt diff --git a/bin/prompt b/bin/prompt new file mode 100755 index 0000000..a191238 --- /dev/null +++ b/bin/prompt @@ -0,0 +1,75 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + prompt STRING|- + prompt -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + STRING the text to be displayed in the prompt + + + Display a prompt and return a value corresponding to the + response. + EOF +} + +assert_arg() { + if [ -z "$1" ]; then + printf 'Missing %s.\n\n' "$2" >&2 + usage >&2 + exit 2 + fi +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +STRING="${1:-}" +assert_arg "$STRING" 'STRING' + +printf '%s' "$STRING" +printf ' [Y/n]: ' +read -r yesno +if [ "$yesno" != 'n' ] && [ "$yesno" != 'N' ]; then + exit 0 +else + exit 1 +fi -- cgit v1.2.3 From 4bc53da057967bafffd065d5d75eb14b267f2cd7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 10 Jul 2022 23:49:51 -0300 Subject: bin/rfc: Add missing call to check_local_db --- bin/rfc | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/rfc b/bin/rfc index 168c59e..e0da425 100755 --- a/bin/rfc +++ b/bin/rfc @@ -134,6 +134,7 @@ shift $((OPTIND - 1)) RFC_NUMBER="${1:-}" F="$D/rfc${RFC_NUMBER}.txt" +check_local_db if [ "${UPDATE:-}" = true ]; then update -- cgit v1.2.3 From ed658f31d004cd52dd7053b6fd7e5bdde4e03e11 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 15 Jul 2022 19:28:41 -0300 Subject: etc/newsboat/config: Set max column width of newsboat to 80 --- etc/newsboat/config | 1 + 1 file changed, 1 insertion(+) create mode 100644 etc/newsboat/config diff --git a/etc/newsboat/config b/etc/newsboat/config new file mode 100644 index 0000000..b138e1d --- /dev/null +++ b/etc/newsboat/config @@ -0,0 +1 @@ +text-width 80 -- cgit v1.2.3 From 3487892284d10ad1f52d0a5f9879cab049ae0444 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 18:43:10 -0300 Subject: etc/git/ignore: Always exclude tmp/ directory --- etc/git/ignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 etc/git/ignore diff --git a/etc/git/ignore b/etc/git/ignore new file mode 100644 index 0000000..82520ca --- /dev/null +++ b/etc/git/ignore @@ -0,0 +1 @@ +/tmp/ -- cgit v1.2.3 From c0ed55485e8db03673318f67dd06e7a04435c0f9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 18:46:42 -0300 Subject: bin/{min,max,clamp}: Add "Examples" section to help string --- bin/clamp | 19 +++++++++++++++++++ bin/max | 23 +++++++++++++++++++++++ bin/min | 24 ++++++++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/bin/clamp b/bin/clamp index a40b823..652c978 100755 --- a/bin/clamp +++ b/bin/clamp @@ -15,7 +15,26 @@ help() { Options: -h, --help show this message + Clamp the NUMBER between MIN and MAX. + + + Examples: + + Assert the number is within the interval: + + $ clamp 5 3 9 + 5 + + When a number is below MIN it gets clamped: + + $ clamp 1 3 9 + 3 + + When a number is above MAX it gets clamped: + + $ clamp 15 3 9 + 9 EOF } diff --git a/bin/max b/bin/max index 84585ee..ae38983 100755 --- a/bin/max +++ b/bin/max @@ -16,6 +16,29 @@ help() { -h, --help show this message Get the maximum number from the given values. + + + Examples: + + Get the maximum number from a list: + + $ min 5 3 9 9 4 + 9 + + Get the maximum number when negative numbers are given + + $ max -- -3 -5 + -3 + + Get the maximum number given a single number + + $ max 8 + 8 + + The maximum default number: + + $ max + 0 EOF } diff --git a/bin/min b/bin/min index 7868623..715f4d1 100755 --- a/bin/min +++ b/bin/min @@ -15,7 +15,31 @@ help() { Options: -h, --help show this message + Get the minimun number from the given values. + + + Examples: + + Get the minimum number from a list: + + $ min 5 3 9 9 4 + 3 + + Get the minimum number when negative numbers are given + + $ min -- -3 -5 + -5 + + Get the minimum number given a single number + + $ min 8 + 8 + + The minimum default number: + + $ min + 0 EOF } -- cgit v1.2.3 From c659d80765fe5553058ab3c9b3d58c48fc632e3a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 18:50:07 -0300 Subject: bin/clamp: Replace ad-hoc `assert_arg()` with `assert-arg` --- bin/clamp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/bin/clamp b/bin/clamp index 652c978..a673f72 100755 --- a/bin/clamp +++ b/bin/clamp @@ -68,21 +68,14 @@ while getopts 'h' flag; do done shift $((OPTIND - 1)) -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} NUMBER="${1:-}" MIN="${2:-}" MAX="${3:-}" -assert_arg "$NUMBER" 'NUMBER' -assert_arg "$MIN" 'MIN' -assert_arg "$MAX" 'MAX' +eval "$(assert-arg "$NUMBER" 'NUMBER')" +eval "$(assert-arg "$MIN" 'MIN')" +eval "$(assert-arg "$MAX" 'MAX')" if [ "$MIN" -gt "$MAX" ]; then -- cgit v1.2.3 From a67170c98eca90b34e4069db048dbd157c2d2156 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 18:50:28 -0300 Subject: bin/assert-arg: Add helper utility --- bin/assert-arg | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 bin/assert-arg diff --git a/bin/assert-arg b/bin/assert-arg new file mode 100755 index 0000000..d7bc8f4 --- /dev/null +++ b/bin/assert-arg @@ -0,0 +1,78 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + assert-arg STRING MESSAGE + assert-arg -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + STRING the string to check if is empty + MESSAGE the message to print when STRING is empty + + + Examples: + + Assert that $1 contains an argument, named FILENAME: + + $ eval "$(assert-arg "${1:-}" 'FILENAME')" + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +STRING="${1:-}" +MESSAGE="${2:-}" + +if [ -z "$MESSAGE" ]; then + printf 'Missing MESSAGE, an argument to assert-arg.\n\n' >&2 + usage >&2 + exit 2 +fi + + +if [ -z "$STRING" ]; then + printf 'Missing %s.\n\n' "$MESSAGE" >&2 + cat <<-'EOF' + usage >&2 + exit 2 + EOF +fi -- cgit v1.2.3 From 9a3a2e87235098d67072848589764e7d25832bf1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 18:54:53 -0300 Subject: bin/color: Add "Examples" section to help string --- bin/color | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bin/color b/bin/color index 0597278..d03a232 100755 --- a/bin/color +++ b/bin/color @@ -12,15 +12,31 @@ usage() { help() { cat <<-'EOF' - Options: -c COLOR -h, --help show this message + Print the given text with a color. + The available colors are: EOF list_colors | sed 's/^/ /' + + cat <<-'EOF' + + Examples: + + Print "banana" in yellow: + + $ color -c yellow 'banana' + banana + + Print "grass" in green, with a newline: + + $ color -c green 'grass\n' + grass + EOF } -- cgit v1.2.3 From 517bf0b208dd3def6cac9e760a91d546f0d1b336 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 18:56:54 -0300 Subject: bin/color: Replace ad-hoc `assert_arg()` with `assert-arg` --- bin/color | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/bin/color b/bin/color index d03a232..05ef95b 100755 --- a/bin/color +++ b/bin/color @@ -175,6 +175,7 @@ for flag in "$@"; do esac done +COLOR_FN='' while getopts 'c:h' flag; do case "$flag" in c) @@ -204,17 +205,10 @@ while getopts 'c:h' flag; do done shift $((OPTIND - 1)) -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - TEXT="${1:-}" -assert_arg "$COLOR_FN" '-c COLOR' -assert_arg "$TEXT" 'TEXT' + +eval "$(assert-arg "$COLOR_FN" '-c COLOR')" +eval "$(assert-arg "$TEXT" 'TEXT')" "$COLOR_FN" "$TEXT" -- cgit v1.2.3 From 79dc0af8db711e15e3b5c9f50702652317ffdd30 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 18:57:47 -0300 Subject: bin/80: Add helper utility --- bin/80 | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 bin/80 diff --git a/bin/80 b/bin/80 new file mode 100755 index 0000000..b971f5d --- /dev/null +++ b/bin/80 @@ -0,0 +1,85 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + 80 [FILENAME...] + 80 -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + FILENAME the name of the file to work on (default: + the list of file in the VCS repository) + + + List the lines in the files that contain more than 80 columns. + + + Examples: + + Check for all the files in the current repository: + + $ 80 + + + Detect on the given two files: + + $ 80 f1 f2 + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +len() { + awk ' + length > 80 { + printf "%s:%s:%s\n", FILENAME, FNR, $0 + } + ' "$1" +} + +if [ $# = 0 ]; then + vcs ls-files | while read -r f; do + len "$f" + done +else + for f in "$@"; do + len "$f" + done +fi -- cgit v1.2.3 From 81d3e80123e618ee8e9ef5e83104b0826985cb0b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 18:58:23 -0300 Subject: bin/backup: Make tag optional and script verbose by default --- bin/backup | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/bin/backup b/bin/backup index e8d4b73..763c693 100755 --- a/bin/backup +++ b/bin/backup @@ -4,7 +4,7 @@ set -eu usage() { cat <<-'EOF' Usage: - backup [-v] [-C COMMENT] ARCHIVE_TAG + backup -q [-C COMMENT] [ARCHIVE_TAG] backup -h EOF } @@ -14,13 +14,13 @@ help() { Options: - -v enable verbose mode, useful for - interactive sessions + -q disable verbose mode, useful for + non-interactive sessions -C COMMENT the comment text to be attached to the archive -h, --help show this message ARCHIVE_TAG the tag used to create the new - backup (default: "cronjob") + backup (default: "manual") The repository is expected to have been created with: @@ -39,13 +39,13 @@ help() { Examples: - Run backup from cronjob: + Run backup manually: - $ backup cronjob + $ backup Create backup with comment, and verbose mode active: - $ backup -vC 'The backup has a comment' my-backup + $ backup -qC 'The backup has a comment' my-backup EOF } @@ -64,12 +64,12 @@ for flag in "$@"; do esac done -VERBOSE_FLAGS='' +VERBOSE_FLAGS='--verbose --progress' COMMENT='' -while getopts 'vC:h' flag; do +while getopts 'qC:h' flag; do case "$flag" in - v) - VERBOSE_FLAGS='--verbose --progress' + q) + VERBOSE_FLAGS='' ;; C) COMMENT="$OPTARG" @@ -87,16 +87,8 @@ while getopts 'vC:h' flag; do done shift $((OPTIND - 1)) -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n' "$2" >&2 - usage >&2 - exit 2 - fi -} -ARCHIVE_TAG="${1:-}" -assert_arg "$ARCHIVE_TAG" 'ARCHIVE_TAG' +ARCHIVE_TAG="${1:-manual}" run() { -- cgit v1.2.3 From 6f57ffd95197152c77a8e02ecfdaa356e7a0cda3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 18:59:40 -0300 Subject: bin/boop: Add optional -m MESSAGE, and use `msg` over playing sound directly --- bin/boop | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/bin/boop b/bin/boop index 2b45422..d2de30f 100755 --- a/bin/boop +++ b/bin/boop @@ -3,7 +3,7 @@ set -eu usage() { cat <<-'EOF' - boop -- COMMAND... + boop [-m MESSAGE] -- COMMAND... boop -h EOF } @@ -12,6 +12,8 @@ help() { cat <<-'EOF' Options: + -m MESSAGE text message of the desktop + notification (default: COMMAND) -h, --help show this message COMMAND the commands to be executed @@ -19,13 +21,14 @@ help() { Examples: - Play the positive sound: + Play the positive sound, using the command as message: $ boop echo 123 - Fail with the underlying 127 return code: + Fail with the underlying 127 return code with the + message "ERROR": - $ boop ech 123 + $ boop -m ERROR ech 123 EOF } @@ -44,8 +47,11 @@ for flag in "$@"; do esac done -while getopts 'h' flag; do +while getopts 'm:h' flag; do case "$flag" in + m) + MESSAGE="$OPTARG" + ;; h) usage help @@ -66,9 +72,12 @@ STATUS=$? set -e if [ "$STATUS" = 0 ]; then - play "$XDG_DATA_HOME"/msg/good.ogg 2>/dev/null + N=0 else - play "$XDG_DATA_HOME"/msg/bad.ogg 2>/dev/null + N=1 fi +CMD="$@" +msg -"$N" -bs -D "${MESSAGE:-$CMD}" + exit "$STATUS" -- cgit v1.2.3 From 6f1a792d88c7c9bcb4d68d5f747e89599e4c6ad4 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:00:27 -0300 Subject: bin/msg: Support good and bad messages via -0 and -1 --- bin/msg | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/bin/msg b/bin/msg index d8ae7fd..ad0b608 100755 --- a/bin/msg +++ b/bin/msg @@ -4,7 +4,7 @@ set -eu usage() { cat <<-'EOF' Usage: - msg [-X|-s|-S|-m|-D|-b] [MESSAGE] + msg [-0|-1] [-X|-s|-S|-m|-D|-b] [MESSAGE] msg -h EOF } @@ -14,20 +14,22 @@ help() { Options: -X send MESSAGE using the `xmpp` command - -s play $XDG_DATA_HOME/msg/medium.ogg sound + -s play $XDG_DATA_HOME/msg/{good,bad}.ogg sound -S say MESSAGE using `speak` -m send email with MESSAGE as subject and empty body -D send desktop MESSAGE via `notify-send` -b print terminal bell + -0 an OK message + -1 an error message -h, --help show this message MESSAGE the text to be sent by the relevant channel Examples: - Ring a terminal bell and play a sound: + Ring a terminal bell and play a sound, representing an error: - $ msg -sb + $ msg -1sb Send an email and an XMPP message: @@ -51,9 +53,14 @@ for flag in "$@"; do done sound() { - play "$XDG_DATA_HOME"/msg/medium.ogg 2>/dev/null + if [ "$OK" = true ]; then + play "$XDG_DATA_HOME"/msg/good.ogg 2>/dev/null + else + play "$XDG_DATA_HOME"/msg/bad.ogg 2>/dev/null + fi } +OK=true XMPP=false SOUND=false SPEAK=false @@ -62,8 +69,14 @@ DESKTOP=false BELL=false ACTION_DONE=false SHOW_USAGE=false -while getopts 'XsSmDbh' flag; do +while getopts '01XsSmDbh' flag; do case "$flag" in + 0) + OK=true + ;; + 1) + OK=false + ;; X) XMPP=true ACTION_DONE=true @@ -136,7 +149,11 @@ if [ "$MAIL" = true ]; then fi if [ "$DESKTOP" = true ]; then assert_arg "$MESSAGE" '-D MESSAGE' - notify-send "$MESSAGE" & + if [ "$OK" = true ]; then + notify-send -t 5000 "$MESSAGE" & + else + notify-send -t 5000 -u critical "$MESSAGE" & + fi fi if [ "$BELL" = true ]; then printf '\a' & -- cgit v1.2.3 From dac28bee629491f3036b9dc5712113729b897549 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:01:27 -0300 Subject: etc/git/ignore: Add /FIXME --- etc/git/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/git/ignore b/etc/git/ignore index 82520ca..37a4b27 100644 --- a/etc/git/ignore +++ b/etc/git/ignore @@ -1 +1,2 @@ /tmp/ +/FIXME -- cgit v1.2.3 From decbff8958f0bf569c27e60505a74865924d63b9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:02:05 -0300 Subject: etc/guix/channels.scm: Fix path to xyz-euandreh channel --- etc/guix/channels.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/guix/channels.scm b/etc/guix/channels.scm index 304db35..f2da084 100644 --- a/etc/guix/channels.scm +++ b/etc/guix/channels.scm @@ -2,7 +2,7 @@ (list (channel (name 'xyz-euandreh) - (url "git://euandreh.xyz/package-repository.git/") + (url "git://euandreh.xyz/package-repository") (branch "main") (introduction (make-channel-introduction -- cgit v1.2.3 From 09dc6ad2dea2097d930db0d58a51e9ede55c4106 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:02:40 -0300 Subject: etc/xmonad/: Remove xmonad configuration files --- etc/xmonad/xmobarrc | 26 -------------- etc/xmonad/xmonad.hs | 100 --------------------------------------------------- 2 files changed, 126 deletions(-) delete mode 100644 etc/xmonad/xmobarrc delete mode 100644 etc/xmonad/xmonad.hs diff --git a/etc/xmonad/xmobarrc b/etc/xmonad/xmobarrc deleted file mode 100644 index 1526b60..0000000 --- a/etc/xmonad/xmobarrc +++ /dev/null @@ -1,26 +0,0 @@ -Config { - font = "xft:DejaVu Sans Mono:size=9" - , commands = [ - Run Cpu ["-L","3","-H","50", "--normal","#5ea2a4","--high","red"] 10 - , Run Memory ["-t","Mem: %"] 30 - , Run Swap [] 30 - , Run Date "%A, %e %B %Y, %H:%M:%S" "date" 10 - , Run DiskU [("/", "/")] [] 600 - , Run Wireless "wlp0s20f3" [] 100 - , Run Volume "default" "Master" [] 10 - , Run Battery [ - "-t", ": % - ", - "--", - "-O", "AC", - "-i", "Full", - "-o", "Bat", - "-p", "orange", - "-h", "green", - "-l", "red"] - 10 - , Run CommandReader "~/dev/libre/dotfiles/xmonad/scripts/xmobar-mpris.sh" "mpris" - , Run CommandReader "~/dev/libre/dotfiles/xmonad/scripts/xmobar-notifications.sh" "notifications" - , Run CommandReader "~/dev/libre/dotfiles/xmonad/scripts/xmobar-mail.sh" "notmuch" - ] - , template = " %date% | %default:Master%| %mpris% } { %notifications% | %notmuch% | %wlp0s20f3wi% | %battery% | %memory% * %swap% | %cpu% | %disku% " -} diff --git a/etc/xmonad/xmonad.hs b/etc/xmonad/xmonad.hs deleted file mode 100644 index d459ced..0000000 --- a/etc/xmonad/xmonad.hs +++ /dev/null @@ -1,100 +0,0 @@ -import XMonad -import XMonad.Actions.SpawnOn(spawnHere) -import XMonad.Hooks.ManageDocks -import XMonad.Util.EZConfig(additionalKeysP) -import XMonad.Layout.NoBorders -import XMonad.Hooks.SetWMName -import XMonad.Hooks.ManageHelpers -import XMonad.Util.Run(spawnPipe) -import XMonad.Layout.ResizableTile -import XMonad.Layout.ResizableTile(MirrorResize(MirrorShrink, MirrorExpand)) - -main :: IO () -main = do - xmproc <- spawnPipe "xmobar $XDG_CONFIG_HOME/xmonad/xmobarrc" - xmonad $ def - -- Fullscreen handling: - -- https://stackoverflow.com/questions/20446348/xmonad-toggle-fullscreen-xmobar - { manageHook = manageDocks <+> (isFullscreen --> doFullFloat) <+> (className =? "trayer" --> doIgnore) <+> manageHook def - , handleEventHook = handleEventHook def <+> docksEventHook - , layoutHook = myLayoutHook - , modMask = mod4Mask -- User Super instead of Alt - , terminal = myTerminal - , startupHook = myStartup - } `additionalKeysP` myKeyPBindings - -myTerminal :: String -myTerminal = "st" - -dbg :: String -dbg = "xmessage 'xmonad EuAndreh debug'" - -myKeyPBindings :: [(String, X ())] -myKeyPBindings = - [ -- Volume - ("", spawn "amixer -q sset Master toggle") - , ("", spawn "amixer -q sset Master 5%- unmute") - , ("", spawn "amixer -q sset Master 5%+ unmute") - - -- Playback - , ("", spawn "playerctl --player=$(cat ~/.cache/euandreh/mpris-player.txt) position 5-") - , ("S-", spawn "playerctl --player=$(cat ~/.cache/euandreh/mpris-player.txt) previous") - , ("", spawn "~/dev/libre/dotfiles/xmonad/scripts/playerctl-play-pause.sh") - , ("S-", spawn "~/dev/libre/dotfiles/xmonad/scripts/rotate-mpris-player.sh") - , ("", spawn "playerctl --player=$(cat ~/.cache/euandreh/mpris-player.txt) position 5+") - , ("S-", spawn "playerctl --player=$(cat ~/.cache/euandreh/mpris-player.txt) next") - - -- Brightness - , ("", spawn "~/dev/libre/dotfiles/xmonad/scripts/brightness.sh -10") - , ("S-", spawn "~/dev/libre/dotfiles/xmonad/scripts/zero-brightness.sh") - , ("", spawn "~/dev/libre/dotfiles/xmonad/scripts/brightness.sh +10") - - , ("M-p", spawnHere "exe=$(dmenu_path | dmenu) && exec $exe") - , ("M-o", spawnHere "~/dev/libre/dotfiles/xmonad/scripts/dmenu-emoji.sh") - , ("M-v", spawnHere "~/dev/libre/dotfiles/xmonad/scripts/dmenu-clipmenu.sh") - , ("M-i", spawn "~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass.sh") - , ("C-M-i", spawnHere "~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass-login.sh") - - -- Lock screen - , ("C-M-l", spawn "dm-tool switch-to-greeter") - - -- print whole screen - , ("M-", spawn "escrotum ~/Downloads/Screenshots/%Y-%m-%d-%T-screenshot.png") - -- print screen of clicked window - , ("C-M-", spawn "escrotum ~/Downloads/Screenshots/%Y-%m-%d-%T-screenshot.png -s") - - -- xrandr single monitor setup - , ("C-M-1", spawn "~/dev/libre/dotfiles/xmonad/scripts/single-monitor.sh") - - -- xrandr three monitor setup - , ("C-M-3", spawn "~/dev/libre/dotfiles/xmonad/scripts/three-monitors.sh") - - -- Toggle appearence of xmobar - -- https://stackoverflow.com/a/27646652 - , ("M-f", sendMessage ToggleStruts) - - , ("M-ç", spawn dbg) - - -- Vertically resize, taken from: - -- https://stackoverflow.com/questions/25857674/xmonad-vertical-resize-tile-window - , ("M-a", sendMessage MirrorExpand) - , ("M-z", sendMessage MirrorShrink) - - - -- Toggle PulseAudio sink - , ("M-s", spawn "~/dev/libre/dotfiles/xmonad/scripts/toggle-pulseaudio-sink.sh") - ] - -myLayoutHook = - smartBorders $ avoidStruts $ (tiled ||| Mirror tiled ||| Full) - where - tiled = ResizableTall nmaster delta ratio [] - nmaster = 1 - delta = 3/100 - ratio = 1/2 - -myStartup :: X () -myStartup = do - -- Taken from: - -- https://stackoverflow.com/questions/30742662/java-swing-gui-not-displaying-in-xmonad - setWMName "LG3D" -- cgit v1.2.3 From 9da0cf603c8fd357b79e469d627354ee35a057c8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:03:37 -0300 Subject: etc/tmux/tmux.conf: Increase contrast of status bar --- etc/tmux/tmux.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/tmux/tmux.conf b/etc/tmux/tmux.conf index dd718ca..cd2ec6b 100644 --- a/etc/tmux/tmux.conf +++ b/etc/tmux/tmux.conf @@ -47,8 +47,8 @@ bind-key b setw synchronize-panes \; display-message "synchronize-panes toggle" setw -g mode-keys vi # Move around with vi keys set-option -g status-key "vi" # Use vi mode for status bar command (like after typing "C-x [" one can search with "/") -set-option -g status-bg "#666666" # Status bar background color -set-option -g status-fg "#aaaaaa" # Status bar foreground color +set-option -g status-bg "#333333" # Status bar background color +set-option -g status-fg "#ffffff" # Status bar foreground color set-option -g status-left-length 50 # session name in status bar length =[annex]= part set-option -g history-limit 150000 # How many lines of history to keep set-option -g status-right "" -- cgit v1.2.3 From 42368c31bbbd2f4095e51440f5c0e8d6ecb2644d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:04:01 -0300 Subject: etc/tmux/tmux.conf: Use "-" like "cd -" does --- etc/tmux/tmux.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/tmux/tmux.conf b/etc/tmux/tmux.conf index cd2ec6b..708feef 100644 --- a/etc/tmux/tmux.conf +++ b/etc/tmux/tmux.conf @@ -79,3 +79,4 @@ bind-key t resize-pane -x 80 bind -n M-r attach-session -t . -c '#{pane_current_path}' \; display-message "CWD for session updated to #{pane_current_path}!" bind-key u capture-pane \; save-buffer /tmp/tmux-urlscan-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan < /tmp/tmux-urlscan-buffer"' +bind-key - last -- cgit v1.2.3 From 3d4ee814546af5347f3c7665b71293b1a208b0eb Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:05:56 -0300 Subject: etc/{bash => sh}/vcs-ps1.sh: Add shell_status_jobs and shell_status_level --- etc/bash/vcs-ps1.sh | 171 -------------------------------------------- etc/sh/vcs-ps1.sh | 200 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 200 insertions(+), 171 deletions(-) delete mode 100644 etc/bash/vcs-ps1.sh create mode 100644 etc/sh/vcs-ps1.sh diff --git a/etc/bash/vcs-ps1.sh b/etc/bash/vcs-ps1.sh deleted file mode 100644 index 6e74e1d..0000000 --- a/etc/bash/vcs-ps1.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/sh - -repo_status_git() { - BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" - OUT="$(git status --short --branch --porcelain)" - BRANCH_LINE="$(echo "$OUT" | head -n 1)" - DIFF_LINES="$(echo "$OUT" | tail -n +2)" - - IS_AHEAD=false - IS_BEHIND=false - if echo "$BRANCH_LINE" | grep -q 'ahead'; then - IS_AHEAD=true - fi - if echo "$BRANCH_LINE" | grep -q 'behind'; then - IS_BEHIND=true - fi - - LINE='' - - if [ "$IS_AHEAD" = true ] && [ "$IS_BEHIND" = true ]; then - LINE="^^^ $BRANCH_NAME vvv" - elif [ "$IS_AHEAD" = true ]; then - LINE="^ $BRANCH_NAME ^" - elif [ "$IS_BEHIND" = true ]; then - LINE="v $BRANCH_NAME v" - else - LINE="$BRANCH_NAME" - fi - - HAS_DIFF=false - HAS_UNTRACKED=false - if echo "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then - HAS_DIFF=true - fi - if echo "$DIFF_LINES" | grep -q '^[?][?]'; then - HAS_UNTRACKED=true - fi - - if [ "$HAS_DIFF" = true ]; then - COLOR_FN=redb - LINE="{$LINE}" - elif [ "$IS_AHEAD" = true ] || [ "$IS_BEHIND" = true ]; then - COLOR_FN=bluei - LINE="[$LINE]" - elif [ "$HAS_UNTRACKED" = true ]; then - COLOR_FN=lightblue - LINE="{$LINE}" - else - COLOR_FN=green - LINE="($LINE)" - fi - - color -c "$COLOR_FN" "$LINE" - - BRANCH_COUNT="$(git branch --list | wc -l)" - if [ "$BRANCH_COUNT" -gt 1 ]; then - color -c lightblue "<$BRANCH_COUNT>" - fi - - STASH_COUNT="$(git stash list | wc -l)" - if [ "$STASH_COUNT" != 0 ]; then - color -c red "*$STASH_COUNT" - fi - - color -c blacki " - git/$(git rev-parse HEAD)" -} - -repo_status_fossil() { - BRANCH_NAME="$(fossil branch current)" - - if [ -n "$(fossil extras)" ]; then - HAS_UNTRACKED=1 - fi - - BRANCH_MARKER="$BRANCH_NAME" - - if [ -n "${HAS_UNTRACKED:-}" ]; then - COLOR_FN=lightblue - LINE="($BRANCH_MARKER)" - else - COLOR_FN=green - LINE="($BRANCH_MARKER)" - fi - - color -c "$COLOR_FN" "$LINE" - - color -c blacki " - fossil/$(fossil info | awk '/^checkout:/ { print $2 }')" -} - -repo_status_mercurial() { - BRANCH_NAME="$(hg branch)" -} - -repo_status() { - dir="$(basename "$PWD")" - if [ -d .git ]; then - repo_status_git - elif [ -f "$dir.fossil" ]; then - repo_status_fossil - elif [ -d .hg ]; then - repo_status_mercurial - fi -} - - -error_marker() { - STATUS=$? - if [ "$STATUS" != 0 ]; then - color -c redb " (!! $STATUS !!) " - fi -} - -shell_level() { - if [ -n "${SHLVL:-}" ]; then - if [ -n "${TMUX:-}" ]; then - LVL=$((SHLVL - 1)) - else - LVL="$SHLVL" - fi - if [ "$LVL" != 1 ]; then - color -c white "[$LVL] " - fi - fi -} - -timestamp() { - color -c blacki '\T' -} - -path() { - color -c yellowb '\w/' -} - -guix_env() { - if [ -n "${GUIX_ENVIRONMENT:-}" ]; then - printf '\n' - color -c blacki '~> ' - color -c purple 'guix environment ' - printf '(' - color -c blueb "$GUIX_ENVIRONMENT" - printf ')' - fi -} - -in_nix_shell() { - if [ -n "${IN_NIX_SHELL:-}" ]; then - printf '\n' - color -c blacki '~> ' - color -c purpleb "$IN_NIX_SHELL " - color -c purple 'nix-shell ' - printf '(' - color -c blueb "${name:-}" - printf ')' - fi -} - -PS1='`error_marker`'$(timestamp)' '$(path)' `shell_level``repo_status``guix_env``in_nix_shell` -$ ' - - -vcs_status() { - git status "$@" -} - -vcs_diff() { - git diff "$@" -} - -vcs_diff_staged() { - git diff --staged "$@" -} diff --git a/etc/sh/vcs-ps1.sh b/etc/sh/vcs-ps1.sh new file mode 100644 index 0000000..d18a24a --- /dev/null +++ b/etc/sh/vcs-ps1.sh @@ -0,0 +1,200 @@ +#!/bin/sh + +repo_status_git() { + BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" + OUT="$(git status --short --branch --porcelain)" + BRANCH_LINE="$(echo "$OUT" | head -n 1)" + DIFF_LINES="$(echo "$OUT" | tail -n +2)" + + IS_AHEAD=false + IS_BEHIND=false + if echo "$BRANCH_LINE" | grep -q 'ahead'; then + IS_AHEAD=true + fi + if echo "$BRANCH_LINE" | grep -q 'behind'; then + IS_BEHIND=true + fi + + LINE='' + + if [ "$IS_AHEAD" = true ] && [ "$IS_BEHIND" = true ]; then + LINE="^^^ $BRANCH_NAME vvv" + elif [ "$IS_AHEAD" = true ]; then + LINE="^ $BRANCH_NAME ^" + elif [ "$IS_BEHIND" = true ]; then + LINE="v $BRANCH_NAME v" + else + LINE="$BRANCH_NAME" + fi + + HAS_DIFF=false + HAS_UNTRACKED=false + if echo "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then + HAS_DIFF=true + fi + if echo "$DIFF_LINES" | grep -q '^[?][?]'; then + HAS_UNTRACKED=true + fi + + if [ "$HAS_DIFF" = true ]; then + COLOR_FN=redb + LINE="{$LINE}" + elif [ "$IS_AHEAD" = true ] || [ "$IS_BEHIND" = true ]; then + COLOR_FN=bluei + LINE="[$LINE]" + elif [ "$HAS_UNTRACKED" = true ]; then + COLOR_FN=lightblue + LINE="{$LINE}" + else + COLOR_FN=green + LINE="($LINE)" + fi + + color -c "$COLOR_FN" "$LINE" + + BRANCH_COUNT="$(git branch --list | wc -l)" + if [ "$BRANCH_COUNT" -gt 1 ]; then + color -c lightblue "<$BRANCH_COUNT>" + fi + + STASH_COUNT="$(git stash list | wc -l)" + if [ "$STASH_COUNT" != 0 ]; then + color -c red "*$STASH_COUNT" + fi + + color -c blacki " - git/$(git rev-parse HEAD)" +} + +repo_status_fossil() { + BRANCH_NAME="$(fossil branch current)" + + if [ -n "$(fossil extras)" ]; then + HAS_UNTRACKED=1 + fi + + BRANCH_MARKER="$BRANCH_NAME" + + if [ -n "${HAS_UNTRACKED:-}" ]; then + COLOR_FN=lightblue + LINE="($BRANCH_MARKER)" + else + COLOR_FN=green + LINE="($BRANCH_MARKER)" + fi + + color -c "$COLOR_FN" "$LINE" + + color -c blacki " - fossil/$(fossil info | awk '/^checkout:/ { print $2 }')" +} + +repo_status_mercurial() { + BRANCH_NAME="$(hg branch)" +} + +repo_status() { + dir="$(basename "$PWD")" + if [ -d .git ]; then + repo_status_git + elif [ -f "$dir.fossil" ]; then + repo_status_fossil + elif [ -d .hg ]; then + repo_status_mercurial + fi +} + + +error_marker() { + STATUS=$? + if [ "$STATUS" != 0 ]; then + color -c redb " (!! $STATUS !!) " + fi +} + +shell_status_level() { + if [ -n "${SHLVL:-}" ]; then + if [ -n "${TMUX:-}" ]; then + LVL=$((SHLVL - 1)) + else + LVL="$SHLVL" + fi + if [ "$LVL" != 1 ]; then + color -c white "$LVL" + if [ -n "${RANGER_LEVEL:-}" ]; then + color -c white '|' + color -c bluei 'r' + fi + fi + fi +} + +shell_status_jobs() { + JOBS="$(jobs -p | wc -l)" + if [ "$JOBS" != 0 ]; then + color -c red "$JOBS" + fi +} + +shell_status() { + LEVEL="$(shell_status_level)" + JOBS="$(shell_status_jobs)" + + if [ -z "$LEVEL" ] && [ -z "$JOBS" ]; then + return + fi + + color -c white '[' + printf '%s' "$LEVEL" + if [ -n "$LEVEL" ] && [ -n "$JOBS" ]; then + color -c white '|' + fi + printf '%s' "$JOBS" + color -c white ']' + printf ' ' +} + +timestamp() { + color -c blacki '\T' +} + +path() { + color -c yellowb '\w/' +} + +guix_env() { + if [ -n "${GUIX_ENVIRONMENT:-}" ]; then + printf '\n' + color -c blacki '~> ' + color -c purple 'guix environment ' + printf '(' + color -c blueb "$GUIX_ENVIRONMENT" + printf ')' + fi +} + +in_nix_shell() { + if [ -n "${IN_NIX_SHELL:-}" ]; then + printf '\n' + color -c blacki '~> ' + color -c purpleb "$IN_NIX_SHELL " + color -c purple 'nix-shell ' + printf '(' + color -c blueb "${name:-}" + printf ')' + fi +} + +PS1='`error_marker`'$(timestamp)' '$(path)' `shell_status``repo_status``guix_env``in_nix_shell` +$ ' + + +vcs_status() { + git status "$@" +} + +vcs_diff() { + git diff "$@" +} + +vcs_diff_staged() { + git diff --staged "$@" +} -- cgit v1.2.3 From 9acc1779b0d46d52f23d8e1fbfc3eac005423430 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:06:14 -0300 Subject: mv etc/bash/privrc.sh etc/sh/privrc.sh --- etc/bash/privrc.sh | 1 - etc/sh/privrc.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 120000 etc/bash/privrc.sh create mode 120000 etc/sh/privrc.sh diff --git a/etc/bash/privrc.sh b/etc/bash/privrc.sh deleted file mode 120000 index f946f34..0000000 --- a/etc/bash/privrc.sh +++ /dev/null @@ -1 +0,0 @@ -../../var/lib/private/tilde/privrc.sh \ No newline at end of file diff --git a/etc/sh/privrc.sh b/etc/sh/privrc.sh new file mode 120000 index 0000000..f946f34 --- /dev/null +++ b/etc/sh/privrc.sh @@ -0,0 +1 @@ +../../var/lib/private/tilde/privrc.sh \ No newline at end of file -- cgit v1.2.3 From a30883a7b8227c0687bae6de3626c2b220e746c5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:06:50 -0300 Subject: mv etc/bash/check.sh etc/sh/check.sh --- etc/bash/check.sh | 74 ---------------------------------------------------- etc/sh/check.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 74 deletions(-) delete mode 100755 etc/bash/check.sh create mode 100755 etc/sh/check.sh diff --git a/etc/bash/check.sh b/etc/bash/check.sh deleted file mode 100755 index 5c410c8..0000000 --- a/etc/bash/check.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - check.sh - check.sh -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -cd -- "$(dirname -- "$0")" -cd -- "$(git rev-parse --show-toplevel)" - -shellcheck -xe 1090,1091 \ - "$XDG_CONFIG_HOME"/bash/rc \ - "$XDG_CONFIG_HOME"/bash/vcs-ps1.sh \ - "$XDG_CONFIG_HOME"/bash/check.sh \ - "$XDG_CONFIG_HOME"/bash/privrc.sh \ - "$XDG_CONFIG_HOME"/notmuch/default/hooks/post-new - -if git grep FIXME -- ":(exclude)$XDG_CONFIG_HOME/bash/check.sh"; then - printf 'Leftover FIXME markers\n' >&2 - exit 1 -fi - -if ! git diff --quiet || ! git diff --quiet --staged; then - printf 'Dirty tilde repository.\n' >&2 - exit 1 -fi - -PRIV="$XDG_CONFIG_HOME/../var/lib/private/tilde" -if ! git -C "$PRIV" diff --quiet || ! git -C "$PRIV" diff --quiet --staged; then - printf 'Dirty private tilde repository.\n' >&2 - exit 1 -fi diff --git a/etc/sh/check.sh b/etc/sh/check.sh new file mode 100755 index 0000000..102fcd0 --- /dev/null +++ b/etc/sh/check.sh @@ -0,0 +1,77 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + check.sh + check.sh -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +cd -- "$(dirname -- "$0")" +cd -- "$(git rev-parse --show-toplevel)" + +shellcheck -xe 1090,1091 \ + "$XDG_CONFIG_HOME"/sh/rc \ + "$XDG_CONFIG_HOME"/sh/vcs-ps1.sh \ + "$XDG_CONFIG_HOME"/sh/check.sh \ + "$XDG_CONFIG_HOME"/sh/privrc.sh \ + "$XDG_CONFIG_HOME"/notmuch/default/hooks/post-new + +if git grep FIXME -- ":(exclude)$XDG_CONFIG_HOME/bash/check.sh"; then + printf 'Leftover FIXME markers\n' >&2 + exit 1 +fi + +if ! git diff --quiet || ! git diff --quiet --staged; then + printf 'Dirty tilde repository.\n' >&2 + exit 1 +fi + +PRIV="$XDG_CONFIG_HOME/../var/lib/private/tilde" +if ! git -C "$PRIV" diff --quiet || ! git -C "$PRIV" diff --quiet --staged; then + printf 'Dirty private tilde repository.\n' >&2 + exit 1 +fi + +# FIXME: +# verify that the expiry date on the GPG key is greater than 1 year -- cgit v1.2.3 From f21322e8eace723af864dd93af5ae481d6908a8d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:07:13 -0300 Subject: etc/ranger/rc.conf: Add key bindings --- etc/ranger/rc.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/ranger/rc.conf b/etc/ranger/rc.conf index ed2b538..2f1d9c9 100644 --- a/etc/ranger/rc.conf +++ b/etc/ranger/rc.conf @@ -1 +1,4 @@ map DD shell trash %s +map XX shell rm -rf %s +map scroll_preview 1 +map scroll_preview -1 -- cgit v1.2.3 From 4d813084363593037f3d0aaa93916730901dc529 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:09:52 -0300 Subject: etc/{bash => sh}/rc: Separate Bash-specific code, remove unused code --- etc/bash/rc | 341 ------------------------------------------------------------ etc/sh/rc | 295 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 295 insertions(+), 341 deletions(-) delete mode 100644 etc/bash/rc create mode 100644 etc/sh/rc diff --git a/etc/bash/rc b/etc/bash/rc deleted file mode 100644 index 1cfd404..0000000 --- a/etc/bash/rc +++ /dev/null @@ -1,341 +0,0 @@ -#!/bin/sh - -ln -fs .profile ~/.bashrc -export ENV=~/.profile - -XDG_PREFIX=~/.usr -export XDG_CACHE_HOME="$XDG_PREFIX/var/cache" -export XDG_CONFIG_HOME="$XDG_PREFIX/etc" -export XDG_DATA_HOME="$XDG_PREFIX/share" -export XDG_STATE_HOME="$XDG_PREFIX/state" -export XDG_LOG_HOME="$XDG_PREFIX/var/log" -export XDG_DATA_DIRS="$XDG_DATA_HOME/flatpak/exports/share:/var/lib/flatpak/exports/share${XDG_DATA_DIRS:+:}${XDG_DATA_DIRS:-}" - - -mkdir -p \ - "$XDG_CONFIG_HOME" \ - "$XDG_CACHE_HOME" \ - "$XDG_DATA_HOME" \ - "$XDG_STATE_HOME" \ - "$XDG_LOG_HOME" - -GUIX_PROFILE="$XDG_CONFIG_HOME"/guix/current -if [ -e "$GUIX_PROFILE"/etc/profile ]; then - . "$GUIX_PROFILE"/etc/profile -fi - -HISTSIZE=-1 -HISTFILE="$XDG_STATE_HOME/bash-history" -HISTCONTROL=ignorespace:ignoredups - -export SRC=~/dev -export EDITOR='vi' -export VISUAL="$EDITOR" -export PAGER='less -R' -export BROWSER='firefox' -export MAILDIR=~/Maildir -export BACKLIGHT_DEVICE='acpi_video0' - -export GUILE_HISTORY="$XDG_STATE_HOME/guile-history" -export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" -export INPUTRC="$XDG_CONFIG_HOME/bash/inputrc" -export RLWRAP_HOME="$XDG_CACHE_HOME/rlwrap" -export LESSHISTFILE="$XDG_STATE_HOME/lesshst" -export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/default/config" -export PASSWORD_STORE_DIR="$SRC/others/password-store" -export MAILCAPS="$XDG_CONFIG_HOME/mailcaps/config" -export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc.py" -export EXINIT=' - " set number - set autoindent - set ruler - set showmode - set showmatch -' - -HOSTNAME="$(hostname)" -export BORG_PASSCOMMAND="pass show $HOSTNAME/borg/passphrase" -export BORG_REPO="suyin:borg/$HOSTNAME" -export BORG_REMOTE_PATH='borg1' - -N_PROCS=$(($(nproc) * 2 + 1)) -export MAKEFLAGS="-j $N_PROCS" -export GOPATH="$SRC/go" -export CFLAGS='-std=c99 -Wall -Wextra -Wpedantic -g -flto -Werror' -export CC=tcc -export AR=gcc-ar -export LEX=flex -export LDFLAGS='-flto' -export LISP='sbcl --eval' - -add_prefix() { - export C_INCLUDE_PATH="$1/include${C_INCLUDE_PATH:+:}${C_INCLUDE_PATH:-}" - export LIBRARY_PATH="$1/lib${LIBRARY_PATH:+:}${LIBRARY_PATH:-}" - export INFOPATH="$1/share/info${INFOPATH:+:}${INFOPATH:-}" - export MANPATH="$1/share/man${MANPATH:+:}${MANPATH:-}" - export PATH="$1/bin${PATH:+:}${PATH:-}" -} -export PREFIX="$XDG_PREFIX/var/mkg" -add_prefix "$PREFIX" - -export PATH="$XDG_PREFIX/bin:$PREFIX/bin:$HOME/dev/libre/website/bin:$PATH" - -# FIXME -export GUILE_LOAD_PATH="$HOME/dev/libre/servers/src/infrastructure/lib:$GUILE_LOAD_PATH" - - -# -# Aliases -# - -unalias -a - -alias r='reload' -alias rr='rreload' - -alias p='ping euandre.org -c 3' -alias c='tmux send-keys -R \; clear-history' -alias o='open' -alias mm='msmtp-queue -r' -alias s='vcs_status' -alias d='vcs_diff' -alias ds='vcs_diff_staged' - -alias mk='make clean && make dev-check' -alias wmk='aux/with-container "make clean && make dev-check"' -alias tt='mk && wmk' -alias todos='make public && open public/TODOs.html' -alias valgrind='valgrind --show-error-list=yes --show-leak-kinds=all --leak-check=full --track-origins=yes --error-exitcode=1' -alias check='sh "$XDG_CONFIG_HOME"/bash/check.sh' - -alias l='ls -lahF --color' -alias grep='grep --color=auto' -alias diff='diff --color=auto' -alias watch='watch --color ' -alias man='MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man' -alias less='less -R' -alias tree='tree -C' -alias make='make -e' -alias mv='mv -i' -alias rm='rm -i' - -alias sqlite='rlwrap sqlite3' -alias sbcl='rlwrap sbcl' -alias perl='rlwrap perl' -alias guile='guile -l "$XDG_CONFIG_HOME"/guile/init.scm' - -alias flush='sync && echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null' - - - -# -# PS1 -# - -. "$XDG_CONFIG_HOME"/bash/vcs-ps1.sh - - - -# FIXME: fix "history" commands -# g '^\w.*json_destroy(' -g() { - # shellcheck disable=2086 - fn=$(git grep -n -- "$1" ${2:-} | \ - cut -d: -f -2 | \ - fzf --select-1 \ - --exit-0 \ - --preview "echo {} | \ - cut -d: -f1 | \ - xargs -I% awk -v bounds=25 -v pat=\"$1\" -v n=\$(echo {} | cut -d: -f2) ' - (n - bounds < NR) && (NR < n + bounds) && (NR != n) { print } - NR==n { gsub(pat, \"\033[1;33m&\033[1;000m\"); print } - ' %") - if [ -n "$fn" ]; then - f="$(echo "$fn" | cut -d: -f1)" - n="$(echo "$fn" | cut -d: -f2)" - # shellcheck disable=2068 - history -s g "$@" - history -s vi "+$n" "$f" - vi "+$n" "$f" - fi -} - -f() { - # FIXME: speed - # profile="f-shell-function$(pwd | sed -e 's_/_-_g')" - # file="$(git ls-files | grep ${2:-.} | remembering -p "$profile" -c "fzf --select-1 --exit-0 --preview 'cat {}'")" - # shellcheck disable=2086 - file="$(git ls-files | grep ${2:-.} | fzf --select-1 --exit-0 --preview 'cat {}')" - if [ -n "$file" ]; then - # shellcheck disable=2068 - history -s f "$@" - history -s "$1" "$file" - "$1" "$file" - fi -} - -v() { - V_FILES="$( - cat <<-EOF | sed "s|$HOME|~|" - ~/Documents/txt/TODOs.md - ~/Documents/txt/scratch.txt - $XDG_CONFIG_HOME/bash/rc - $XDG_CONFIG_HOME/guix/home.scm - $XDG_CONFIG_HOME/guix/system.scm - $(find ~/Documents/txt/*.md -not -name TODOs.md | - sed "s|^$HOME|~|" | - LANG=POSIX.UTF-8 sort) - ~/dev/libre/package-repository/dependencies.dot - ~/dev/others/dinheiros/dinheiros.ledger - ~/dev/libre/dotfiles/sh/fake-symlinks.sh - $XDG_CONFIG_HOME/guix/channels.scm - EOF - )" - f="$(echo "$V_FILES" | fzf --select-1 --exit-0 --query "$1")" - if [ -n "$f" ]; then - history -s v "$@" - history -s vi "$f" - sh -c "vi $f" - fi -} - -cn() { - CHOICE="$(git log --oneline | fzf)" - git log --oneline | grep -nF "$CHOICE" | cut -d: -f1 -} - -cm() { - n="$(cn)" - git rev-parse "HEAD~$((n - 1))" -} - - - -deps() { - cd ~/dev/libre/package-repository/ || return 1 - rm -f public/dependencies.svg - make public/dependencies.svg > /dev/null - if [ "${1:-}" != '-q' ]; then - open public/dependencies.svg - fi - cd - > /dev/null || return 1 -} -(deps -q &) 2>/dev/null - -rdeps() { - echo ~/dev/libre/package-repository/dependencies.dot | - entr -cs '. ~/.profile' -} - -re() { - if [ "$1" = -h ]; then - echo "Usage: re 's/foo/bar/g' [FILES]" - return - fi - SEPARATOR="$(echo "$1" | cut -c2)" - REGEX="$(echo "$1" | cut -d"$SEPARATOR" -f2)" - if [ -n "${2:-}" ]; then - git grep -l "$REGEX" | xargs -I% sh -c "sed '$1' % | sponge %" - else - sed "$1" "$2" | sponge "$2" - fi -} - -container_dump() { - TARGET_NAME="$(basename "$PWD")" - OUT="$(mktemp -d)" - cp "$(./aux/guix/with-container.sh -C)" "$OUT/docker.tar.gz" - cd "$OUT" || exit 1 - tar xvf docker.tar.gz - # FIXME: Remove doas - doas docker tag \ - "$(doas docker load < docker.tar.gz | grep latest | cut -d: -f2)" \ - "$TARGET_NAME" -} - -svg() { - guix graph "$1" | dot -Tsvg > "$1".svg - open "$1".svg -} - -serve() { - open http://localhost:8000 - if [ -d public ]; then - python3 -m http.server -d public - else - python3 -m http.server - fi -} - -reload() { - . ~/.profile -} - -rreload() { - reload - xset r rate 225 100 # FIXME: move xorg conf - scp \ - ~/dev/libre/package-repository/public/dependencies.svg \ - kuvira:/opt/www/euandreh.xyz/static/package-repository/ -} - -tpd() { - D="$(mkdtemp)" - cd "$D" || return 1 -} - -m() { - notmuch new - mbsync EuAndreh & - mbsync EuAndrehXYZ & - mbsync Nubank & - wait - notmuch new -} - -_edit_without_executing() { - F="$(mkstemp)" - printf '%s\n' "$READLINE_LINE" > "$F" - "${VISUAL:-${EDITOR:-vi}}" "$F" - READLINE_LINE="$(cat "$F")" - READLINE_POINT="${#READLINE_LINE}" - rm -f "$F" -} - -if set -o | grep 'on' | grep -Eq '^(vi|emacs)'; then - bind -x '"\C-x\C-e":_edit_without_executing' -fi - -eval "$(direnv hook bash)" - - - -# -# GPG and SSH agents configuration -# - -SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) -GPG_TTY=$(tty) -export GPG_TTY SSH_AUTH_SOCK -gpgconf --launch gpg-agent -gpg --export-ssh-key eu@euandre.org > "$XDG_CONFIG_HOME"/ssh/id_rsa.pub -chmod 600 "$XDG_CONFIG_HOME"/ssh/id_rsa.pub - - -stty -ixon # Disable C-s/C-q mode - - -if [ -e "$XDG_CONFIG_HOME"/bash/privrc.sh ]; then - # Extra rc code to be loaded, stored in private repository - . "$XDG_CONFIG_HOME"/bash/privrc.sh -fi - -case $- in - *i*) - for f in "$HOME_ENVIRONMENT"/profile/etc/bash_completion.d/*; do - . "$f" - done - ;; - *) - ;; -esac diff --git a/etc/sh/rc b/etc/sh/rc new file mode 100644 index 0000000..1838961 --- /dev/null +++ b/etc/sh/rc @@ -0,0 +1,295 @@ +#!/bin/sh + +export ENV=~/.profile + +export XDG_PREFIX=~/.usr +export XDG_CACHE_HOME="$XDG_PREFIX/var/cache" +export XDG_CONFIG_HOME="$XDG_PREFIX/etc" +export XDG_DATA_HOME="$XDG_PREFIX/share" +export XDG_STATE_HOME="$XDG_PREFIX/state" +export XDG_LOG_HOME="$XDG_PREFIX/var/log" +export XDG_DATA_DIRS="$XDG_DATA_HOME/flatpak/exports/share:/var/lib/flatpak/exports/share${XDG_DATA_DIRS:+:}${XDG_DATA_DIRS:-}" + + +mkdir -p \ + "$XDG_CONFIG_HOME" \ + "$XDG_CACHE_HOME" \ + "$XDG_DATA_HOME" \ + "$XDG_STATE_HOME" \ + "$XDG_LOG_HOME" \ + "$XDG_CACHE_HOME/euandreh" \ + "$XDG_DATA_HOME/euandreh" \ + "$XDG_STATE_HOME/euandreh" \ + "$XDG_LOG_HOME/euandreh" + +GUIX_PROFILE="$XDG_CONFIG_HOME"/guix/current +if [ -e "$GUIX_PROFILE"/etc/profile ]; then + . "$GUIX_PROFILE"/etc/profile +fi + +# FIXME +idempotent_path_add() { + case "$(eval "echo \$$1")" in + *"$2"*) + ;; + *) + eval "export $1=$2\${$1:+:}\${$1:-}" + ;; + esac +} +export A="$HOME${A:+:}${A:-}" +idempotent_path_add B "$HOME" +export XDG_DATA_DIRS="$XDG_DATA_HOME/flatpak/exports/share:/var/lib/flatpak/exports/share${XDG_DATA_DIRS:+:}${XDG_DATA_DIRS:-}" +# idempotent_path_add XDG_DATA_DIRS "$XDG_DATA_HOME/flatpak/exports/share" + + + +# +# +# + +export HISTSIZE=-1 +export HISTFILE="$XDG_STATE_HOME/sh-history" +export SRC=~/dev +export EDITOR='e' +export VISUAL="$EDITOR" +export PAGER='less -R' +export BROWSER='firefox' +export MAILDIR=~/Maildir +export BACKLIGHT_DEVICE='acpi_video0' + +export GUILE_HISTORY="$XDG_STATE_HOME/guile-history" +export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" +export RLWRAP_HOME="$XDG_CACHE_HOME/rlwrap" +export LESSHISTFILE="$XDG_STATE_HOME/lesshst" +export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/default/config" +export PASSWORD_STORE_DIR="$SRC/private/password-store" +export MAILCAPS="$XDG_CONFIG_HOME/mailcaps/config" +export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc.py" +export EXINIT=' + " set number + " set autoindent + set ruler + set showmode + set showmatch +' + +HOSTNAME="$(hostname)" +export BORG_PASSCOMMAND="pass show $HOSTNAME/borg/passphrase" +export BORG_REPO="suyin:borg/$HOSTNAME" +export BORG_REMOTE_PATH='borg1' + +N_PROCS=$(($(nproc) * 2 + 1)) +GUILE_EFFECTIVE_VERSION="$(guile -c '(display (effective-version))')" +export MAKEFLAGS="-j $N_PROCS" +export GOPATH="$SRC/go" +export CFLAGS='-std=c99 -Wall -Wextra -Wpedantic -g -flto -Werror' +export CC=gcc +export AR=gcc-ar +export LEX=flex +export LDFLAGS='-flto' +export LISP='sbcl --eval' +export N_PROCS GUILE_EFFECTIVE_VERSION + +add_prefix() { + export GUILE_LOAD_PATH="$1/share/guile/site/$GUILE_EFFECTIVE_VERSION${GUILE_LOAD_PATH:+:}${GUILE_LOAD_PATH:-:}" + export GUILE_LOAD_COMPILED_PATH="$1/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}${GUILE_LOAD_COMPILED_PATH:-}" + export C_INCLUDE_PATH="$1/include${C_INCLUDE_PATH:+:}${C_INCLUDE_PATH:-}" + export LIBRARY_PATH="$1/lib${LIBRARY_PATH:+:}${LIBRARY_PATH:-}" + export INFOPATH="$1/share/info${INFOPATH:+:}${INFOPATH:-}" + export MANPATH="$1/share/man${MANPATH:+:}${MANPATH:-}" + export PATH="$1/bin${PATH:+:}${PATH:-}" +} +export PREFIX="$XDG_PREFIX/var/mkg" +add_prefix "$PREFIX" +add_prefix "$XDG_PREFIX" + + + +# +# Aliases +# + +unalias -a + +alias r='reload' +alias rr='rreload' + +alias p='ping euandre.org -c 3' +alias c='tmux send-keys -R \; clear-history' +alias o='open' +alias mm='msmtp-queue -r' +alias s='vcs_status' +alias d='vcs_diff' +alias ds='vcs_diff_staged' +alias check='sh "$XDG_CONFIG_HOME"/sh/check.sh' +alias tpd='cd "$(mkdtemp)"' + +alias l='ls -lahF --color' +alias grep='grep --color=auto' +alias diff='diff --color=auto' +alias watch='watch --color ' +alias man='MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man' +alias less='less -R' +alias tree='tree -aC' +alias make='make -e' +alias mv='mv -i' +alias rm='rm -i' +alias vi='echo "Use \"e\" instead."; false' + +alias sqlite='rlwrap sqlite3' +alias sbcl='rlwrap sbcl' +alias perl='rlwrap perl' +alias guile='guile -l "$XDG_CONFIG_HOME"/guile/init.scm' + +alias flush='sync && echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null' + + + +# +# PS1 +# + +. "$XDG_CONFIG_HOME"/sh/vcs-ps1.sh + + + +# FIXME: fix "history" commands +# g '^\w.*json_destroy(' +g() { + # shellcheck disable=2086 + fn=$(git grep -n -- "$1" ${2:-} | \ + cut -d: -f -2 | \ + fzf --select-1 \ + --exit-0 \ + --preview "echo {} | \ + cut -d: -f1 | \ + xargs -I% awk -v bounds=25 -v pat=\"$1\" -v n=\$(echo {} | cut -d: -f2) ' + (n - bounds < NR) && (NR < n + bounds) && (NR != n) { print } + NR==n { gsub(pat, \"\033[1;33m&\033[1;000m\"); print } + ' %") + if [ -n "$fn" ]; then + f="$(echo "$fn" | cut -d: -f1)" + n="$(echo "$fn" | cut -d: -f2)" + # shellcheck disable=2068 + # history -s g "$@" + # history -s vi "+$n" "$f" + # vi "+$n" "$f" + history -s g "$@" + history -s e "+$n" "$f" + e "+$n" "$f" + fi +} + +f() { + # FIXME: speed + # profile="f-shell-function$(pwd | sed -e 's_/_-_g')" + # file="$(git ls-files | grep ${2:-.} | remembering -p "$profile" -c "fzf --select-1 --exit-0 --preview 'cat {}'")" + # shellcheck disable=2086 + file="$(git ls-files | grep ${2:-.} | fzf --select-1 --exit-0 --preview 'cat {}')" + if [ -n "$file" ]; then + # shellcheck disable=2068 + history -s f "$@" + history -s "$1" "$file" + "$1" "$file" + fi +} + +cat <<-EOF | sed "s|$HOME|~|" > "$XDG_DATA_HOME"/euandreh/e.list.txt + ~/Documents/txt/TODOs.md + ~/Documents/txt/scratch.txt + $XDG_CONFIG_HOME/sh/rc + $XDG_CONFIG_HOME/guix/home.scm + $XDG_CONFIG_HOME/guix/system.scm + $(find ~/Documents/txt/*.md -not -name TODOs.md | + sed "s|^$HOME|~|" | + LANG=POSIX.UTF-8 sort) + ~/dev/libre/package-repository/dependencies.dot + ~/dev/others/dinheiros/dinheiros.ledger + ~/dev/libre/dotfiles/sh/fake-symlinks.sh + $XDG_CONFIG_HOME/guix/channels.scm +EOF + + + +reload() { + . ~/.profile +} + +rreload() { + reload + echo 'pactl load-module module-echo-cancel' + xset r rate 225 100 # FIXME: move xorg conf +} + +_edit_without_executing() { + F="$(mkstemp)" + printf '%s\n' "$READLINE_LINE" > "$F" + e "$F" + READLINE_LINE="$(cat "$F")" + READLINE_POINT="${#READLINE_LINE}" + rm -f "$F" +} +if set -o | grep 'on' | grep -Eq '^(vi|emacs)'; then + bind -x '"\C-x\C-e":_edit_without_executing' +fi + + + + +# +# GPG and SSH agents configuration +# + +SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) +GPG_TTY=$(tty) +export GPG_TTY SSH_AUTH_SOCK +gpgconf --launch gpg-agent +gpg --export-ssh-key eu@euandre.org > "$XDG_CONFIG_HOME"/ssh/id_rsa.pub +chmod 600 "$XDG_CONFIG_HOME"/ssh/id_rsa.pub + + +PUB_GPG_FILES=" +$HOME/dev/libre/package-repository/EuAndreh.key +$HOME/dev/published/euandre.org/public.asc +" +for f in $PUB_GPG_FILES; do + gpg --armour --export eu@euandre.org > $f +done + + +stty -ixon # Disable C-s/C-q mode + +F="$XDG_CONFIG_HOME"/sh/privrc.sh +if [ -e "$F" ]; then + # Extra rc code to be loaded, stored in private repository + . "$F" +fi + + + + +# +# From here on, bash-specific things. +# + +if [ -z "$BASH_VERSION" ]; then + return +fi + +ln -fs .profile ~/.bashrc + +export INPUTRC="$XDG_CONFIG_HOME/bash/inputrc" +export HISTCONTROL=ignorespace:ignoredups + +eval "$(direnv hook bash)" + +case $- in + *i*) + for f in "$HOME_ENVIRONMENT"/profile/etc/bash_completion.d/*; do + . "$f" + done + ;; + *) + ;; +esac -- cgit v1.2.3 From 0d67bb682377c02a0d25584c512bc8e9f56a8b6c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:14:53 -0300 Subject: etc/i3/config: Simplify and settle --- etc/i3/config | 54 +++++++++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/etc/i3/config b/etc/i3/config index fbde61e..d91c95c 100644 --- a/etc/i3/config +++ b/etc/i3/config @@ -9,60 +9,57 @@ font pango:DejaVu Sans Mono 8 # Start XDG autostart .desktop files using dex. See also # https://wiki.archlinux.org/index.php/XDG_Autostart -exec --no-startup-id dex --autostart --environment i3 +# exec --no-startup-id dex --autostart --environment i3 # The combination of xss-lock, nm-applet and pactl is a popular choice, so # they are included here as an example. Modify as you see fit. # xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the # screen before suspend. Use loginctl lock-session to lock your screen. -exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork +exec xss-lock --transfer-sleep-lock -- i3lock --nofork # NetworkManager is the most popular way to manage wireless networks on Linux, # and nm-applet is a desktop environment-independent system tray GUI for it. -exec --no-startup-id nm-applet -exec --no-startup-id blueman-applet -exec --no-startup-id poweralertd +exec nm-applet +exec blueman-applet +exec poweralertd exec dunst # Use pactl to adjust volume in PulseAudio. set $refresh_i3status killall -SIGUSR1 i3status -bindsym F1 exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status -bindsym F2 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status -bindsym F3 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status +bindsym F1 exec volume toggle && $refresh_i3status +bindsym F2 exec volume down && $refresh_i3status +bindsym F3 exec volume up && $refresh_i3status +bindsym $mod+Shift+s exec volume rotate && $refresh_i3status -# FIXME paths in ~/.cache -bindsym F4 exec --no-startup-id playerctl --player=`cat ~/.usr/var/cache/euandreh-mpris-player.txt` position 5- -bindsym Shift+F4 exec --no-startup-id playerctl --player=`cat ~/.usr/var/cache/euandreh-mpris-player.txt` previous -bindsym F5 exec --no-startup-id playerctl --player=`cat ~/.usr/var/cache/euandreh-mpris-player.txt` play-pause -Bindsym Shift+F5 exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/rotate-mpris-player.sh -bindsym F6 exec --no-startup-id playerctl --player=`cat ~/.usr/var/cache/euandreh-mpris-player.txt` position 5+ -bindsym Shift+F6 exec --no-startup-id playerctl --player=`cat ~/.usr/var/cache/euandreh-mpris-player.txt` next +bindsym F4 exec player backward +bindsym Shift+F4 exec player previous +bindsym F5 exec player play-pause +Bindsym Shift+F5 exec player rotate +bindsym F6 exec player forward +bindsym Shift+F6 exec player next -# FIXME bad path -bindsym F7 exec --no-startup-id ~/.usr/bin/brightness -1 -bindsym F8 exec --no-startup-id ~/.usr/bin/brightness +1 +bindsym F7 exec brightness -1 +bindsym F8 exec brightness +1 -bindsym $mod+Shift+s exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/toggle-pulseaudio-sink.sh && $refresh_i3status # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod -bindsym $mod+Return exec st +bindsym $mod+Return exec st bindsym $mod+Shift+q kill -bindsym $mod+p exec --no-startup-id dmenu_run -# FIXME: better placement of these files -bindsym $mod+o exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-emoji.sh -bindsym $mod+v exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-clipmenu.sh -bindsym $mod+i exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass.sh -bindsym $mod+Control+i exec --no-startup-id ~/dev/libre/dotfiles/xmonad/scripts/dmenu-pass-login.sh +bindsym $mod+p exec menu bin +bindsym $mod+o exec menu emoji +bindsym $mod+v exec menu clipboard +bindsym $mod+i exec menu password +bindsym $mod+Control+i exec menu username @@ -82,8 +79,7 @@ bindsym $mod+Shift+l move right # bindsym $mod+h split h # what is this? # split in vertical orientation -# FIXME: what is this? It was in conflict with dmenu-clipmenu -# bindsym $mod+v split v +bindsym $mod+Shift+v split v # enter fullscreen mode for the focused container bindsym $mod+f fullscreen toggle @@ -180,7 +176,7 @@ bindsym $mod+r mode "resize" # finds out, if available) bar { position top - status_command i3status + status_command i3status | status-bar } default_border pixel -- cgit v1.2.3 From fb97ac86e9ab1acc365fdd40ebf3f806e8b6f1d3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:15:39 -0300 Subject: etc/i3status/config: Add "general" section --- etc/i3status/config | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etc/i3status/config b/etc/i3status/config index 7bc854e..8099a2f 100644 --- a/etc/i3status/config +++ b/etc/i3status/config @@ -1,3 +1,8 @@ +general { + output_format = "i3bar" + colors = true +} + order += "wireless _first_" order += "battery all" order += "disk /" -- cgit v1.2.3 From ec190678bdaba821e2128d3211b959634766eaee Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:16:03 -0300 Subject: etc/tmux/tmux.conf: Add navigation keybindings --- etc/tmux/tmux.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/tmux/tmux.conf b/etc/tmux/tmux.conf index 708feef..f2da33b 100644 --- a/etc/tmux/tmux.conf +++ b/etc/tmux/tmux.conf @@ -15,6 +15,10 @@ bind-key r source-file $XDG_CONFIG_HOME/tmux/tmux.conf \; display-message "$XDG_ bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xclip -selection clipboard -i" \; bind-key y send-keys -X copy-pipe "xclip -selection clipboard -i" \; display-message "Copied system clipboard! Hooray! Long-live tmux!" +# Moving around windows +bind-key -n M-[ previous-window +bind-key -n M-] next-window + # Moving around panes bind-key -n M-h select-pane -L bind-key -n M-j select-pane -D -- cgit v1.2.3 From 32cb9707c3b49adf26c0bc22e28cbebfa868007f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:16:47 -0300 Subject: etc/ssh/known_hosts: Add camarada.site entry --- etc/ssh/known_hosts | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/ssh/known_hosts b/etc/ssh/known_hosts index ad6b0b2..0ee722e 100644 --- a/etc/ssh/known_hosts +++ b/etc/ssh/known_hosts @@ -72,3 +72,4 @@ git.2f30.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSLZ4G5w4NysBUmAHmr6/V9om42IHS [2001:19f0:6801:988:5400:3ff:fea1:b566]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 [gerrit.wikimedia.org]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCF8pwFLehzCXhbF1jfHWtd9d1LFq2NirplEBQYs7AOrGwQ/6ZZI0gvZFYiEiaw1o+F1CMfoHdny1VfWOJF3mJ1y9QMKAacc8/Z3tG39jBKRQCuxmYLO1SWymv7/Uvx9WQlkNRoTdTTa9OJFy6UqvLQEXKYaokfMIUHZ+oVFf1CgQ== 2001:19f0:5:1d65:5400:3ff:fee3:7463 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF2EgU3IgCwv1ynnWfxFm0SHTSoE0AYG3MJT/TpN3pBz +[camarada.site]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 -- cgit v1.2.3 From 46d741799c2e6c097c21a5bf74707c925e1257be Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:23:40 -0300 Subject: bin/bins: Add helper utility for listing binaries --- bin/bins | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 bin/bins diff --git a/bin/bins b/bin/bins new file mode 100755 index 0000000..28e92f1 --- /dev/null +++ b/bin/bins @@ -0,0 +1,73 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + bins + bins -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + List the available binaries in $PATH. The result is cached on + the $XDG_CACHE_HOME/euandreh/bins file if $PATH values didn't + change. + + + Examples: + + Pick an executable using `dmenu`: + + $ bins | dmenu + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND- 1)) + + +F="$XDG_CACHE_HOME/euandreh/bins" + +IFS=: +if stest -rdq -n "$F" $PATH; then + trap "rm -f $F-tmp" EXIT + stest -lxf $PATH | sort -u > "$F"-tmp + mv "$F"-tmp "$F" +fi + +cat "$F" -- cgit v1.2.3 From 04ae127133b5feef16afdc4035f29f7f43c80da3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:27:17 -0300 Subject: etc/sh/rc: Load noise cancelling in system.scm --- etc/guix/system.scm | 11 +++++++++++ etc/sh/rc | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index b568d66..dff97aa 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -9,6 +9,7 @@ (gnu services cups) (gnu services desktop) (gnu services security-token) + (gnu services sound) (gnu services virtualization) (gnu services xorg) (gnu system keyboard) @@ -98,6 +99,16 @@ EndSection "#))))) (modify-services %desktop-services + (pulseaudio-service-type config => + (pulseaudio-configuration + (inherit config) + (extra-script-files + (list + (plain-file + "noise-cancelling.pa" + #"- + load-module module-echo-cancel + "#))))) (guix-service-type config => (guix-configuration (inherit config) diff --git a/etc/sh/rc b/etc/sh/rc index 1838961..ded663b 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -218,7 +218,6 @@ reload() { rreload() { reload - echo 'pactl load-module module-echo-cancel' xset r rate 225 100 # FIXME: move xorg conf } -- cgit v1.2.3 From c115c7acf19ba14afa00ee0874ae194d623a42ff Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:27:37 -0300 Subject: etc/guix/system.scm: Add pt_BR.UTF-8 locale to system --- etc/guix/system.scm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index dff97aa..75d59d9 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -14,6 +14,7 @@ (gnu services xorg) (gnu system keyboard) (gnu system file-systems) + (gnu system locale) (gnu system mapped-devices) (guix gexp) (guix packages) @@ -28,6 +29,13 @@ (initrd microcode-initrd) (firmware (list linux-firmware)) (locale "fr_FR.UTF-8") + (locale-definitions + (append + (list + (locale-definition + (name "pt_BR.UTF-8") + (source "pt_BR"))) + %default-locale-definitions)) (timezone "America/Sao_Paulo") (keyboard-layout (keyboard-layout "br" #:options '("caps:swapescape" "esperanto:qwerty"))) -- cgit v1.2.3 From 618c8003f04c9c559709ea6d1312202e0ed6d3a5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:28:11 -0300 Subject: etc/guix/system.scm: Add Haskell and Guile code for base desktop system --- etc/guix/system.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 75d59d9..e187bcf 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -61,7 +61,11 @@ (map (compose list specification->package+output symbol->string) '(nss-certs i3-wm - xmonad-next)) + xmonad-next + ghc-xmonad-contrib + ghc + guile + guile-heredoc-latest)) (list) (remove (lambda (package) (equal? "wget" (package-name package))) -- cgit v1.2.3 From 2e375a05fd236d6b827e9746240ff322ead52914 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:28:56 -0300 Subject: etc/guix/home.scm: Fix s1: prefix --- etc/guix/home.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 2fca54d..0ef9f3f 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -149,8 +149,8 @@ "/" s)))) (map (lambda (t) - (list (prefix-with-config (first t)) - (second t))) + (list (prefix-with-config (s1:first t)) + (s1:second t))) config-files))) -- cgit v1.2.3 From e4209c358275ea08c2e6f77cda9cafb1844aeff1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:29:18 -0300 Subject: etc/guix/home.scm: Update path to "my-profile" --- etc/guix/home.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 0ef9f3f..42edf2f 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -351,6 +351,6 @@ (services (list (simple-service 'my-shell-profile home-shell-profile-service-type - (list (plain-file "my-profile" ". ~/.usr/etc/bash/rc"))) + (list (plain-file "my-profile" ". ~/.usr/etc/sh/rc"))) (simple-service 'config-files home-files-service-type dot-config) (simple-service 'home-cron home-mcron-service-type cronjobs)))) -- cgit v1.2.3 From e368c42d3a73c9793ca5d939842dff8f8b25d96b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 19:31:14 -0300 Subject: etc/guix/home.scm: Add a bunch of packages For: - basic desktop usage; - improving my workflow; - compiling projects from source. --- etc/guix/home.scm | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 42edf2f..94521d4 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -193,10 +193,15 @@ git:gui git-open git-remote-gcrypt + git-lfs mercurial fossil + darcs subversion cvs + rcs + cssc + quilt gnupg rsync @@ -210,12 +215,39 @@ pinentry-gtk2 bmake make + autoconf + automake + libtool + pcre + pcre2 + avahi + libgcrypt + qbe + cproc + doxygen + gperf + readline + gmp + help2man + libtomcrypt + libtommath + lz4 + lokke + meson + ninja + sparse + ant + mpc + maven + libgcrypt + pkg-config fzf ranger blueman pavucontrol ledger curl + curl:doc xclip cloc strace @@ -237,6 +269,8 @@ gettext lilypond groff + ghostscript + texlive jq recutils units @@ -248,6 +282,14 @@ powertop md4c timidity++ + cmark + cmake + makefile2graph + po4a-text + mdpo-patched + + cryptsetup + btrfs-progs flatpak @@ -255,14 +297,32 @@ sqlite clojure + clojure-tools openjdk perl + perl-critic + perl-json perl-mojolicious + perl-regexp-grammars + perl-commonmark + perl-aliased + ruby python python-slixmpp + python-unidecode + python-yubikey-manager + python-coverage + python-pytest + python-requests + python-beautifulsoup4 + python-docx + python-telegram-bot + python-docutils valgrind + flex + bison gcc-toolchain - clang + clang-toolchain tcc node quickjs @@ -270,13 +330,10 @@ go xrandr arandr + openssl st i3status - xmobar - ghc - ghc-xmonad-contrib - xmonad xmessage dmenu clipmenu @@ -291,7 +348,7 @@ imagemagick ffmpeg pandoc - ;; mktorrent-latest + mktorrent-latest jekyll flac mediainfo @@ -301,6 +358,12 @@ zenity util-linux guile + ;; git-permalink + ;; remembering + ;; guile-heredoc + ;; td + ;; walk + guile-heredoc-latest gzip xz bzip2 @@ -311,6 +374,7 @@ less nano patch + youtube-dl poezio freetalk @@ -318,6 +382,7 @@ profanity newsboat mpv-mpris + vlc poweralertd keepassxc @@ -337,7 +402,10 @@ frescobaldi libreoffice rhythmbox + quodlibet + calibre ungoogled-chromium + anki ;; FIXME, Qt version not working properly firefox)) (list msmtp-non-hardcoded isync-with-options -- cgit v1.2.3 From 0c5766bf44260f4a37cc90e69ca63710178631b3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 20:40:24 -0300 Subject: bin/{with-,}email: Add "Examples" section to help string --- bin/email | 10 ++++++++++ bin/with-email | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/bin/email b/bin/email index dcfdfa4..3c72086 100755 --- a/bin/email +++ b/bin/email @@ -18,6 +18,16 @@ help() { ADDRESS the email addresses to send the email to BODY the text to be sent as the body + + + Send an email to ADDRESS using BODY. + + + Examples: + + Send 10 numbers to mail@example.com: + + $ seq 10 | email -s number mail@email.com EOF } diff --git a/bin/with-email b/bin/with-email index 9d6326b..dc2a022 100755 --- a/bin/with-email +++ b/bin/with-email @@ -17,6 +17,21 @@ help() { -h, --help show this message COMMAND the command to be wrapped + + + Executes COMMAND and send all of its output via email + to eu@euandre.org. + + + Examples: + + Run a script and use the default subject: + + $ with-email -- ./script + + Run a command and use a custom subject: + + $ with-email -s 'CRONJOB' echo 123 EOF } -- cgit v1.2.3 From a79c3d3c803bc2df2b3d31a02f25710810317ecc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 23:45:58 -0300 Subject: etc/guix/home.scm: Setup working cronjobs --- bin/with-email | 14 +++-------- etc/guix/home.scm | 50 +++++++++++++++++++++++++++++---------- etc/sh/check.sh | 9 +++---- etc/sh/cronjob.sh | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ etc/sh/rc | 14 +++++++---- 5 files changed, 126 insertions(+), 31 deletions(-) create mode 100755 etc/sh/cronjob.sh diff --git a/bin/with-email b/bin/with-email index dc2a022..7df101a 100755 --- a/bin/with-email +++ b/bin/with-email @@ -69,15 +69,7 @@ while getopts 's:h' flag; do done shift $((OPTIND - 1)) -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -assert_arg "${1:-}" 'COMMAND...' +eval "$(assert-arg "${1:-}" 'COMMAND...')" now() { date '+%Y-%m-%dT%H:%M:%S%Z' @@ -90,10 +82,10 @@ OUT="$(mkstemp)" printf '\n' STATUS=0 - "$@" 2>&1 || STATUS=$? + "$@" || STATUS=$? printf '\n' printf '\nFinished at: %s\n' "$(now)" -} 2>&1 1>"$OUT" +} 1>"$OUT" 2>&1 email -s "(exit status: $STATUS) - $SUBJECT" eu@euandre.org < "$OUT" diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 94521d4..b43e8ec 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -1,4 +1,5 @@ (use-modules + ((ice-9 textual-ports) #:prefix textual-ports:) ((xyz euandreh heredoc) #:prefix heredoc:) (gnu home) (gnu home services) @@ -16,6 +17,7 @@ (gnu packages version-control) (gnu packages video) (gnu services) + (guix build-system trivial) (guix gexp) (guix modules) (guix packages) @@ -154,18 +156,41 @@ config-files))) +(define (slurp name) + (string-trim-both + (call-with-input-file + name + textual-ports:get-string-all))) + +(define (script name content) + (package + (name name) + (version "latest") + (source #f) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let* ((bin (string-append %output "/bin")) + (prog (string-append bin "/" ,name))) + (mkdir-p bin) + (call-with-output-file prog + (lambda (port) + (format port "~a" ,content))) + (chmod prog #o755))))) + (home-page "") + (synopsis "") + (description "") + (license #f))) + (define cronjobs - '() - #; (list - ;; FIXME - #~(job "* * * * *" "echo foi > ~/foi") - #~(job "* * * * *" "backup -h 2>&1 > ~/bk") - #~(job "* * * * *" "which backup -h 2>&1 > ~/which-bk") - #~(job "* * * * *" "echo $PATH 2>&1 > ~/path") - #~(job "* * * * *" "echo 123") - #~(job "* * * * *" "echo 123 > k") - #~(job "* * * * *" "date > ~/job"))) + #~(job "0 * * * *" "cronjob msmtp-queue -r") + #~(job "5 * * * *" "cronjob m") + #~(job "30 1 * * *" "cronjob backup cron"))) + (home-environment (packages @@ -362,7 +387,6 @@ ;; remembering ;; guile-heredoc ;; td - ;; walk guile-heredoc-latest gzip xz @@ -415,7 +439,9 @@ myrepos-with-options texinfo-with-options mpv-with-options - openssh-with-options))) + openssh-with-options + (script "cronjob" (slurp (string-append (getenv "XDG_CONFIG_HOME") + "/sh/cronjob.sh")))))) (services (list (simple-service 'my-shell-profile home-shell-profile-service-type diff --git a/etc/sh/check.sh b/etc/sh/check.sh index 102fcd0..07e9e66 100755 --- a/etc/sh/check.sh +++ b/etc/sh/check.sh @@ -51,10 +51,11 @@ cd -- "$(dirname -- "$0")" cd -- "$(git rev-parse --show-toplevel)" shellcheck -xe 1090,1091 \ - "$XDG_CONFIG_HOME"/sh/rc \ - "$XDG_CONFIG_HOME"/sh/vcs-ps1.sh \ - "$XDG_CONFIG_HOME"/sh/check.sh \ - "$XDG_CONFIG_HOME"/sh/privrc.sh \ + "$XDG_CONFIG_HOME"/sh/rc \ + "$XDG_CONFIG_HOME"/sh/vcs-ps1.sh \ + "$XDG_CONFIG_HOME"/sh/check.sh \ + "$XDG_CONFIG_HOME"/sh/privrc.sh \ + "$XDG_CONFIG_HOME"/sh/cronjob.sh \ "$XDG_CONFIG_HOME"/notmuch/default/hooks/post-new if git grep FIXME -- ":(exclude)$XDG_CONFIG_HOME/bash/check.sh"; then diff --git a/etc/sh/cronjob.sh b/etc/sh/cronjob.sh new file mode 100755 index 0000000..950430f --- /dev/null +++ b/etc/sh/cronjob.sh @@ -0,0 +1,70 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + cronjob COMMAND... + cronjob -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + COMMAND the command to be executed + + + Execute the given command, and send the output to email, with + special treatment to the status code. + + It loads the appropriate files, so that the actual cron + declaration is smaller. + + + Examples: + + Run a backup: + + $ cronjob backup cron + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +. ~/.usr/etc/sh/rc +CMD="$@" +with-email -s "$CMD" -- "$@" 1>>"$XDG_LOG_HOME"/euandreh/mcron.log 2>&1 diff --git a/etc/sh/rc b/etc/sh/rc index ded663b..e1eb992 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -38,7 +38,7 @@ idempotent_path_add() { esac } export A="$HOME${A:+:}${A:-}" -idempotent_path_add B "$HOME" +# idempotent_path_add B "$HOME" export XDG_DATA_DIRS="$XDG_DATA_HOME/flatpak/exports/share:/var/lib/flatpak/exports/share${XDG_DATA_DIRS:+:}${XDG_DATA_DIRS:-}" # idempotent_path_add XDG_DATA_DIRS "$XDG_DATA_HOME/flatpak/exports/share" @@ -241,7 +241,7 @@ fi # SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) -GPG_TTY=$(tty) +GPG_TTY=$(tty ||:) export GPG_TTY SSH_AUTH_SOCK gpgconf --launch gpg-agent gpg --export-ssh-key eu@euandre.org > "$XDG_CONFIG_HOME"/ssh/id_rsa.pub @@ -253,11 +253,17 @@ $HOME/dev/libre/package-repository/EuAndreh.key $HOME/dev/published/euandre.org/public.asc " for f in $PUB_GPG_FILES; do - gpg --armour --export eu@euandre.org > $f + gpg --armour --export eu@euandre.org > "$f" done -stty -ixon # Disable C-s/C-q mode +case $- in + *i*) + stty -ixon # Disable C-s/C-q mode + ;; + *) + ;; +esac F="$XDG_CONFIG_HOME"/sh/privrc.sh if [ -e "$F" ]; then -- cgit v1.2.3 From 6e0f138b5e884d4c6777cd6636a9c6b1762776f6 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 23:46:59 -0300 Subject: etc/guix/system.scm: Setup unattended-upgrade --- etc/guix/system.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index e187bcf..a4fbfac 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -5,6 +5,7 @@ (gnu bootloader grub) (gnu packages) (gnu packages wm) + (gnu services admin) (gnu services base) (gnu services cups) (gnu services desktop) @@ -78,6 +79,7 @@ (service gnome-desktop-service-type) (service libvirt-service-type) (service virtlog-service-type) + (service unattended-upgrade-service-type) (service cups-service-type (cups-configuration (web-interface? #t))) -- cgit v1.2.3 From cd8e69e39847ac0a8a5a0a6ba63551b588feb868 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:23:50 -0300 Subject: etc/guix/home.scm: Add cronjob to run "check" --- etc/guix/home.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index b43e8ec..499a2cb 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -187,9 +187,10 @@ (define cronjobs (list - #~(job "0 * * * *" "cronjob msmtp-queue -r") - #~(job "5 * * * *" "cronjob m") - #~(job "30 1 * * *" "cronjob backup cron"))) + #~(job "0 * * * *" "cronjob msmtp-queue -r") + #~(job "0 */6 * * *" "cronjob check") + #~(job "5 */6 * * *" "cronjob m") + #~(job "30 1 * * *" "cronjob backup cron"))) (home-environment -- cgit v1.2.3 From f44857cedd5d4fdc2065baa2fa0344af5011a43c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:27:02 -0300 Subject: bin/e: Avoid infinite recursion by checking if $EDITOR is already "e" --- bin/e | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/e b/bin/e index b163eda..dc7b47d 100755 --- a/bin/e +++ b/bin/e @@ -65,6 +65,9 @@ shift $((OPTIND - 1)) CMD="${VISUAL:-${EDITOR:-vi}}" +if [ "$CMD" = 'e' ]; then + CMD='vi' +fi if [ ! -t 0 ]; then F="$(mkstemp)" -- cgit v1.2.3 From 49038f920dd077b10b11bed929b3d259ca3a773e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:28:26 -0300 Subject: etc/sh/cronjob.sh: Satisfy ShellCheck --- etc/sh/cronjob.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/sh/cronjob.sh b/etc/sh/cronjob.sh index 950430f..80b48b4 100755 --- a/etc/sh/cronjob.sh +++ b/etc/sh/cronjob.sh @@ -66,5 +66,5 @@ shift $((OPTIND - 1)) . ~/.usr/etc/sh/rc -CMD="$@" +CMD="$*" with-email -s "$CMD" -- "$@" 1>>"$XDG_LOG_HOME"/euandreh/mcron.log 2>&1 -- cgit v1.2.3 From 3fb6d53765902599e2106a504568c49719bd8f6f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:28:42 -0300 Subject: bin/grun: Improve help string --- bin/grun | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/grun b/bin/grun index 4b6217d..cfd6b52 100755 --- a/bin/grun +++ b/bin/grun @@ -13,8 +13,8 @@ help() { cat <<-'EOF' Options: - -r RECIPIENT the recipient to encrypt to. Can be given - multiple for multiple recipients. + -r RECIPIENT the recipient to encrypt to. Can be provided + multiple times for multiple recipients. -h, --help show this message COMMAND A command to be executed, that accepts input @@ -29,7 +29,7 @@ help() { $ grun secrets.txt.gpg -- vipe - Delete lines containing "TODO" in todos.gpg: + Delete lines containing "TODO" in todos.gpg for specific keys: $ grun -r ABC123DEF321 todos.gpg -- sed '/TODO/d' -- cgit v1.2.3 From 71ac64824affb7474007e81507a91bb266028072 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:31:41 -0300 Subject: bin/m: Add working utility --- bin/m | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 bin/m diff --git a/bin/m b/bin/m new file mode 100755 index 0000000..43b1ad6 --- /dev/null +++ b/bin/m @@ -0,0 +1,64 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + m + m -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + Fetch email via IMAP and update the notmuch index. + + + Examples: + + Just fetch email + + $ m + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +notmuch new +mbsync -a +notmuch new -- cgit v1.2.3 From ed38917a1ec50fd064181bb06052a4390248432c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:32:13 -0300 Subject: bin/dice: Add working utility --- bin/dice | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 bin/dice diff --git a/bin/dice b/bin/dice new file mode 100755 index 0000000..93556a5 --- /dev/null +++ b/bin/dice @@ -0,0 +1,66 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + dice [SIZE] + dice -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + SIZE the size of the dice (default: 6) + + + Examples: + + Roll a dice of size 6: + + $ dice + + Roll a D20: + + $ dice 20 + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +SIZE="${1:-6}" +echo $(((RANDOM % SIZE) + 1)) -- cgit v1.2.3 From b439292af329a493ec1f9d12f691dfa66fbe13eb Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:32:30 -0300 Subject: bin/forever: Add working utility --- bin/forever | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 bin/forever diff --git a/bin/forever b/bin/forever new file mode 100755 index 0000000..9d2556f --- /dev/null +++ b/bin/forever @@ -0,0 +1,66 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + forever -- COMMAND... + forever -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + Run COMMAND forever. + + + Examples: + + Print 123 forever: + + $ forever echo 123 + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +eval "$(assert-arg "${1:-}" 'COMMAND')" + + +while true; do + "$@" +done -- cgit v1.2.3 From 68f724fb62520a75c536bd15dc10ea8ca0811680 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:34:32 -0300 Subject: bin/git-cleanup: Add working utility --- bin/git-cleanup | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 bin/git-cleanup diff --git a/bin/git-cleanup b/bin/git-cleanup new file mode 100755 index 0000000..4196cff --- /dev/null +++ b/bin/git-cleanup @@ -0,0 +1,74 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + git cleanup [REMOTE] + git cleanup -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + REMOTE the remote to prune the remote tracking + branches from (default: origin) + + + Delete merged branches, both local and remote-tracking. + + + Examples: + + Cleanup branches from "origin": + + $ git cleanup + + + Delete branches from "upstream": + + $ git cleanup upstream + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +REMOTE="${1:-origin}" + +git branch --merged | + grep -v -e '^\*' -e '^. main$' | + xargs git branch -d + +git remote prune "$REMOTE" -- cgit v1.2.3 From 5f8d2e81350c326b31be12731e120efbbd6e9c16 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:40:52 -0300 Subject: bin/{uc,lc}: Add working utilities --- bin/lc | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/uc | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100755 bin/lc create mode 100755 bin/uc diff --git a/bin/lc b/bin/lc new file mode 100755 index 0000000..111b91b --- /dev/null +++ b/bin/lc @@ -0,0 +1,70 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + lc + lc -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + Transforms text from STDIN from upper-case to lower-case. It is + the equivalent of running 'tr [:upper:] [:lower:]'. + + + Examples: + + Normalize to lower-case: + + $ echo EuAndreh | lc + euandreh + + + Keep the text as-is: + + $ echo andreh | lc + andreh + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +tr '[:upper:]' '[:lower:]' diff --git a/bin/uc b/bin/uc new file mode 100755 index 0000000..e8bd9fb --- /dev/null +++ b/bin/uc @@ -0,0 +1,70 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + uc + uc -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + Transforms text from STDIN from upper-case to lower-case. It is + the equivalent of running 'tr [:lower:] [:upper:]'. + + + Examples: + + Normalize to lower-case: + + $ echo EuAndreh | uc + EUANDREH + + + Keep the text as-is: + + $ echo ANDREH | uc + ANDREH + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +tr '[:lower:]' '[:upper:]' -- cgit v1.2.3 From dbfaa8e6174c2076e61244c344c82303d80db1ae Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:41:23 -0300 Subject: bin/n-times: Add working utility --- bin/n-times | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 bin/n-times diff --git a/bin/n-times b/bin/n-times new file mode 100755 index 0000000..4fa8b96 --- /dev/null +++ b/bin/n-times @@ -0,0 +1,73 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + n-times COUNT -- COMMAND... + n-times -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + COUNT the number of times for COMMAND to be executed + + + Examples: + + Print 123 5 times: + + $ n-times 5 echo 123 + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +COUNT="${1:-}" +shift + +eval "$(assert-arg "$COUNT" 'COUNT')" + + +while true; do + if [ "$COUNT" = 0 ]; then + break + fi + COUNT=$((COUNT - 1)) + "$@" +done -- cgit v1.2.3 From b0deea1e8b9bbefe3772cc8e1eedded2b5f85811 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:42:48 -0300 Subject: bin/untill: Add working utility --- bin/untill | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100755 bin/untill diff --git a/bin/untill b/bin/untill new file mode 100755 index 0000000..403717f --- /dev/null +++ b/bin/untill @@ -0,0 +1,83 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + until [-n SECONDS] -- COMMAND... + until -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -n SECONDS the amount of seconds to sleep between + attempts (default: 60) + -h, --help show this message + + + Runs COMMAND until it eventually succeeds. Sleep SECONDS + between attempts. + + + Examples: + + Try flaky build until it succeeds: + + $ until guix home build home.scm + + + Try to build until a new version is successfull, + waiting 30 seconds between attempts: + + $ until -n 30 -- x git pull AND make + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +_SECONDS=60 +while getopts 'n:h' flag; do + case "$flag" in + n) + _SECONDS="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +ATTEMPT=1 +while true; do + printf 'Attempt %s.\n' "$ATTEMPT" >&2 + ATTEMPT=$((ATTEMPT + 1)) + if "$@"; then + break + fi + sleep "$_SECONDS" +done -- cgit v1.2.3 From c043cecbf8c28e1a26f940ec49dad59b833e5388 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 09:48:49 -0300 Subject: bin/gen-password: Add working utility --- bin/gen-password | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 bin/gen-password diff --git a/bin/gen-password b/bin/gen-password new file mode 100755 index 0000000..b59213c --- /dev/null +++ b/bin/gen-password @@ -0,0 +1,73 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + gen-password [LENGTH] + gen-password -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + LENGTH the length of the generated password + (default: 999) + + + Generate a random password, and emit it to STDOUT. + + + Examples: + + Create a file with a secret: + + $ gen-password > secret.txt + + + Generate an absurdly long secret: + + $ gen-password 9999 > giant-secret.txt + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +LENGTH="${1:-999}" + +tr -cd '[:alnum:]' < /dev/random | + fold -w "$LENGTH" | + head -n1 -- cgit v1.2.3 From 7c489dda6dca8cc904b3bfec32d078e49dbfc115 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 10:20:32 -0300 Subject: bin/httpno: Add working utility --- bin/httpno | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100755 bin/httpno diff --git a/bin/httpno b/bin/httpno new file mode 100755 index 0000000..0e8d66f --- /dev/null +++ b/bin/httpno @@ -0,0 +1,150 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + httpno [NUMBER|TEXT] + httpno -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + NUMBER the number of the HTTP status code + TEXT the text of the description of the status code + + + Print the given status code, or list them all when no arguments + are given. + + + Examples: + + Get the status code 404: + + $ httpno 404 + 404 Not Found + + + Get the status code for "created": + + $ httpno created + 201 Created + + + List all statuses: + + $ httpno + ... + EOF +} + +DATA() { + awk 'd == 1 { print; next } /^__DATA__$/ { d = 1 }' "$0" +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +if [ $# -eq 0 ]; then + DATA +else + DATA | grep -i "$@" +fi + + +exit +__DATA__ +100 Continue +101 Switching Protocols +102 Processing +200 OK +201 Created +202 Accepted +203 Non-Authoritative Information +204 No Content +205 Reset Content +206 Partial Content +207 Multi-Status +208 Already Reported +300 Multiple Choices +301 Moved Permanently +302 Found +303 See Other +304 Not Modified +305 Use Proxy +307 Temporary Redirect +400 Bad Request +401 Unauthorized +402 Payment Required +403 Forbidden +404 Not Found +405 Method Not Allowed +406 Not Acceptable +407 Proxy Authentication Required +408 Request Timeout +409 Conflict +410 Gone +411 Length Required +412 Precondition Failed +413 Request Entity Too Large +414 Request-URI Too Large +415 Unsupported Media Type +416 Request Range Not Satisfiable +417 Expectation Failed +418 I'm a teapot +420 Blaze it +422 Unprocessable Entity +423 Locked +424 Failed Dependency +425 No code +426 Upgrade Required +428 Precondition Required +429 Too Many Requests +431 Request Header Fields Too Large +449 Retry with +500 Internal Server Error +501 Not Implemented +502 Bad Gateway +503 Service Unavailable +504 Gateway Timeout +505 HTTP Version Not Supported +506 Variant Also Negotiates +507 Insufficient Storage +509 Bandwidth Limit Exceeded +510 Not Extended +511 Network Authentication Required -- cgit v1.2.3 From a0188f38d8a9702dd3d7119375173d063a5f28bc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 10:58:10 -0300 Subject: bin/: Replace usage of assert_arg with assert-arg --- bin/email | 15 ++------------- bin/grun | 12 ++---------- bin/msg | 16 ++++------------ bin/pre | 10 +--------- bin/prompt | 10 +--------- bin/rfc | 10 +--------- bin/without-env | 13 +++---------- 7 files changed, 14 insertions(+), 72 deletions(-) diff --git a/bin/email b/bin/email index 3c72086..c16ed62 100755 --- a/bin/email +++ b/bin/email @@ -64,19 +64,8 @@ while getopts 's:h' flag; do done shift $((OPTIND - 1)) -assert_arg() { - if [ -z "$1" ]; then - { - printf 'Missing %s.\n' "$2" - printf '\n' - usage - } >&2 - exit 2 - fi -} - -assert_arg "${SUBJECT:-}" '-s SUBJECT' -assert_arg "${1:-}" 'ADDRESS' +eval "$(assert-arg "${SUBJECT:-}" '-s SUBJECT')" +eval "$(assert-arg "${1:-}" 'ADDRESS')" printf 'Subject: %s\n\n%s' \ "$(echo "$SUBJECT" | tr -d '\n')" \ diff --git a/bin/grun b/bin/grun index cfd6b52..982420a 100755 --- a/bin/grun +++ b/bin/grun @@ -71,16 +71,8 @@ while getopts 'rh' flag; do done shift $((OPTIND - 1)) -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - FILENAME="${1:-}" -assert_arg "$FILENAME" 'FILENAME' +eval "$(assert-arg "$FILENAME" 'FILENAME')" shift if [ "${1:-}" != '--' ]; then @@ -90,7 +82,7 @@ if [ "${1:-}" != '--' ]; then fi shift -assert_arg "${1:-}" 'COMMAND' +eval "$(assert-arg "${1:-}" 'COMMAND')" if [ ! -e "$FILENAME" ]; then diff --git a/bin/msg b/bin/msg index ad0b608..f685ffb 100755 --- a/bin/msg +++ b/bin/msg @@ -124,31 +124,23 @@ fi MESSAGE="${1:-}" -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s.\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - if [ "$XMPP" = true ]; then - assert_arg "$MESSAGE" '-X MESSAGE' + eval "$(assert-arg "$MESSAGE" '-X MESSAGE')" xmpp -m "$MESSAGE" eu@euandreh.xyz & fi if [ "$SOUND" = true ]; then sound & fi if [ "$SPEAK" = true ]; then - assert_arg "$MESSAGE" '-S MESSAGE' + eval "$(assert-arg "$MESSAGE" '-S MESSAGE')" echo "$MESSAGE" | speak -v pt-BR & fi if [ "$MAIL" = true ]; then - assert_arg "$MESSAGE" '-m MESSAGE' + eval "$(assert-arg "$MESSAGE" '-m MESSAGE')" echo " " | email -s "$MESSAGE" eu@euandre.org & fi if [ "$DESKTOP" = true ]; then - assert_arg "$MESSAGE" '-D MESSAGE' + eval "$(assert-arg "$MESSAGE" '-D MESSAGE')" if [ "$OK" = true ]; then notify-send -t 5000 "$MESSAGE" & else diff --git a/bin/pre b/bin/pre index 233ac1a..79c212f 100755 --- a/bin/pre +++ b/bin/pre @@ -52,16 +52,8 @@ while getopts 'c:h' flag; do done shift $((OPTIND - 1)) -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - PREFIX="${1:-}" -assert_arg "$PREFIX" 'PREFIX' +eval "$(assert-arg "$PREFIX" 'PREFIX')" while read -r line; do if [ -z "$COLOR" ]; then diff --git a/bin/prompt b/bin/prompt index a191238..68dff61 100755 --- a/bin/prompt +++ b/bin/prompt @@ -23,14 +23,6 @@ help() { EOF } -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s.\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - for flag in "$@"; do case "$flag" in @@ -63,7 +55,7 @@ done shift $((OPTIND - 1)) STRING="${1:-}" -assert_arg "$STRING" 'STRING' +eval "$(assert-arg "$STRING" 'STRING')" printf '%s' "$STRING" printf ' [Y/n]: ' diff --git a/bin/rfc b/bin/rfc index e0da425..bd8fb67 100755 --- a/bin/rfc +++ b/bin/rfc @@ -86,14 +86,6 @@ check_local_db() { fi } -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s.\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - for flag in "$@"; do case "$flag" in @@ -141,7 +133,7 @@ if [ "${UPDATE:-}" = true ]; then exit fi -assert_arg "$RFC_NUMBER" +eval "$(assert-arg "$RFC_NUMBER")" if [ ! -e "$F" ]; then printf 'Given RFC_NUMBER "%s" does not exist at:\n%s\n' \ diff --git a/bin/without-env b/bin/without-env index 45c41ca..4f8fb14 100755 --- a/bin/without-env +++ b/bin/without-env @@ -57,16 +57,9 @@ while getopts 'h' flag; do done shift $((OPTIND - 1)) -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n' "$2" >&2 - exit 2 - fi -} - -assert_arg "${1:-}" 'ENVVAR' -assert_arg "${2:-}" 'PATH' -assert_arg "${3:-}" '--' +eval "$(assert-arg "${1:-}" 'ENVVAR')" +eval "$(assert-arg "${2:-}" 'PATH')" +eval "$(assert-arg "${3:-}" '--')" eval "export $1=\"\$(echo \"\$$1\" | sed \"s|\$2:||g\")\"" shift # drop $1 -- cgit v1.2.3 From 1f1f6a13224a988d02cf862bd1bf02c137837271 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 11:54:50 -0300 Subject: bin/password: Delete in favor of gen-password --- bin/gen-password | 2 +- bin/password | 57 -------------------------------------------------------- 2 files changed, 1 insertion(+), 58 deletions(-) delete mode 100755 bin/password diff --git a/bin/gen-password b/bin/gen-password index b59213c..327858f 100755 --- a/bin/gen-password +++ b/bin/gen-password @@ -16,7 +16,7 @@ help() { -h, --help show this message LENGTH the length of the generated password - (default: 999) + (default: 999) Generate a random password, and emit it to STDOUT. diff --git a/bin/password b/bin/password deleted file mode 100755 index 718ba1c..0000000 --- a/bin/password +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - password [LENGTH] - password -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - LENGTH the size of the password (default: 99) - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -LENGTH="${1-99}" -tr -cd '[:alnum:]' < /dev/random | - fold -w "$LENGTH" | - head -n1 | - tr -d '\n' -- cgit v1.2.3 From 0843b4ee6beb63bc4b06090f2d88d7825e738b1b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 12:39:58 -0300 Subject: bin/menu: Add working utility --- bin/menu | 1571 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1571 insertions(+) create mode 100755 bin/menu diff --git a/bin/menu b/bin/menu new file mode 100755 index 0000000..242c7c0 --- /dev/null +++ b/bin/menu @@ -0,0 +1,1571 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + menu + menu -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + ACTION one of: + - emoji + - username + - password + - bin + - clipboard + - yubikey + + + Lauch an interactive GUI menu for various desktop activities, to + be launched manually or via desktop keybindings. + + + Examples: + + Choose and copy the password to the clipboard: + + $ menu password + + + Execute a binary available in $PATH: + + $ menu bin + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) +ACTION="${1:-}" + +eval "$(assert-arg "$ACTION" 'ACTION')" + + +DATA() { + awk 'd == 1 { print; next } /^__DATA__$/ { d = 1 }' "$0" +} + +show() { + dmenu -i -l 20 -fn Monospace-18 -p "$1:" +} + +pass_list() { + walk "$PASSWORD_STORE_DIR" | + grep '\.gpg$' | + sor 'test -f' | + sed -e "s|^$PASSWORD_STORE_DIR/||" \ + -e 's|\.gpg$||' | + LANG=POSIX.UTF-8 sort +} + +case "$ACTION" in + emoji) + DATA | show 'emoji' | awk '{print $(NF)}' | copy -n + ;; + username) + CHOICE="$(pass_list | show 'username')" + if [ -n "$CHOICE" ]; then + if pass show -c2 "$CHOICE"; then + notify-send -t 5000 -u normal -- "$CHOICE" \ + 'username copied to clipboard' + fi + fi + ;; + password) + CHOICE="$(pass_list | show 'password')" + if [ -n "$CHOICE" ]; then + echo trap 'clipctl enable' EXIT # FIXME + echo clipctl disable + if pass show -c1 "$CHOICE"; then + notify-send -t 5000 -u critical -- "$CHOICE" \ + 'password copied to clipboard' + fi + fi + ;; + bin) + bins | show 'bins' | sh + ;; + clipboard) + clipmgr -l | show 'clipboard' | copy + ;; + yubikey) + echo 'yubikey-oath-dmenu' # FIXME + exit 2 + ;; + *) + printf 'Bad ACTION: %s.\n\n' "$ACTION" >&2 + usage >&2 + exit 2 + ;; +esac + + + +exit +__DATA__ +grinning face 😀 +smiling face with open mouth 😃 +smiling face with open mouth & smiling eyes 😄 +grinning face with smiling eyes 😁 +smiling face with open mouth & closed eyes 😆 +smiling face with open mouth & cold sweat 😅 +face with tears of joy 😂 +rolling on the floor laughing 🤣 +smiling face ☺️ +smiling face with smiling eyes 😊 +smiling face with halo 😇 +slightly smiling face 🙂 +upside-down face 🙃 +winking face 😉 +relieved face 😌 +smiling face with heart-eyes 😍 +face blowing a kiss 😘 +kissing face 😗 +kissing face with smiling eyes 😙 +kissing face with closed eyes 😚 +face savouring delicious food 😋 +face with stuck-out tongue & winking eye 😜 +face with stuck-out tongue & closed eyes 😝 +face with stuck-out tongue 😛 +money-mouth face 🤑 +hugging face 🤗 +nerd face 🤓 +smiling face with sunglasses 😎 +clown face 🤡 +cowboy hat face 🤠 +smirking face 😏 +unamused face 😒 +disappointed face 😞 +pensive face 😔 +worried face 😟 +confused face 😕 +slightly frowning face 🙁 +frowning face ☹️ +persevering face 😣 +confounded face 😖 +tired face 😫 +weary face 😩 +face with steam from nose 😤 +angry face 😠 +pouting face 😡 +face without mouth 😶 +neutral face 😐 +expressionless face 😑 +hushed face 😯 +frowning face with open mouth 😦 +anguished face 😧 +face with open mouth 😮 +astonished face 😲 +dizzy face 😵 +flushed face 😳 +face screaming in fear 😱 +fearful face 😨 +face with open mouth & cold sweat 😰 +crying face 😢 +disappointed but relieved face 😥 +drooling face 🤤 +loudly crying face 😭 +face with cold sweat 😓 +sleepy face 😪 +sleeping face 😴 +face with rolling eyes 🙄 +thinking face 🤔 +lying face 🤥 +grimacing face 😬 +zipper-mouth face 🤐 +nauseated face 🤢 +sneezing face 🤧 +face with medical mask 😷 +face with thermometer 🤒 +face with head-bandage 🤕 +smiling face with horns 😈 +angry face with horns 👿 +ogre 👹 +goblin 👺 +pile of poo 💩 +ghost 👻 +skull 💀 +skull and crossbones ☠️ +alien 👽 +alien monster 👾 +robot face 🤖 +jack-o-lantern 🎃 +smiling cat face with open mouth 😺 +grinning cat face with smiling eyes 😸 +cat face with tears of joy 😹 +smiling cat face with heart-eyes 😻 +cat face with wry smile 😼 +kissing cat face with closed eyes 😽 +weary cat face 🙀 +crying cat face 😿 +pouting cat face 😾 +open hands 👐 +raising hands 🙌 +clapping hands 👏 +folded hands 🙏 +handshake 🤝 +thumbs up 👍 +thumbs down 👎 +oncoming fist 👊 +raised fist ✊ +left-facing fist 🤛 +right-facing fist 🤜 +crossed fingers 🤞 +victory hand ✌️ +sign of the horns 🤘 +OK hand 👌 +backhand index pointing left 👈 +backhand index pointing right 👉 +backhand index pointing up 👆 +backhand index pointing down 👇 +index pointing up ☝️ +raised hand ✋ +raised back of hand 🤚 +raised hand with fingers splayed 🖐 +vulcan salute 🖖 +waving hand 👋 +call me hand 🤙 +flexed biceps 💪 +middle finger 🖕 +writing hand ✍️ +selfie 🤳 +nail polish 💅 +ring 💍 +lipstick 💄 +kiss mark 💋 +mouth 👄 +tongue 👅 +ear 👂 +nose 👃 +footprints 👣 +eye 👁 +eyes 👀 +speaking head 🗣 +bust in silhouette 👤 +busts in silhouette 👥 +baby 👶 +boy 👦 +girl 👧 +man 👨 +woman 👩 +blond-haired woman 👱‍♀ +blond-haired person 👱 +old man 👴 +old woman 👵 +man with Chinese cap 👲 +woman wearing turban 👳‍♀ +person wearing turban 👳 +woman police officer 👮‍♀ +police officer 👮 +woman construction worker 👷‍♀ +construction worker 👷 +woman guard 💂‍♀ +guard 💂 +woman detective 🕵️‍♀️ +detective 🕵 +woman health worker 👩‍⚕ +man health worker 👨‍⚕ +woman farmer 👩‍🌾 +man farmer 👨‍🌾 +woman cook 👩‍🍳 +man cook 👨‍🍳 +woman student 👩‍🎓 +man student 👨‍🎓 +woman singer 👩‍🎤 +man singer 👨‍🎤 +woman teacher 👩‍🏫 +man teacher 👨‍🏫 +woman factory worker 👩‍🏭 +man factory worker 👨‍🏭 +woman technologist 👩‍💻 +man technologist 👨‍💻 +woman office worker 👩‍💼 +man office worker 👨‍💼 +woman mechanic 👩‍🔧 +man mechanic 👨‍🔧 +woman scientist 👩‍🔬 +man scientist 👨‍🔬 +woman artist 👩‍🎨 +man artist 👨‍🎨 +woman firefighter 👩‍🚒 +man firefighter 👨‍🚒 +woman pilot 👩‍✈ +man pilot 👨‍✈ +woman astronaut 👩‍🚀 +man astronaut 👨‍🚀 +woman judge 👩‍⚖ +man judge 👨‍⚖ +Mrs. Claus 🤶 +Santa Claus 🎅 +princess 👸 +prince 🤴 +bride with veil 👰 +man in tuxedo 🤵 +baby angel 👼 +pregnant woman 🤰 +woman bowing 🙇‍♀ +person bowing 🙇 +person tipping hand 💁 +man tipping hand 💁‍♂ +person gesturing NO 🙅 +man gesturing NO 🙅‍♂ +person gesturing OK 🙆 +man gesturing OK 🙆‍♂ +person raising hand 🙋 +man raising hand 🙋‍♂ +woman facepalming 🤦‍♀ +man facepalming 🤦‍♂ +woman shrugging 🤷‍♀ +man shrugging 🤷‍♂ +person pouting 🙎 +man pouting 🙎‍♂ +person frowning 🙍 +man frowning 🙍‍♂ +person getting haircut 💇 +man getting haircut 💇‍♂ +person getting massage 💆 +man getting massage 💆‍♂ +man in business suit levitating 🕴 +woman dancing 💃 +man dancing 🕺 +people with bunny ears partying 👯 +men with bunny ears partying 👯‍♂ +woman walking 🚶‍♀ +person walking 🚶 +woman running 🏃‍♀ +person running 🏃 +man and woman holding hands 👫 +two women holding hands 👭 +two men holding hands 👬 +couple with heart 💑 +couple with heart: woman woman 👩‍❤️‍👩 +couple with heart: man man 👨‍❤️‍👨 +kiss 💏 +kiss: woman woman 👩‍❤️‍💋‍👩 +kiss: man man 👨‍❤️‍💋‍👨 +family 👪 +family: man woman girl 👨‍👩‍👧 +family: man woman girl boy 👨‍👩‍👧‍👦 +family: man woman boy boy 👨‍👩‍👦‍👦 +family: man woman girl girl 👨‍👩‍👧‍👧 +family: woman woman boy 👩‍👩‍👦 +family: woman woman girl 👩‍👩‍👧 +family: woman woman girl boy 👩‍👩‍👧‍👦 +family: woman woman boy boy 👩‍👩‍👦‍👦 +family: woman woman girl girl 👩‍👩‍👧‍👧 +family: man man boy 👨‍👨‍👦 +family: man man girl 👨‍👨‍👧 +family: man man girl boy 👨‍👨‍👧‍👦 +family: man man boy boy 👨‍👨‍👦‍👦 +family: man man girl girl 👨‍👨‍👧‍👧 +family: woman boy 👩‍👦 +family: woman girl 👩‍👧 +family: woman girl boy 👩‍👧‍👦 +family: woman boy boy 👩‍👦‍👦 +family: woman girl girl 👩‍👧‍👧 +family: man boy 👨‍👦 +family: man girl 👨‍👧 +family: man girl boy 👨‍👧‍👦 +family: man boy boy 👨‍👦‍👦 +family: man girl girl 👨‍👧‍👧 +woman’s clothes 👚 +t-shirt 👕 +jeans 👖 +necktie 👔 +dress 👗 +bikini 👙 +kimono 👘 +high-heeled shoe 👠 +woman’s sandal 👡 +woman’s boot 👢 +man’s shoe 👞 +running shoe 👟 +woman’s hat 👒 +top hat 🎩 +graduation cap 🎓 +crown 👑 +rescue worker’s helmet ⛑ +school backpack 🎒 +clutch bag 👝 +purse 👛 +handbag 👜 +briefcase 💼 +glasses 👓 +sunglasses 🕶 +closed umbrella 🌂 +umbrella ☂️ +dog face 🐶 +cat face 🐱 +mouse face 🐭 +hamster face 🐹 +rabbit face 🐰 +fox face 🦊 +bear face 🐻 +panda face 🐼 +koala 🐨 +tiger face 🐯 +lion face 🦁 +cow face 🐮 +pig face 🐷 +pig nose 🐽 +frog face 🐸 +monkey face 🐵 +see-no-evil monkey 🙈 +hear-no-evil monkey 🙉 +speak-no-evil monkey 🙊 +monkey 🐒 +chicken 🐔 +penguin 🐧 +bird 🐦 +baby chick 🐤 +hatching chick 🐣 +front-facing baby chick 🐥 +duck 🦆 +eagle 🦅 +owl 🦉 +bat 🦇 +wolf face 🐺 +boar 🐗 +horse face 🐴 +unicorn face 🦄 +honeybee 🐝 +bug 🐛 +butterfly 🦋 +snail 🐌 +spiral shell 🐚 +lady beetle 🐞 +ant 🐜 +spider 🕷 +spider web 🕸 +turtle 🐢 +snake 🐍 +lizard 🦎 +scorpion 🦂 +crab 🦀 +squid 🦑 +octopus 🐙 +shrimp 🦐 +tropical fish 🐠 +fish 🐟 +blowfish 🐡 +dolphin 🐬 +shark 🦈 +spouting whale 🐳 +whale 🐋 +crocodile 🐊 +leopard 🐆 +tiger 🐅 +water buffalo 🐃 +ox 🐂 +cow 🐄 +deer 🦌 +camel 🐪 +two-hump camel 🐫 +elephant 🐘 +rhinoceros 🦏 +gorilla 🦍 +horse 🐎 +pig 🐖 +goat 🐐 +ram 🐏 +sheep 🐑 +dog 🐕 +poodle 🐩 +cat 🐈 +rooster 🐓 +turkey 🦃 +dove 🕊 +rabbit 🐇 +mouse 🐁 +rat 🐀 +chipmunk 🐿 +paw prints 🐾 +dragon 🐉 +dragon face 🐲 +cactus 🌵 +Christmas tree 🎄 +evergreen tree 🌲 +deciduous tree 🌳 +palm tree 🌴 +seedling 🌱 +herb 🌿 +shamrock ☘️ +four leaf clover 🍀 +pine decoration 🎍 +tanabata tree 🎋 +leaf fluttering in wind 🍃 +fallen leaf 🍂 +maple leaf 🍁 +mushroom 🍄 +sheaf of rice 🌾 +bouquet 💐 +tulip 🌷 +rose 🌹 +wilted flower 🥀 +sunflower 🌻 +blossom 🌼 +cherry blossom 🌸 +hibiscus 🌺 +globe showing Americas 🌎 +globe showing Europe-Africa 🌍 +globe showing Asia-Australia 🌏 +full moon 🌕 +waning gibbous moon 🌖 +last quarter moon 🌗 +waning crescent moon 🌘 +new moon 🌑 +waxing crescent moon 🌒 +first quarter moon 🌓 +waxing gibbous moon 🌔 +new moon face 🌚 +full moon with face 🌝 +sun with face 🌞 +first quarter moon with face 🌛 +last quarter moon with face 🌜 +crescent moon 🌙 +dizzy 💫 +white medium star ⭐️ +glowing star 🌟 +sparkles ✨ +high voltage ⚡️ +fire 🔥 +collision 💥 +comet ☄ +sun ☀️ +sun behind small cloud 🌤 +sun behind cloud ⛅️ +sun behind large cloud 🌥 +sun behind rain cloud 🌦 +rainbow 🌈 +cloud ☁️ +cloud with rain 🌧 +cloud with lightning and rain ⛈ +cloud with lightning 🌩 +cloud with snow 🌨 +snowman ☃️ +snowman without snow ⛄️ +snowflake ❄️ +wind face 🌬 +dashing away 💨 +tornado 🌪 +fog 🌫 +water wave 🌊 +droplet 💧 +sweat droplets 💦 +umbrella with rain drops ☔️ +green apple 🍏 +red apple 🍎 +pear 🍐 +tangerine 🍊 +lemon 🍋 +banana 🍌 +watermelon 🍉 +grapes 🍇 +strawberry 🍓 +melon 🍈 +cherries 🍒 +peach 🍑 +pineapple 🍍 +kiwi fruit 🥝 +avocado 🥑 +tomato 🍅 +eggplant 🍆 +cucumber 🥒 +carrot 🥕 +ear of corn 🌽 +hot pepper 🌶 +potato 🥔 +roasted sweet potato 🍠 +chestnut 🌰 +peanuts 🥜 +honey pot 🍯 +croissant 🥐 +bread 🍞 +baguette bread 🥖 +cheese wedge 🧀 +egg 🥚 +cooking 🍳 +bacon 🥓 +pancakes 🥞 +fried shrimp 🍤 +poultry leg 🍗 +meat on bone 🍖 +pizza 🍕 +hot dog 🌭 +hamburger 🍔 +french fries 🍟 +stuffed flatbread 🥙 +taco 🌮 +burrito 🌯 +green salad 🥗 +shallow pan of food 🥘 +spaghetti 🍝 +steaming bowl 🍜 +pot of food 🍲 +fish cake with swirl 🍥 +sushi 🍣 +bento box 🍱 +curry rice 🍛 +cooked rice 🍚 +rice ball 🍙 +rice cracker 🍘 +oden 🍢 +dango 🍡 +shaved ice 🍧 +ice cream 🍨 +soft ice cream 🍦 +shortcake 🍰 +birthday cake 🎂 +custard 🍮 +lollipop 🍭 +candy 🍬 +chocolate bar 🍫 +popcorn 🍿 +doughnut 🍩 +cookie 🍪 +glass of milk 🥛 +baby bottle 🍼 +hot beverage ☕️ +teacup without handle 🍵 +sake 🍶 +beer mug 🍺 +clinking beer mugs 🍻 +clinking glasses 🥂 +wine glass 🍷 +tumbler glass 🥃 +cocktail glass 🍸 +tropical drink 🍹 +bottle with popping cork 🍾 +spoon 🥄 +fork and knife 🍴 +fork and knife with plate 🍽 +soccer ball ⚽️ +basketball 🏀 +american football 🏈 +baseball ⚾️ +tennis 🎾 +volleyball 🏐 +rugby football 🏉 +pool 8 ball 🎱 +ping pong 🏓 +badminton 🏸 +goal net 🥅 +ice hockey 🏒 +field hockey 🏑 +cricket 🏏 +flag in hole ⛳️ +bow and arrow 🏹 +fishing pole 🎣 +boxing glove 🥊 +martial arts uniform 🥋 +ice skate ⛸ +skis 🎿 +skier ⛷ +snowboarder 🏂 +woman lifting weights 🏋️‍♀️ +person lifting weights 🏋 +person fencing 🤺 +women wrestling 🤼‍♀ +men wrestling 🤼‍♂ +woman cartwheeling 🤸‍♀ +man cartwheeling 🤸‍♂ +woman bouncing ball ⛹️‍♀️ +person bouncing ball ⛹ +woman playing handball 🤾‍♀ +man playing handball 🤾‍♂ +woman golfing 🏌️‍♀️ +person golfing 🏌 +woman surfing 🏄‍♀ +person surfing 🏄 +woman swimming 🏊‍♀ +person swimming 🏊 +woman playing water polo 🤽‍♀ +man playing water polo 🤽‍♂ +woman rowing boat 🚣‍♀ +person rowing boat 🚣 +horse racing 🏇 +woman biking 🚴‍♀ +person biking 🚴 +woman mountain biking 🚵‍♀ +person mountain biking 🚵 +running shirt 🎽 +sports medal 🏅 +military medal 🎖 +1st place medal 🥇 +2nd place medal 🥈 +3rd place medal 🥉 +trophy 🏆 +rosette 🏵 +reminder ribbon 🎗 +ticket 🎫 +admission tickets 🎟 +circus tent 🎪 +woman juggling 🤹‍♀ +man juggling 🤹‍♂ +performing arts 🎭 +artist palette 🎨 +clapper board 🎬 +microphone 🎤 +headphone 🎧 +musical score 🎼 +musical keyboard 🎹 +drum 🥁 +saxophone 🎷 +trumpet 🎺 +guitar 🎸 +violin 🎻 +game die 🎲 +direct hit 🎯 +bowling 🎳 +video game 🎮 +slot machine 🎰 +automobile 🚗 +taxi 🚕 +sport utility vehicle 🚙 +bus 🚌 +trolleybus 🚎 +racing car 🏎 +police car 🚓 +ambulance 🚑 +fire engine 🚒 +minibus 🚐 +delivery truck 🚚 +articulated lorry 🚛 +tractor 🚜 +kick scooter 🛴 +bicycle 🚲 +motor scooter 🛵 +motorcycle 🏍 +police car light 🚨 +oncoming police car 🚔 +oncoming bus 🚍 +oncoming automobile 🚘 +oncoming taxi 🚖 +aerial tramway 🚡 +mountain cableway 🚠 +suspension railway 🚟 +railway car 🚃 +tram car 🚋 +mountain railway 🚞 +monorail 🚝 +high-speed train 🚄 +high-speed train with bullet nose 🚅 +light rail 🚈 +locomotive 🚂 +train 🚆 +metro 🚇 +tram 🚊 +station 🚉 +helicopter 🚁 +small airplane 🛩 +airplane ✈️ +airplane departure 🛫 +airplane arrival 🛬 +rocket 🚀 +satellite 🛰 +seat 💺 +canoe 🛶 +sailboat ⛵️ +motor boat 🛥 +speedboat 🚤 +passenger ship 🛳 +ferry ⛴ +ship 🚢 +anchor ⚓️ +construction 🚧 +fuel pump ⛽️ +bus stop 🚏 +vertical traffic light 🚦 +horizontal traffic light 🚥 +world map 🗺 +moai 🗿 +Statue of Liberty 🗽 +fountain ⛲️ +Tokyo tower 🗼 +castle 🏰 +Japanese castle 🏯 +stadium 🏟 +ferris wheel 🎡 +roller coaster 🎢 +carousel horse 🎠 +umbrella on ground ⛱ +beach with umbrella 🏖 +desert island 🏝 +mountain ⛰ +snow-capped mountain 🏔 +mount fuji 🗻 +volcano 🌋 +desert 🏜 +camping 🏕 +tent ⛺️ +railway track 🛤 +motorway 🛣 +building construction 🏗 +factory 🏭 +house 🏠 +house with garden 🏡 +house 🏘 +derelict house 🏚 +office building 🏢 +department store 🏬 +Japanese post office 🏣 +post office 🏤 +hospital 🏥 +bank 🏦 +hotel 🏨 +convenience store 🏪 +school 🏫 +love hotel 🏩 +wedding 💒 +classical building 🏛 +church ⛪️ +mosque 🕌 +synagogue 🕍 +kaaba 🕋 +shinto shrine ⛩ +map of Japan 🗾 +moon viewing ceremony 🎑 +national park 🏞 +sunrise 🌅 +sunrise over mountains 🌄 +shooting star 🌠 +sparkler 🎇 +fireworks 🎆 +sunset 🌇 +cityscape at dusk 🌆 +cityscape 🏙 +night with stars 🌃 +milky way 🌌 +bridge at night 🌉 +foggy 🌁 +watch ⌚️ +mobile phone 📱 +mobile phone with arrow 📲 +laptop computer 💻 +keyboard ⌨️ +desktop computer 🖥 +printer 🖨 +computer mouse 🖱 +trackball 🖲 +joystick 🕹 +clamp 🗜 +computer disk 💽 +floppy disk 💾 +optical disk 💿 +dvd 📀 +videocassette 📼 +camera 📷 +camera with flash 📸 +video camera 📹 +movie camera 🎥 +film projector 📽 +film frames 🎞 +telephone receiver 📞 +telephone ☎️ +pager 📟 +fax machine 📠 +television 📺 +radio 📻 +studio microphone 🎙 +level slider 🎚 +control knobs 🎛 +stopwatch ⏱ +timer clock ⏲ +alarm clock ⏰ +mantelpiece clock 🕰 +hourglass ⌛️ +hourglass with flowing sand ⏳ +satellite antenna 📡 +battery 🔋 +electric plug 🔌 +light bulb 💡 +flashlight 🔦 +candle 🕯 +wastebasket 🗑 +oil drum 🛢 +money with wings 💸 +dollar banknote 💵 +yen banknote 💴 +euro banknote 💶 +pound banknote 💷 +money bag 💰 +credit card 💳 +gem stone 💎 +balance scale ⚖️ +wrench 🔧 +hammer 🔨 +hammer and pick ⚒ +hammer and wrench 🛠 +pick ⛏ +nut and bolt 🔩 +gear ⚙️ +chains ⛓ +pistol 🔫 +bomb 💣 +kitchen knife 🔪 +dagger 🗡 +crossed swords ⚔️ +shield 🛡 +cigarette 🚬 +coffin ⚰️ +funeral urn ⚱️ +amphora 🏺 +crystal ball 🔮 +prayer beads 📿 +barber pole 💈 +alembic ⚗️ +telescope 🔭 +microscope 🔬 +hole 🕳 +pill 💊 +syringe 💉 +thermometer 🌡 +toilet 🚽 +potable water 🚰 +shower 🚿 +bathtub 🛁 +person taking bath 🛀 +bellhop bell 🛎 +key 🔑 +old key 🗝 +door 🚪 +couch and lamp 🛋 +bed 🛏 +person in bed 🛌 +framed picture 🖼 +shopping bags 🛍 +shopping cart 🛒 +wrapped gift 🎁 +balloon 🎈 +carp streamer 🎏 +ribbon 🎀 +confetti ball 🎊 +party popper 🎉 +Japanese dolls 🎎 +red paper lantern 🏮 +wind chime 🎐 +envelope ✉️ +envelope with arrow 📩 +incoming envelope 📨 +e-mail 📧 +love letter 💌 +inbox tray 📥 +outbox tray 📤 +package 📦 +label 🏷 +closed mailbox with lowered flag 📪 +closed mailbox with raised flag 📫 +open mailbox with raised flag 📬 +open mailbox with lowered flag 📭 +postbox 📮 +postal horn 📯 +scroll 📜 +page with curl 📃 +page facing up 📄 +bookmark tabs 📑 +bar chart 📊 +chart increasing 📈 +chart decreasing 📉 +spiral notepad 🗒 +spiral calendar 🗓 +tear-off calendar 📆 +calendar 📅 +card index 📇 +card file box 🗃 +ballot box with ballot 🗳 +file cabinet 🗄 +clipboard 📋 +file folder 📁 +open file folder 📂 +card index dividers 🗂 +rolled-up newspaper 🗞 +newspaper 📰 +notebook 📓 +notebook with decorative cover 📔 +ledger 📒 +closed book 📕 +green book 📗 +blue book 📘 +orange book 📙 +books 📚 +open book 📖 +bookmark 🔖 +link 🔗 +paperclip 📎 +linked paperclips 🖇 +triangular ruler 📐 +straight ruler 📏 +pushpin 📌 +round pushpin 📍 +scissors ✂️ +pen 🖊 +fountain pen 🖋 +black nib ✒️ +paintbrush 🖌 +crayon 🖍 +memo 📝 +pencil ✏️ +left-pointing magnifying glass 🔍 +right-pointing magnifying glass 🔎 +locked with pen 🔏 +locked with key 🔐 +locked 🔒 +unlocked 🔓 +red heart ❤️ +yellow heart 💛 +green heart 💚 +blue heart 💙 +purple heart 💜 +black heart 🖤 +broken heart 💔 +heavy heart exclamation ❣️ +two hearts 💕 +revolving hearts 💞 +beating heart 💓 +growing heart 💗 +sparkling heart 💖 +heart with arrow 💘 +heart with ribbon 💝 +heart decoration 💟 +peace symbol ☮️ +latin cross ✝️ +star and crescent ☪️ +om 🕉 +wheel of dharma ☸️ +star of David ✡️ +dotted six-pointed star 🔯 +menorah 🕎 +yin yang ☯️ +orthodox cross ☦️ +place of worship 🛐 +Ophiuchus ⛎ +Aries ♈️ +Taurus ♉️ +Gemini ♊️ +Cancer ♋️ +Leo ♌️ +Virgo ♍️ +Libra ♎️ +Scorpius ♏️ +Sagittarius ♐️ +Capricorn ♑️ +Aquarius ♒️ +Pisces ♓️ +ID button 🆔 +atom symbol ⚛️ +Japanese “acceptable” button 🉑 +radioactive ☢️ +biohazard ☣️ +mobile phone off 📴 +vibration mode 📳 +Japanese “not free of charge” button 🈶 +Japanese “free of charge” button 🈚️ +Japanese “application” button 🈸 +Japanese “open for business” button 🈺 +Japanese “monthly amount” button 🈷️ +eight-pointed star ✴️ +VS button 🆚 +white flower 💮 +Japanese “bargain” button 🉐 +Japanese “secret” button ㊙️ +Japanese “congratulations” button ㊗️ +Japanese “passing grade” button 🈴 +Japanese “no vacancy” button 🈵 +Japanese “discount” button 🈹 +Japanese “prohibited” button 🈲 +A button (blood type) 🅰️ +B button (blood type) 🅱️ +AB button (blood type) 🆎 +CL button 🆑 +O button (blood type) 🅾️ +SOS button 🆘 +cross mark ❌ +heavy large circle ⭕️ +stop sign 🛑 +no entry ⛔️ +name badge 📛 +prohibited 🚫 +hundred points 💯 +anger symbol 💢 +hot springs ♨️ +no pedestrians 🚷 +no littering 🚯 +no bicycles 🚳 +non-potable water 🚱 +no one under eighteen 🔞 +no mobile phones 📵 +no smoking 🚭 +exclamation mark ❗️ +white exclamation mark ❕ +question mark ❓ +white question mark ❔ +double exclamation mark ‼️ +exclamation question mark ⁉️ +dim button 🔅 +bright button 🔆 +part alternation mark 〽️ +warning ⚠️ +children crossing 🚸 +trident emblem 🔱 +fleur-de-lis ⚜️ +Japanese symbol for beginner 🔰 +recycling symbol ♻️ +white heavy check mark ✅ +Japanese “reserved” button 🈯️ +chart increasing with yen 💹 +sparkle ❇️ +eight-spoked asterisk ✳️ +cross mark button ❎ +globe with meridians 🌐 +diamond with a dot 💠 +circled M Ⓜ️ +cyclone 🌀 +zzz 💤 +ATM sign 🏧 +water closet 🚾 +wheelchair symbol ♿️ +P button 🅿️ +Japanese “vacancy” button 🈳 +Japanese “service charge” button 🈂️ +passport control 🛂 +customs 🛃 +baggage claim 🛄 +left luggage 🛅 +men’s room 🚹 +women’s room 🚺 +baby symbol 🚼 +restroom 🚻 +litter in bin sign 🚮 +cinema 🎦 +antenna bars 📶 +Japanese “here” button 🈁 +input symbols 🔣 +information ℹ️ +input latin letters 🔤 +input latin lowercase 🔡 +input latin uppercase 🔠 +NG button 🆖 +OK button 🆗 +UP! button 🆙 +COOL button 🆒 +NEW button 🆕 +FREE button 🆓 +keycap: 0 0️⃣ +keycap: 1 1️⃣ +keycap: 2 2️⃣ +keycap: 3 3️⃣ +keycap: 4 4️⃣ +keycap: 5 5️⃣ +keycap: 6 6️⃣ +keycap: 7 7️⃣ +keycap: 8 8️⃣ +keycap: 9 9️⃣ +keycap 10 🔟 +input numbers 🔢 +keycap: # #️⃣ +keycap: * *️⃣ +play button ▶️ +pause button ⏸ +play or pause button ⏯ +stop button ⏹ +record button ⏺ +next track button ⏭ +last track button ⏮ +fast-forward button ⏩ +fast reverse button ⏪ +fast up button ⏫ +fast down button ⏬ +reverse button ◀️ +up button 🔼 +down button 🔽 +right arrow ➡️ +left arrow ⬅️ +up arrow ⬆️ +down arrow ⬇️ +up-right arrow ↗️ +down-right arrow ↘️ +down-left arrow ↙️ +up-left arrow ↖️ +up-down arrow ↕️ +left-right arrow ↔️ +left arrow curving right ↪️ +right arrow curving left ↩️ +right arrow curving up ⤴️ +right arrow curving down ⤵️ +shuffle tracks button 🔀 +repeat button 🔁 +repeat single button 🔂 +anticlockwise arrows button 🔄 +clockwise vertical arrows 🔃 +musical note 🎵 +musical notes 🎶 +heavy plus sign ➕ +heavy minus sign ➖ +heavy division sign ➗ +heavy multiplication x ✖️ +heavy dollar sign 💲 +currency exchange 💱 +trade mark ™️ +copyright ©️ +registered ®️ +wavy dash 〰️ +curly loop ➰ +double curly loop ➿ +END arrow 🔚 +BACK arrow 🔙 +ON! arrow 🔛 +TOP arrow 🔝 +SOON arrow 🔜 +heavy check mark ✔️ +ballot box with check ☑️ +radio button 🔘 +white circle ⚪️ +black circle ⚫️ +red circle 🔴 +blue circle 🔵 +red triangle pointed up 🔺 +red triangle pointed down 🔻 +small orange diamond 🔸 +small blue diamond 🔹 +large orange diamond 🔶 +large blue diamond 🔷 +white square button 🔳 +black square button 🔲 +black small square ▪️ +white small square ▫️ +black medium-small square ◾️ +white medium-small square ◽️ +black medium square ◼️ +white medium square ◻️ +black large square ⬛️ +white large square ⬜️ +speaker low volume 🔈 +muted speaker 🔇 +speaker medium volume 🔉 +speaker high volume 🔊 +bell 🔔 +bell with slash 🔕 +megaphone 📣 +loudspeaker 📢 +eye in speech bubble 👁‍🗨 +speech balloon 💬 +thought balloon 💭 +right anger bubble 🗯 +spade suit ♠️ +club suit ♣️ +heart suit ♥️ +diamond suit ♦️ +joker 🃏 +flower playing cards 🎴 +mahjong red dragon 🀄️ +one o’clock 🕐 +two o’clock 🕑 +three o’clock 🕒 +four o’clock 🕓 +five o’clock 🕔 +six o’clock 🕕 +seven o’clock 🕖 +eight o’clock 🕗 +nine o’clock 🕘 +ten o’clock 🕙 +eleven o’clock 🕚 +twelve o’clock 🕛 +one-thirty 🕜 +two-thirty 🕝 +three-thirty 🕞 +four-thirty 🕟 +five-thirty 🕠 +six-thirty 🕡 +seven-thirty 🕢 +eight-thirty 🕣 +nine-thirty 🕤 +ten-thirty 🕥 +eleven-thirty 🕦 +twelve-thirty 🕧 +white flag 🏳️ +black flag 🏴 +chequered flag 🏁 +triangular flag 🚩 +rainbow flag 🏳️‍🌈 +Afghanistan 🇦🇫 +Åland Islands 🇦🇽 +Albania 🇦🇱 +Algeria 🇩🇿 +American Samoa 🇦🇸 +Andorra 🇦🇩 +Angola 🇦🇴 +Anguilla 🇦🇮 +Antarctica 🇦🇶 +Antigua & Barbuda 🇦🇬 +Argentina 🇦🇷 +Armenia 🇦🇲 +Aruba 🇦🇼 +Australia 🇦🇺 +Austria 🇦🇹 +Azerbaijan 🇦🇿 +Bahamas 🇧🇸 +Bahrain 🇧🇭 +Bangladesh 🇧🇩 +Barbados 🇧🇧 +Belarus 🇧🇾 +Belgium 🇧🇪 +Belize 🇧🇿 +Benin 🇧🇯 +Bermuda 🇧🇲 +Bhutan 🇧🇹 +Bolivia 🇧🇴 +Caribbean Netherlands 🇧🇶 +Bosnia & Herzegovina 🇧🇦 +Botswana 🇧🇼 +Brazil 🇧🇷 +British Indian Ocean Territory 🇮🇴 +British Virgin Islands 🇻🇬 +Brunei 🇧🇳 +Bulgaria 🇧🇬 +Burkina Faso 🇧🇫 +Burundi 🇧🇮 +Cape Verde 🇨🇻 +Cambodia 🇰🇭 +Cameroon 🇨🇲 +Canada 🇨🇦 +Canary Islands 🇮🇨 +Cayman Islands 🇰🇾 +Central African Republic 🇨🇫 +Chad 🇹🇩 +Chile 🇨🇱 +China 🇨🇳 +Christmas Island 🇨🇽 +Cocos (Keeling) Islands 🇨🇨 +Colombia 🇨🇴 +Comoros 🇰🇲 +Congo - Brazzaville 🇨🇬 +Congo - Kinshasa 🇨🇩 +Cook Islands 🇨🇰 +Costa Rica 🇨🇷 +Côte d’Ivoire 🇨🇮 +Croatia 🇭🇷 +Cuba 🇨🇺 +Curaçao 🇨🇼 +Cyprus 🇨🇾 +Czech Republic 🇨🇿 +Denmark 🇩🇰 +Djibouti 🇩🇯 +Dominica 🇩🇲 +Dominican Republic 🇩🇴 +Ecuador 🇪🇨 +Egypt 🇪🇬 +El Salvador 🇸🇻 +Equatorial Guinea 🇬🇶 +Eritrea 🇪🇷 +Estonia 🇪🇪 +Ethiopia 🇪🇹 +European Union 🇪🇺 +Falkland Islands 🇫🇰 +Faroe Islands 🇫🇴 +Fiji 🇫🇯 +Finland 🇫🇮 +France 🇫🇷 +French Guiana 🇬🇫 +French Polynesia 🇵🇫 +French Southern Territories 🇹🇫 +Gabon 🇬🇦 +Gambia 🇬🇲 +Georgia 🇬🇪 +Germany 🇩🇪 +Ghana 🇬🇭 +Gibraltar 🇬🇮 +Greece 🇬🇷 +Greenland 🇬🇱 +Grenada 🇬🇩 +Guadeloupe 🇬🇵 +Guam 🇬🇺 +Guatemala 🇬🇹 +Guernsey 🇬🇬 +Guinea 🇬🇳 +Guinea-Bissau 🇬🇼 +Guyana 🇬🇾 +Haiti 🇭🇹 +Honduras 🇭🇳 +Hong Kong SAR China 🇭🇰 +Hungary 🇭🇺 +Iceland 🇮🇸 +India 🇮🇳 +Indonesia 🇮🇩 +Iran 🇮🇷 +Iraq 🇮🇶 +Ireland 🇮🇪 +Isle of Man 🇮🇲 +Israel 🇮🇱 +Italy 🇮🇹 +Jamaica 🇯🇲 +Japan 🇯🇵 +crossed flags 🎌 +Jersey 🇯🇪 +Jordan 🇯🇴 +Kazakhstan 🇰🇿 +Kenya 🇰🇪 +Kiribati 🇰🇮 +Kosovo 🇽🇰 +Kuwait 🇰🇼 +Kyrgyzstan 🇰🇬 +Laos 🇱🇦 +Latvia 🇱🇻 +Lebanon 🇱🇧 +Lesotho 🇱🇸 +Liberia 🇱🇷 +Libya 🇱🇾 +Liechtenstein 🇱🇮 +Lithuania 🇱🇹 +Luxembourg 🇱🇺 +Macau SAR China 🇲🇴 +Macedonia 🇲🇰 +Madagascar 🇲🇬 +Malawi 🇲🇼 +Malaysia 🇲🇾 +Maldives 🇲🇻 +Mali 🇲🇱 +Malta 🇲🇹 +Marshall Islands 🇲🇭 +Martinique 🇲🇶 +Mauritania 🇲🇷 +Mauritius 🇲🇺 +Mayotte 🇾🇹 +Mexico 🇲🇽 +Micronesia 🇫🇲 +Moldova 🇲🇩 +Monaco 🇲🇨 +Mongolia 🇲🇳 +Montenegro 🇲🇪 +Montserrat 🇲🇸 +Morocco 🇲🇦 +Mozambique 🇲🇿 +Myanmar (Burma) 🇲🇲 +Namibia 🇳🇦 +Nauru 🇳🇷 +Nepal 🇳🇵 +Netherlands 🇳🇱 +New Caledonia 🇳🇨 +New Zealand 🇳🇿 +Nicaragua 🇳🇮 +Niger 🇳🇪 +Nigeria 🇳🇬 +Niue 🇳🇺 +Norfolk Island 🇳🇫 +Northern Mariana Islands 🇲🇵 +North Korea 🇰🇵 +Norway 🇳🇴 +Oman 🇴🇲 +Pakistan 🇵🇰 +Palau 🇵🇼 +Palestinian Territories 🇵🇸 +Panama 🇵🇦 +Papua New Guinea 🇵🇬 +Paraguay 🇵🇾 +Peru 🇵🇪 +Philippines 🇵🇭 +Pitcairn Islands 🇵🇳 +Poland 🇵🇱 +Portugal 🇵🇹 +Puerto Rico 🇵🇷 +Qatar 🇶🇦 +Réunion 🇷🇪 +Romania 🇷🇴 +Russia 🇷🇺 +Rwanda 🇷🇼 +St. Barthélemy 🇧🇱 +St. Helena 🇸🇭 +St. Kitts & Nevis 🇰🇳 +St. Lucia 🇱🇨 +St. Pierre & Miquelon 🇵🇲 +St. Vincent & Grenadines 🇻🇨 +Samoa 🇼🇸 +San Marino 🇸🇲 +São Tomé & Príncipe 🇸🇹 +Saudi Arabia 🇸🇦 +Senegal 🇸🇳 +Serbia 🇷🇸 +Seychelles 🇸🇨 +Sierra Leone 🇸🇱 +Singapore 🇸🇬 +Sint Maarten 🇸🇽 +Slovakia 🇸🇰 +Slovenia 🇸🇮 +Solomon Islands 🇸🇧 +Somalia 🇸🇴 +South Africa 🇿🇦 +South Georgia & South Sandwich Islands 🇬🇸 +South Korea 🇰🇷 +South Sudan 🇸🇸 +Spain 🇪🇸 +Sri Lanka 🇱🇰 +Sudan 🇸🇩 +Suriname 🇸🇷 +Swaziland 🇸🇿 +Sweden 🇸🇪 +Switzerland 🇨🇭 +Syria 🇸🇾 +Taiwan 🇹🇼 +Tajikistan 🇹🇯 +Tanzania 🇹🇿 +Thailand 🇹🇭 +Timor-Leste 🇹🇱 +Togo 🇹🇬 +Tokelau 🇹🇰 +Tonga 🇹🇴 +Trinidad & Tobago 🇹🇹 +Tunisia 🇹🇳 +Turkey 🇹🇷 +Turkmenistan 🇹🇲 +Turks & Caicos Islands 🇹🇨 +Tuvalu 🇹🇻 +Uganda 🇺🇬 +Ukraine 🇺🇦 +United Arab Emirates 🇦🇪 +United Kingdom 🇬🇧 +United States 🇺🇸 +U.S. Virgin Islands 🇻🇮 +Uruguay 🇺🇾 +Uzbekistan 🇺🇿 +Vanuatu 🇻🇺 +Vatican City 🇻🇦 +Venezuela 🇻🇪 +Vietnam 🇻🇳 +Wallis & Futuna 🇼🇫 +Western Sahara 🇪🇭 +Yemen 🇾🇪 +Zambia 🇿🇲 +Zimbabwe 🇿🇼 -- cgit v1.2.3 From 838b25b60b3b00c5684c00fb62b1ae28a3739cc2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 12:40:18 -0300 Subject: bin/player: Add working utility --- bin/player | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100755 bin/player diff --git a/bin/player b/bin/player new file mode 100755 index 0000000..b6e66d7 --- /dev/null +++ b/bin/player @@ -0,0 +1,136 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + player ACTION + player -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + ACTION one of: + - backward: go back 5 seconds + - forward: go forward 5 seconds + - previous: go to the previous track + - next: go to the next track + - play-pause: play/pause + - rotate: rotate across available MPRIS players + - current: show the current MPRIS player + + + Manipulate the MPRIS audio player. + + + Examples: + + Change the current MPRIS player: + + $ player current + + + Play/pause: + + $ player play-pause + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'P:h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) +ACTION="${1:-}" + +eval "$(assert-arg "$ACTION" 'ACTION')" + + + +CURRENT_PLAYER_PATH="$XDG_CACHE_HOME"/euandreh-mpris-player.txt +CURRENT_PLAYER="$(cat "$CURRENT_PLAYER_PATH" ||:)" +AVAILABLE_PLAYERS="$(playerctl --list-all | LANG=POSIX.UTF-8 sort)" + +pick_first() { + echo "$AVAILABLE_PLAYERS" | head -n1 +} + +next_player() { + if [ -z "$CURRENT_PLAYER" ]; then + pick_first + elif ! echo "$AVAILABLE_PLAYERS" | grep -q "$CURRENT_PLAYER"; then + # Unknown $CURRENT_PLAYER, pick anyone + pick_first + else + INDEX="$(echo "$AVAILABLE_PLAYERS" | grep -n "$CURRENT_PLAYER" | cut -d: -f1)" + LENGTH="$(echo "$AVAILABLE_PLAYERS" | wc -l)" + if [ "$INDEX" = "$LENGTH" ]; then + # Reached the end of the $AVAILABLE_PLAYERS list, wrapping + pick_first + else + # Get the next player instead + echo "$AVAILABLE_PLAYERS" | awk -v idx="$INDEX" 'NR == idx+1 {print}' + fi + fi +} + +case "$ACTION" in + backward) + playerctl --player="$CURRENT_PLAYER" position 5- + ;; + forward) + playerctl --player="$CURRENT_PLAYER" position 5+ + ;; + previous) + playerctl --player="$CURRENT_PLAYER" previous + ;; + next) + playerctl --player="$CURRENT_PLAYER" next + ;; + play-pause) + playerctl --player="$CURRENT_PLAYER" play-pause + ;; + rotate) + PLAYER="$(next_player)" + echo "$PLAYER" > "$CURRENT_PLAYER_PATH" + notify-send -t 1000 "$PLAYER" 'current MPRIS target' + ;; + current) + printf '%s\n' "$CURRENT_PLAYER" + ;; + *) + printf 'Bad ACTION: "%s".\n\n' "$ACTION" >&2 + usage >&2 + exit 2 + ;; +esac -- cgit v1.2.3 From a2324725adab4fda610d39eb21d8d28bdf8f35ba Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 13:17:45 -0300 Subject: bin/: Add examples to help strings --- bin/gc | 10 ++++++++++ bin/mkdtemp | 40 ++++++++++++++++++++++++++++++++++++++++ bin/mkstemp | 40 ++++++++++++++++++++++++++++++++++++++++ bin/pre | 14 ++++++++++++++ bin/prompt | 9 +++++++++ bin/qr | 13 +++++++++++++ bin/tmp | 15 +++++++++++++++ bin/tmpname | 14 ++++++++++++++ bin/uuid | 9 +++++++++ bin/xmpp | 12 +++++++++++- 10 files changed, 175 insertions(+), 1 deletion(-) diff --git a/bin/gc b/bin/gc index ec6a8f1..23a0436 100755 --- a/bin/gc +++ b/bin/gc @@ -14,6 +14,16 @@ help() { Options: -h, --help show this message + + + Free disk space system-wide. + + + Examples: + + Just run it: + + $ gc EOF } diff --git a/bin/mkdtemp b/bin/mkdtemp index d012175..3729dd4 100755 --- a/bin/mkdtemp +++ b/bin/mkdtemp @@ -15,10 +15,50 @@ help() { Options: -h, --help show this message + Create a new temporary file and echo its name back. + + + Examples: + + `cd` into temporary directory: + + $ cd "$(mkdtemp)" EOF } + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + name="$(tmpname)" mkdir "$name" echo "$name" diff --git a/bin/mkstemp b/bin/mkstemp index ec92c14..4097e59 100755 --- a/bin/mkstemp +++ b/bin/mkstemp @@ -15,10 +15,50 @@ help() { Options: -h, --help show this message + Create a new temporary file and echo its name back. + + + Examples: + + Capture output into temporary file: + + $ OUT="$(mkstemp)"; cmd > "$OUT" EOF } + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + name="$(tmpname)" touch "$name" echo "$name" diff --git a/bin/pre b/bin/pre index 79c212f..2b32f8f 100755 --- a/bin/pre +++ b/bin/pre @@ -15,6 +15,20 @@ help() { Options: -c COLOR ANSI color to be used on the prefix text -h, --help show this message + + Prefix STDIN with PREFIX. + + + Examples: + + Prefix with 'database': + + $ ./run-db.sh | pre 'database' + + + Prefix with yellow 'numbers': + + $ seq 10 | pre -c yellow numbers EOF } diff --git a/bin/prompt b/bin/prompt index 68dff61..247c81a 100755 --- a/bin/prompt +++ b/bin/prompt @@ -20,6 +20,15 @@ help() { Display a prompt and return a value corresponding to the response. + + + Examples: + + Conditionally run download command + + if prompt 'Download files?'; then + run_download; + fi EOF } diff --git a/bin/qr b/bin/qr index 4821a46..c0462e1 100755 --- a/bin/qr +++ b/bin/qr @@ -16,7 +16,20 @@ help() { -s PIXEL_SIZE size of the pixel (default 10) -h, --help show this help message + Read data from STDIN and present a QR image with said data. + + + Examples: + + Link to my homepage: + + $ printf 'https://euandre.org' | qr + + + Numbers with a smaller pixel size: + + $ seq 99 | qr -s 5 EOF } diff --git a/bin/tmp b/bin/tmp index e2d16b7..2dc0b48 100755 --- a/bin/tmp +++ b/bin/tmp @@ -16,6 +16,21 @@ help() { Options: -d delete the remote "tmp/" folder -h, --help show this message + + + Copies a file to the public server. + + + Examples: + + Copy f.txt: + + $ tmp f.txt + + + Cleanup the $REMOTE: + + $ tmp -d EOF } diff --git a/bin/tmpname b/bin/tmpname index d83fc87..89d7e4d 100755 --- a/bin/tmpname +++ b/bin/tmpname @@ -15,10 +15,24 @@ help() { Options: -h, --help show this message + Generate a temporary name. + + + Examples: + + Create a temporary file: + + $ OUT="$(tmpname)"; touch "$OUT"; cmd > "$OUT" + + + `cd` into a temporary directory: + + $ DIR="$(tmpname)"; mkdir -p "$DIR"; cd "$DIR" EOF } + for flag in "$@"; do case "$flag" in --) diff --git a/bin/uuid b/bin/uuid index 74d0fba..34b685f 100755 --- a/bin/uuid +++ b/bin/uuid @@ -15,7 +15,16 @@ help() { Options: -h, --help show this message + Generate UUID from /dev/random. + + + Examples: + + Generate a UUID: + + $ uuid + 755244c8-f955-16df-75cc-f25600c90422 EOF } diff --git a/bin/xmpp b/bin/xmpp index 472e9ca..b08a783 100755 --- a/bin/xmpp +++ b/bin/xmpp @@ -18,7 +18,17 @@ Options: -h, --help show this message FROM_JID the address used to send the message from - TO_JID the addresses where to send the message to""" + TO_JID the addresses where to send the message to + + +Send a one-off XMPP message. + + +Examples: + + Send a message to eu@euandreh.xyz: + + $ xmpp -m 'Hello, XMPP!' eu@euandreh.xyz""" class SendMsgBot(slixmpp.ClientXMPP): def __init__(self, jid, password, on_start): -- cgit v1.2.3 From 876a61a25e7013284cff89195a30bb95083d87a0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 13:18:03 -0300 Subject: bin/forever: Report on the status code of each run --- bin/forever | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/forever b/bin/forever index 9d2556f..d4410e5 100755 --- a/bin/forever +++ b/bin/forever @@ -62,5 +62,7 @@ eval "$(assert-arg "${1:-}" 'COMMAND')" while true; do - "$@" + STATUS=0 + "$@" || STATUS=$? + printf 'Exitted with code %s.\n' "$STATUS" >&2 done -- cgit v1.2.3 From 885630d44b51fd6e3dfcacd1d343fab6591d6255 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 13:18:54 -0300 Subject: bin/gc: Fix password input to sudo --- bin/gc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/gc b/bin/gc index 23a0436..7fc92ec 100755 --- a/bin/gc +++ b/bin/gc @@ -65,7 +65,7 @@ disk() { gc_guix() { - pass show velhinho/0-andreh-password | sudo -S guix system delete-generations + pass show velhinho/0-andreh-password | head -n1 | sudo -iS guix system delete-generations guix home delete-generations guix gc -d } -- cgit v1.2.3 From c78a590ccbd01d22e9a6c43e4902e502f3597a2e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 13 Aug 2022 13:19:53 -0300 Subject: bin/gc: Enable "set -x" option --- bin/gc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/gc b/bin/gc index 7fc92ec..1ef92f1 100755 --- a/bin/gc +++ b/bin/gc @@ -101,6 +101,7 @@ gc_email() { BEFORE="$(disk)" +set -x gc_guix gc_nohup gc_trash @@ -108,6 +109,7 @@ gc_tmpdir gc_docker gc_email wait +set +x AFTER="$(disk)" printf 'Disk space:\n' -- cgit v1.2.3 From fd117df8ee936d6ccedc9350e0d5304e2bf8b0d2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 14 Aug 2022 20:59:57 -0300 Subject: bin/yt: Add working utility --- bin/yt | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100755 bin/yt diff --git a/bin/yt b/bin/yt new file mode 100755 index 0000000..ddcc02d --- /dev/null +++ b/bin/yt @@ -0,0 +1,110 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + yt [-f] [-n PLAYLIST_COUNT] [URL...|FILE...|-] + yt -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -n PLAYLIST_COUNT the number of videos to grab from a + playlist (default: 15) + -f force to download a video already in the + archive + -h, --help show this message + + URL an 'https://...' address + FILE a file with 'https://...' addresses, one + per line + + Download videos and store them locally. + + + Examples: + + Download the video from the given URL: + + $ yt https://www.youtube.com/watch?v=EihZv2XgJdU + + + Force re-download the latest 5 videos already downloaded: + + $ yt -nf5 https://www.youtube.com/watch?list=TLPQMTIwODIwMjLnL2XjyRRgSw + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +PLAYLIST_COUNT=15 +while getopts 'fn:h' flag; do + case "$flag" in + f) + FORCE=1 + ;; + n) + PLAYLIST_COUNT="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) +set -x + +if [ -z "${1:-}" ]; then + echo 'Missing URL|FILE argument' >&2 + usage >&2 + exit 2 +fi + + +if [ ! -e "$1" ]; then + F="$(mkstemp)" + printf '%s\n' "$1" > "$F" +else + F="$1" +fi + + +YT_TEMPLATE="$HOME/Downloads/yt-dl/%(uploader)s/%(upload_date)s %(title)s.%(ext)s" + +EXTRA_OPTIONS='' +if [ -z "${FORCE:-}" ]; then + EXTRA_OPTIONS="--download-archive $HOME/Downloads/yt-dl/seen.txt" +fi + +youtube-dl \ + --batch-file "$F" \ + --format best \ + --prefer-free-formats \ + --playlist-end "$PLAYLIST_COUNT" \ + --write-description \ + --output "$YT_TEMPLATE" \ + $EXTRA_OPTIONS -- cgit v1.2.3 From 4b41b1af58b10ae6b7ce1ba0fa8475cec4e4405e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 14:47:45 -0300 Subject: mv etc/sh/check.sh bin/check: Also use generic ShellCommand command --- bin/check | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ etc/sh/check.sh | 78 --------------------------------------------------------- etc/sh/rc | 1 - 3 files changed, 76 insertions(+), 79 deletions(-) create mode 100755 bin/check delete mode 100755 etc/sh/check.sh diff --git a/bin/check b/bin/check new file mode 100755 index 0000000..4663bf3 --- /dev/null +++ b/bin/check @@ -0,0 +1,76 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + check.sh + check.sh -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +cd -- "$(dirname -- "$0")" +cd -- "$(git rev-parse --show-toplevel)" + + +git ls-files | + xargs awk 'FNR==1 && /^#!\/bin\/sh$/ { print FILENAME }' | + xargs shellcheck -x + +if git grep FIXME -- ":(exclude)$0"; then + printf 'Leftover FIXME markers\n' >&2 + exit 1 +fi + +if ! git diff --quiet || ! git diff --quiet --staged; then + printf 'Dirty tilde repository.\n' >&2 + exit 1 +fi + +PRIV="$XDG_CONFIG_HOME/../var/lib/private/tilde" +if ! git -C "$PRIV" diff --quiet || ! git -C "$PRIV" diff --quiet --staged; then + printf 'Dirty private tilde repository.\n' >&2 + exit 1 +fi + +# FIXME: +# verify that the expiry date on the GPG key is greater than 1 year +# assert git pushed diff --git a/etc/sh/check.sh b/etc/sh/check.sh deleted file mode 100755 index 07e9e66..0000000 --- a/etc/sh/check.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - check.sh - check.sh -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -cd -- "$(dirname -- "$0")" -cd -- "$(git rev-parse --show-toplevel)" - -shellcheck -xe 1090,1091 \ - "$XDG_CONFIG_HOME"/sh/rc \ - "$XDG_CONFIG_HOME"/sh/vcs-ps1.sh \ - "$XDG_CONFIG_HOME"/sh/check.sh \ - "$XDG_CONFIG_HOME"/sh/privrc.sh \ - "$XDG_CONFIG_HOME"/sh/cronjob.sh \ - "$XDG_CONFIG_HOME"/notmuch/default/hooks/post-new - -if git grep FIXME -- ":(exclude)$XDG_CONFIG_HOME/bash/check.sh"; then - printf 'Leftover FIXME markers\n' >&2 - exit 1 -fi - -if ! git diff --quiet || ! git diff --quiet --staged; then - printf 'Dirty tilde repository.\n' >&2 - exit 1 -fi - -PRIV="$XDG_CONFIG_HOME/../var/lib/private/tilde" -if ! git -C "$PRIV" diff --quiet || ! git -C "$PRIV" diff --quiet --staged; then - printf 'Dirty private tilde repository.\n' >&2 - exit 1 -fi - -# FIXME: -# verify that the expiry date on the GPG key is greater than 1 year diff --git a/etc/sh/rc b/etc/sh/rc index e1eb992..33b01bc 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -122,7 +122,6 @@ alias mm='msmtp-queue -r' alias s='vcs_status' alias d='vcs_diff' alias ds='vcs_diff_staged' -alias check='sh "$XDG_CONFIG_HOME"/sh/check.sh' alias tpd='cd "$(mkdtemp)"' alias l='ls -lahF --color' -- cgit v1.2.3 From 9ab3b81bf9064f7ebb70e761e538d27465b9e1da Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 14:48:10 -0300 Subject: bin/backup: Fix "Usage" documentation of -q flag --- bin/backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/backup b/bin/backup index 763c693..0ebef43 100755 --- a/bin/backup +++ b/bin/backup @@ -4,7 +4,7 @@ set -eu usage() { cat <<-'EOF' Usage: - backup -q [-C COMMENT] [ARCHIVE_TAG] + backup [-q] [-C COMMENT] [ARCHIVE_TAG] backup -h EOF } -- cgit v1.2.3 From 5ed82ff797609462cb6cc28575455808390e189c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 14:50:01 -0300 Subject: etc/guix/home.scm: Use -q quiet flag in backup cron --- etc/guix/home.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 499a2cb..61ff14e 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -190,7 +190,7 @@ #~(job "0 * * * *" "cronjob msmtp-queue -r") #~(job "0 */6 * * *" "cronjob check") #~(job "5 */6 * * *" "cronjob m") - #~(job "30 1 * * *" "cronjob backup cron"))) + #~(job "30 1 * * *" "cronjob backup -q cron"))) (home-environment -- cgit v1.2.3 From ecaea63648d24bdbb8aced014f7b9a7409368daf Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 14:50:40 -0300 Subject: etc/guix/home.scm: Decrease frequency of "check" and "msmtp-queue" cronjobs --- etc/guix/home.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 61ff14e..549ccf5 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -187,8 +187,8 @@ (define cronjobs (list - #~(job "0 * * * *" "cronjob msmtp-queue -r") - #~(job "0 */6 * * *" "cronjob check") + #~(job "0 0 * * *" "cronjob msmtp-queue -r") + #~(job "0 0 * * *" "cronjob check") #~(job "5 */6 * * *" "cronjob m") #~(job "30 1 * * *" "cronjob backup -q cron"))) -- cgit v1.2.3 From 6ea9ab0a2c85c1b7344b5fdf34a7eeefddf8715f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 14:50:56 -0300 Subject: etc/guix/home.scm: Remove Anki Qt package --- etc/guix/home.scm | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 549ccf5..cc79b1a 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -430,7 +430,6 @@ quodlibet calibre ungoogled-chromium - anki ;; FIXME, Qt version not working properly firefox)) (list msmtp-non-hardcoded isync-with-options -- cgit v1.2.3 From a3ebbfb1b340d926e0b7ad9a4ace380f2fff5a94 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 15:52:53 -0300 Subject: bin/uri: Add working version --- bin/uri | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ etc/guix/home.scm | 1 + 2 files changed, 70 insertions(+) create mode 100755 bin/uri diff --git a/bin/uri b/bin/uri new file mode 100755 index 0000000..5930c39 --- /dev/null +++ b/bin/uri @@ -0,0 +1,69 @@ +#!/usr/bin/env perl + +use v5.34; +use strict; +use warnings; +use feature 'signatures'; +no warnings 'experimental'; +use Getopt::Std (); +use URI::Escape (); + +sub usage($fh) { + print $fh <<~'EOF' + Usage: + uri [-e|-d] + uri -h + EOF +} + +sub help($fh) { + print $fh <<~'EOF' + + Options: + -e encode the string (the default action) + -d decode the string + -h, --help show this message + + + Get a string from STDIN and convert it to/from URL encoding. + + + Examples: + + Encode the URL: + + $ echo 'https://euandre.org' | uri + + + Decode the content from the file: + + $ uri -d < file + EOF +} + +for (@ARGV) { + last if $_ eq "--"; + if ($_ eq "--help") { + usage *STDOUT; + help *STDOUT; + exit; + } +} + +my %opts; +Getopt::Std::getopts('edh', \%opts); + +if ($opts{h}) { + usage *STDOUT; + help *STDOUT; + exit; +} elsif ($opts{e} and $opts{d}) { + say STDERR 'Both -e and -d given. Pick one.'; + say STDERR ''; + usage *STDERR; + exit 2; +} elsif ($opts{d}) { + print URI::Escape::uri_unescape(); +} else { + print URI::Escape::uri_escape(); +} diff --git a/etc/guix/home.scm b/etc/guix/home.scm index cc79b1a..ddf1266 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -332,6 +332,7 @@ perl-regexp-grammars perl-commonmark perl-aliased + perl-uri-escape ruby python python-slixmpp -- cgit v1.2.3 From 15273d9c6742a86271607ff628ae3266434f5dcf Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 16:11:38 -0300 Subject: bin/check: Add perlcritic --- bin/check | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/check b/bin/check index 4663bf3..b3df0be 100755 --- a/bin/check +++ b/bin/check @@ -55,6 +55,10 @@ git ls-files | xargs awk 'FNR==1 && /^#!\/bin\/sh$/ { print FILENAME }' | xargs shellcheck -x +git ls-files | + xargs awk 'FNR==1 && /^#!\/usr\/bin\/env perl$/ { print FILENAME }' | + xargs perlcritic + if git grep FIXME -- ":(exclude)$0"; then printf 'Leftover FIXME markers\n' >&2 exit 1 -- cgit v1.2.3 From 1e01672dba034f7e9155392772d8da49bf3dfc3b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 16:27:27 -0300 Subject: bin/status-bar: Add working version --- bin/status-bar | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 bin/status-bar diff --git a/bin/status-bar b/bin/status-bar new file mode 100755 index 0000000..65cef1c --- /dev/null +++ b/bin/status-bar @@ -0,0 +1,99 @@ +#!/usr/bin/env perl + +# +# Derived from: +# https://github.com/i3/i3status/blob/28399bf84693a03eb772be647d5927011c1d2619/contrib/wrapper.pl +# + +use v5.34; +use strict; +use warnings; +use feature 'signatures'; +no warnings 'experimental'; +use Getopt::Std (); +use JSON (); + +sub usage($fh) { + print $fh <<~'EOF' + Usage: + status-bar + status-bar -h + EOF +} + +sub help($fh) { + print $fh <<~'EOF' + + Options: + -h, --help show this message + + + Process the output of i3status and add custom information for + showing in the i3 bar. + + + Examples: + + Process i3status: + + $ i3status | status-bar + + + Configure i3 to use status-bar: + + # In $XDG_CONFIG_HOME/i3/config + bar { + status_command i3status | status-bar + } + EOF +} + +for (@ARGV) { + last if $_ eq '--'; + if ($_ eq '--help') { + usage *STDOUT; + help *STDOUT; + exit; + } +} + +my %opts; +if (!Getopt::Std::getopts('h', \%opts)) { + usage *STDERR; + exit 2; +} + +if ($opts{h}) { + usage *STDOUT; + help *STDOUT; + exit; +} + +# Don't buffer any output +$| = 1; + +# Skip the first line which contains the version header. +print scalar ; + +# The second line contains the start of the infinite array. +print scalar ; + +# Read lines forever, ignore a comma at the beginning if it exists. +while (my ($statusline) = ( =~ /^,?(.*)/)) { + # Decode the JSON-encoded line. + my @blocks = @{JSON::decode_json($statusline)}; + + # Prefix our own information (you coud also suffix or insert in the + # middle). + + my $mpris = `player current`; + chomp $mpris; + + @blocks = ({ + full_text => "$mpris", + name => 'mpris', + }, @blocks); + + # Output the line as JSON. + print JSON::encode_json(\@blocks) . ",\n"; +} -- cgit v1.2.3 From 5a71b8f55f435bd8e90281f2692813f0280d6f6c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 16:27:45 -0300 Subject: bin/uri: Use single quote over double quote --- bin/uri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/uri b/bin/uri index 5930c39..5466c09 100755 --- a/bin/uri +++ b/bin/uri @@ -42,8 +42,8 @@ sub help($fh) { } for (@ARGV) { - last if $_ eq "--"; - if ($_ eq "--help") { + last if $_ eq '--'; + if ($_ eq '--help') { usage *STDOUT; help *STDOUT; exit; -- cgit v1.2.3 From c9701a0753f2dd064f0243a494cad56a6bb641be Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 16:29:42 -0300 Subject: bin/uri: Fail when bad option is given --- bin/uri | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/uri b/bin/uri index 5466c09..4e57f7c 100755 --- a/bin/uri +++ b/bin/uri @@ -51,7 +51,10 @@ for (@ARGV) { } my %opts; -Getopt::Std::getopts('edh', \%opts); +if (!Getopt::Std::getopts('edh', \%opts)) { + usage *STDERR; + exit 2; +} if ($opts{h}) { usage *STDOUT; -- cgit v1.2.3 From 2ca12fa2407f6321d9097696679661629bd4a878 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 17:57:11 -0300 Subject: bin/serve: Add working version --- bin/serve | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 bin/serve diff --git a/bin/serve b/bin/serve new file mode 100755 index 0000000..4a06c50 --- /dev/null +++ b/bin/serve @@ -0,0 +1,78 @@ +#!/bin/sh +set -eu + + +usage() { + cat <<-'EOF' + Usage: + serve [-d DIRECTORY] [-p PORT] + serve -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -d DIRECTORY the directory to serve (default: ".") + -p PORT the port to listen on (default: 8000) + -h, --help show this message + + + Serve DIRECTORY via HTTP as a static file server, and open the + URL on the $BROWSER. + + + Examples: + + Serve "." on the default PORT: + + $ serve + + + Serve "public/" on port 1234: + + $ serve -d public/ -p 1234 + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +DIRECTORY='.' +PORT=8000 +while getopts 'd:p:h' flag; do + case "$flag" in + d) + DIRECTORY="$OPTARG" + ;; + p) + PORT="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done + +open "http://localhost:$PORT" +python3 -m http.server -d "$DIRECTORY" "$PORT" -- cgit v1.2.3 From 633068d5d2256f07e2c3e42ae40be97c28c42356 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 15 Aug 2022 18:35:11 -0300 Subject: bin/nato: Add working version --- bin/nato | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 bin/nato diff --git a/bin/nato b/bin/nato new file mode 100755 index 0000000..6ea66b5 --- /dev/null +++ b/bin/nato @@ -0,0 +1,97 @@ +#!/usr/bin/env perl + +use v5.34; +use strict; +use warnings; +use feature 'signatures'; +no warnings 'experimental'; +use Getopt::Std (); + +sub usage($fh) { + print $fh <<~'EOF' + Usage: + nato + nato -h + EOF +} + +sub help($fh) { + print $fh <<~'EOF' + + Options: + -h, --help show this message + + + Translate the given input to the NATO phonetic alphabet. + + + Examples: + + Spell 'EuAndreh': + + $ echo 'EuAndreh' | nato + Echo Uniform Alfa November Delta Romeo Echo Hotel + EOF +} + +for (@ARGV) { + last if $_ eq '--'; + if ($_ eq '--help') { + usage *STDOUT; + help *STDOUT; + exit + } +} + +my %opts; +if (!Getopt::Std::getopts('h', \%opts)) { + usage *STDERR; + exit 2; +} + +my %DICT = ( + 'a' => 'Alfa', + 'b' => 'Bravo', + 'c' => 'Charlie', + 'd' => 'Delta', + 'e' => 'Echo', + 'f' => 'Foxtrot', + 'g' => 'Golf', + 'h' => 'Hotel', + 'i' => 'India', + 'j' => 'Juliett', + 'k' => 'Kilo', + 'l' => 'Lima', + 'm' => 'Mike', + 'n' => 'November', + 'o' => 'Oscar', + 'p' => 'Papa', + 'q' => 'Quebec', + 'r' => 'Romeo', + 's' => 'Sierra', + 't' => 'Tango', + 'u' => 'Uniform', + 'v' => 'Victor', + 'w' => 'Whiskey', + 'x' => 'X-ray', + 'y' => 'Yankee', + 'z' => 'Zulu', + '1' => 'One', + '2' => 'Two', + '3' => 'Three', + '4' => 'Four', + '5' => 'Five', + '6' => 'Six', + '7' => 'Seven', + '8' => 'Eight', + '9' => 'Nine', + '0' => 'Zero', +); + +while () { + for my $c (split //, $_) { + my $char = $DICT{lc $c}; + print "$char " if defined $char; + } + print "\n"; +} -- cgit v1.2.3 From 14c314de83c9de3353aae29cf356695756d497ac Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 00:24:35 -0300 Subject: etc/guix/home.scm: Use #~ and #$ over ` and , --- etc/guix/home.scm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index ddf1266..661a181 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -31,15 +31,15 @@ (name "msmtp-non-hardcoded") (arguments (substitute-keyword-arguments (package-arguments msmtp) - ((#:phases phases '%standard-phases) - `(modify-phases ,phases - (add-after 'install-additional-files 'patch-hardcoded-paths - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out"))) - (substitute* (string-append out "/bin/msmtpq") - (("^LOG=.*$") "LOG=$XDG_LOG_HOME/msmtpq.log\n") - (("^Q=.*$") "Q=$XDG_DATA_HOME/msmtp/queue\n") - (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'install-additional-files 'patch-hardcoded-paths + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out"))) + (substitute* (string-append out "/bin/msmtpq") + (("^LOG=.*$") "LOG=$XDG_LOG_HOME/msmtpq.log\n") + (("^Q=.*$") "Q=$XDG_DATA_HOME/msmtp/queue\n") + (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) (define (with-options pkg bin opts) (package -- cgit v1.2.3 From 150b9b60ab7b3271225c1e5993118f8437914ea7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 18:31:07 -0300 Subject: bin/update: Add almost-working script --- bin/update | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100755 bin/update diff --git a/bin/update b/bin/update new file mode 100755 index 0000000..7ec5bd8 --- /dev/null +++ b/bin/update @@ -0,0 +1,80 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + update + update -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + Updates miscellaneous things on the workstation: + - "guix pull" on the "andreh" and "root" accounts; + - get latest RFCs; + - updates RSS feeds; + - updates source code repositories. + + + Examples: + + Just use it: + + $ update + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +guix pull & + +{ + pass show velhinho/0-andreh-password | + head -n1 | + sudo -iS guix pull +} & + +wait + +rfc -u +newsboat -x reload + +# FIXME +# mr -j "$N_PROC" fetch # git pull for all repos under ~/dev/ -- cgit v1.2.3 From dc91445255bab20bf8efb3f90a836520eb2764f9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 18:36:08 -0300 Subject: bin/playlist: Add working version --- bin/playlist | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100755 bin/playlist diff --git a/bin/playlist b/bin/playlist new file mode 100755 index 0000000..bd01d23 --- /dev/null +++ b/bin/playlist @@ -0,0 +1,103 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + playlist ACTION + playlist -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + ACTION one of: + - prompt + - run + + + Manage the playlist. + + + Examples: + + Enqueue a video: + + $ playlist prompt + + + Play the next video in the queue: + + $ playlist run + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) +ACTION="${1:-}" + +eval "$(assert-arg "$ACTION" 'ACTION')" + +F="$XDG_DATA_HOME"/euandreh/playlist.txt + +prompt() { + ENTRY="$(zenity --text 'URL of the video to enqueue:' --entry ||:)" + if [ -n "$ENTRY" ]; then + echo "$ENTRY" >> "$F" + fi +} + +run() { + next="$(head -n1 "$F")" + if [ -z "$next" ]; then + return + fi + mpv "$next" + echo "$next" >> "queue.$F" + tail -n+2 "$F" | sponge "$F" +} + +case "$ACTION" in + prompt) + prompt + ;; + run) + run + ;; + *) + printf 'Bad ACTION: %s.\n\n' "$ACTION" >&2 + usage >&2 + exit 2 + ;; +esac -- cgit v1.2.3 From 255e2c8fac40273a8cf001bf1f578a7f1bf18023 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 18:49:03 -0300 Subject: bin/stopwatch: Add working version --- bin/stopwatch | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 bin/stopwatch diff --git a/bin/stopwatch b/bin/stopwatch new file mode 100755 index 0000000..3d5cd07 --- /dev/null +++ b/bin/stopwatch @@ -0,0 +1,65 @@ +#!/bin/sh +set -eu + + +usage() { + cat <<-'EOF' + Usage: + stopwatch + stopwatch -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + Run a TUI stopwatch. + + + Examples: + + Just run it: + + $ stopwatch + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +date "+%l:%M:%S%p: stopwatch started (^D to stop)" +time cat +date "+%l:%M:%S%p: stopwatch stopped" -- cgit v1.2.3 From 9c79dbda973a375db32cc9bbc69903de49e7377e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 18:55:19 -0300 Subject: bin/tuivid: Add working version --- bin/tuivid | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 bin/tuivid diff --git a/bin/tuivid b/bin/tuivid new file mode 100755 index 0000000..54bddcf --- /dev/null +++ b/bin/tuivid @@ -0,0 +1,65 @@ +#!/bin/sh +set -eu + + +usage() { + cat <<-'EOF' + Usage: + tuivid FILE + tuivid -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + FILE the name of the video file + + + Play a video in the terminal, withut X or a GUI. + + + Examples: + + Play "movie.mp4": + + $ tuivid movie.mp4 + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +exec mpv --quiet --vo=tct --vo-tct-256=yes --vo-tct-algo=plain --framedrop=vo "$@" -- cgit v1.2.3 From 6d3b1e32f80f3a450d30bec461e0a1993112d5d1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 18:58:19 -0300 Subject: bin/volume: Add working version --- bin/volume | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100755 bin/volume diff --git a/bin/volume b/bin/volume new file mode 100755 index 0000000..991fbc7 --- /dev/null +++ b/bin/volume @@ -0,0 +1,112 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + volume ACTION + volume -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + ACTION one of: + - up + - down + - toggle + - rotate + + + Manage the audio output. + + + Examples: + + Increase the volume: + + $ volume up + + + Toggle mute/unmute in the current audio output: + + $ volume toggle + + + Change the audio output: + + $ volume rotate + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) +ACTION="${1:-}" + +eval "$(assert-arg "$ACTION" 'ACTION')" + + +rotate() { + # This script assumes that at most 2 sinks exist at any time. + # When this premise is no longer true, it needs to be upgraded. + + CURRENT="$(pacmd list-sinks | grep '\* index' | cut -d: -f2 | tr -d ' ')" + OTHER="$(pacmd list-sinks | grep index | grep -v '\* index' | tail -n1 | cut -d: -f2 | tr -d ' ')" + + if [ "$CURRENT" = 0 ]; then + pacmd set-default-sink "$OTHER" + else + pacmd set-default-sink 0 + fi +} + +case "$ACTION" in + up) + pactl set-sink-volume @DEFAULT_SINK@ +10% + ;; + down) + pactl set-sink-volume @DEFAULT_SINK@ -10% + ;; + toggle) + pactl set-sink-mute @DEFAULT_SINK@ toggle + ;; + rotate) + rotate + ;; + *) + printf 'Bad ACTION: %s.\n\n' "$ACTION" >&2 + usage >&2 + exit 2 + ;; +esac -- cgit v1.2.3 From c0c56ca94733ab495cb3070c5bef2f2a82e6bb2b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 18:59:11 -0300 Subject: bin/pb: Add as hard-coded symlinks --- bin/pb | 1 + 1 file changed, 1 insertion(+) create mode 120000 bin/pb diff --git a/bin/pb b/bin/pb new file mode 120000 index 0000000..846a996 --- /dev/null +++ b/bin/pb @@ -0,0 +1 @@ +/home/andreh/dev/published/euandre.org/src/bin/pb \ No newline at end of file -- cgit v1.2.3 From 838fa8198d514c8e3b14e3ccf917790a0be646b5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 19:08:18 -0300 Subject: bin/lines: Add working version --- bin/lines | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 bin/lines diff --git a/bin/lines b/bin/lines new file mode 100755 index 0000000..b2558b8 --- /dev/null +++ b/bin/lines @@ -0,0 +1,81 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + lines START [END] + lines -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + START the nth line number to start showing + END the nth line number to stop + showing (default: START + 1) + + + Print the range START-END of lines of the content of STDIN. + + + Examples: + + Print 3rd line: + + $ seq 10 | lines 3 + 3 + + + Print lines 5~8: + + $ lines 5 8 < file.txt + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +START="${1:-}" + +if [ -z "${2:-}" ]; then + END=1 +else + END=$(($2 - $START + 1)) +fi + +eval "$(assert-arg "$START" 'START')" + +tail -n +"$START" | head -n "$END" -- cgit v1.2.3 From 9f8e9ca03f7e7a6512a6429c063a7cabafb98293 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 19:32:27 -0300 Subject: bin/menu: Implement "yubikey" ACTION using ykman --- bin/menu | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/menu b/bin/menu index 242c7c0..532e123 100755 --- a/bin/menu +++ b/bin/menu @@ -100,8 +100,8 @@ case "$ACTION" in CHOICE="$(pass_list | show 'username')" if [ -n "$CHOICE" ]; then if pass show -c2 "$CHOICE"; then - notify-send -t 5000 -u normal -- "$CHOICE" \ - 'username copied to clipboard' + notify-send -t 5000 -u normal -- \ + "$CHOICE" 'username copied to clipboard' fi fi ;; @@ -111,8 +111,8 @@ case "$ACTION" in echo trap 'clipctl enable' EXIT # FIXME echo clipctl disable if pass show -c1 "$CHOICE"; then - notify-send -t 5000 -u critical -- "$CHOICE" \ - 'password copied to clipboard' + notify-send -t 5000 -u critical -- \ + "$CHOICE" 'password copied to clipboard' fi fi ;; @@ -123,8 +123,14 @@ case "$ACTION" in clipmgr -l | show 'clipboard' | copy ;; yubikey) - echo 'yubikey-oath-dmenu' # FIXME - exit 2 + CHOICE="$(ykman oath accounts list | show 'OTP')" + if [ -n "$CHOICE" ]; then + ykman oath accounts code "$CHOICE" | + awk '{ print $(NF) }' | + copy -n + notify-send -t 5000 -u critical -- \ + "$CHOICE" 'code copied to clipboard' + fi ;; *) printf 'Bad ACTION: %s.\n\n' "$ACTION" >&2 -- cgit v1.2.3 From 569fd1018f289fe14fd6ffd48fb671e0849b5c16 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 22:59:42 -0300 Subject: bin/x: Add semi-working version No support for the '|' pipe operator. --- bin/x | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100755 bin/x diff --git a/bin/x b/bin/x new file mode 100755 index 0000000..ed967a5 --- /dev/null +++ b/bin/x @@ -0,0 +1,94 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + x COMMANDS... [ '&&' / '||' / '|' ] COMMANDS... + x -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + COMMAND the command to be executed + && "AND" logical operator + || "OR" logical operator + | pipe operator + + + Run command chained together with operators. + + + Examples: + + Measure the time of two commands: + + $ time x sleep 1 '&&' sleep 2 + # same as: + $ time sh -c 'sleep 1 && sleep 2' + + + Notify when either of the commands finish: + + $ boop x cmd-1 '||' cmd-2 + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +CMD='' +for arg in "$@"; do + case "$arg" in + '&&'|'||') + set +e + sh -c "$CMD" + STATUS=$? + set -e + CMD='' + if [ "$arg" = '&&' ] && [ "$STATUS" != 0 ]; then + exit "$STATUS" + elif [ "$arg" = '||' ] && [ "$STATUS" = 0 ]; then + exit 0 + fi + ;; + *) + CMD="$CMD${CMD:+ }'$arg'" + ;; + esac +done + +sh -c "$CMD" -- cgit v1.2.3 From 60f8f9634ecdfa1d1df384549d4fb56dfdfe6e60 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 23:16:40 -0300 Subject: etc/guix/current: Remove commited Guix symlink --- etc/guix/current | 1 - 1 file changed, 1 deletion(-) delete mode 120000 etc/guix/current diff --git a/etc/guix/current b/etc/guix/current deleted file mode 120000 index 720f941..0000000 --- a/etc/guix/current +++ /dev/null @@ -1 +0,0 @@ -/var/guix/profiles/per-user/andreh/current-guix \ No newline at end of file -- cgit v1.2.3 From 2b6448cede5555c9d68eb216963fa6f6ef6751ca Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 22 Aug 2022 07:21:48 -0300 Subject: etc/guix/home.scm: Add packages --- etc/guix/home.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 661a181..0f4d7bf 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -241,6 +241,7 @@ pinentry-gtk2 bmake make + tup autoconf automake libtool @@ -345,12 +346,14 @@ python-docx python-telegram-bot python-docutils + python-mkdocs valgrind flex bison gcc-toolchain clang-toolchain tcc + fuse node quickjs m4 -- cgit v1.2.3 From 7326453a2b7017b28611bdbf8131acf30971698d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 22 Aug 2022 07:22:07 -0300 Subject: etc/i3/config: Add keybinding for yubikey menu --- etc/i3/config | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/etc/i3/config b/etc/i3/config index d91c95c..06e578b 100644 --- a/etc/i3/config +++ b/etc/i3/config @@ -55,11 +55,12 @@ bindsym $mod+Shift+q kill -bindsym $mod+p exec menu bin -bindsym $mod+o exec menu emoji -bindsym $mod+v exec menu clipboard -bindsym $mod+i exec menu password -bindsym $mod+Control+i exec menu username +bindsym $mod+p exec menu bin +bindsym $mod+o exec menu emoji +bindsym $mod+v exec menu clipboard +bindsym $mod+i exec menu password +bindsym $mod+Control+i exec menu username +bindsym $mod+Control+Shift+i exec menu yubikey -- cgit v1.2.3 From 66e95bd4eac97fa597df5003ab07e325bc024be0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 22 Aug 2022 07:23:35 -0300 Subject: etc/sh/cronjob.sh: Tweak help string --- etc/sh/cronjob.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/sh/cronjob.sh b/etc/sh/cronjob.sh index 80b48b4..1e11b50 100755 --- a/etc/sh/cronjob.sh +++ b/etc/sh/cronjob.sh @@ -29,7 +29,7 @@ help() { Run a backup: - $ cronjob backup cron + $ cronjob backup -q cron EOF } -- cgit v1.2.3 From 4a5cd4c684a86377d687c43695247c39f754eb18 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 22 Aug 2022 07:24:02 -0300 Subject: etc/ssh/known_hosts: Add entry --- etc/ssh/known_hosts | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/ssh/known_hosts b/etc/ssh/known_hosts index 0ee722e..95c62d9 100644 --- a/etc/ssh/known_hosts +++ b/etc/ssh/known_hosts @@ -73,3 +73,4 @@ git.2f30.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSLZ4G5w4NysBUmAHmr6/V9om42IHS [gerrit.wikimedia.org]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCF8pwFLehzCXhbF1jfHWtd9d1LFq2NirplEBQYs7AOrGwQ/6ZZI0gvZFYiEiaw1o+F1CMfoHdny1VfWOJF3mJ1y9QMKAacc8/Z3tG39jBKRQCuxmYLO1SWymv7/Uvx9WQlkNRoTdTTa9OJFy6UqvLQEXKYaokfMIUHZ+oVFf1CgQ== 2001:19f0:5:1d65:5400:3ff:fee3:7463 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF2EgU3IgCwv1ynnWfxFm0SHTSoE0AYG3MJT/TpN3pBz [camarada.site]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 +149.28.21.56 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK2cITa9TuC3lzEihIfFYb0KhyJJ5Vg2vnGW1SMMwxhc -- cgit v1.2.3 From 30a05bf9176867bf3a89529301e2926aef2d13ca Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 22 Aug 2022 18:16:09 -0300 Subject: bin/nato: Add missing handling of -h flag --- bin/nato | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/nato b/bin/nato index 6ea66b5..75c208e 100755 --- a/bin/nato +++ b/bin/nato @@ -49,6 +49,12 @@ if (!Getopt::Std::getopts('h', \%opts)) { exit 2; } +if ($opts{h}) { + usage *STDOUT; + help *STDOUT; + exit; +} + my %DICT = ( 'a' => 'Alfa', 'b' => 'Bravo', -- cgit v1.2.3 From ec23bfac1c8a4ffc66b2b5e429a5edd4e1afa54a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 22 Aug 2022 18:19:33 -0300 Subject: etc/sh/rc: Remove redundant mkdir arguments --- etc/sh/rc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/etc/sh/rc b/etc/sh/rc index 33b01bc..afd7391 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -13,10 +13,6 @@ export XDG_DATA_DIRS="$XDG_DATA_HOME/flatpak/exports/share:/var/lib/flatpak/expo mkdir -p \ "$XDG_CONFIG_HOME" \ - "$XDG_CACHE_HOME" \ - "$XDG_DATA_HOME" \ - "$XDG_STATE_HOME" \ - "$XDG_LOG_HOME" \ "$XDG_CACHE_HOME/euandreh" \ "$XDG_DATA_HOME/euandreh" \ "$XDG_STATE_HOME/euandreh" \ -- cgit v1.2.3 From 33c8ff8237458d389aa91d906441d005785263c1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 24 Aug 2022 17:49:36 -0300 Subject: etc/guix/home.scm: Move backup cronjob back one hour The run from yesterday night took too long, for some reason, and it went past 6AM today. Because of that, the 6AM job that fetches email didn't have a message of job report to fetch. When I checked my email today, I saw the backup job reports from both servers, but not velhinho, because it finished after 6AM. This may still happen, as there is no limit on how long a backup can take, but it at least diminishes the likelyhood for it to happen again. --- etc/guix/home.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 0f4d7bf..b9f5659 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -190,7 +190,7 @@ #~(job "0 0 * * *" "cronjob msmtp-queue -r") #~(job "0 0 * * *" "cronjob check") #~(job "5 */6 * * *" "cronjob m") - #~(job "30 1 * * *" "cronjob backup -q cron"))) + #~(job "30 0 * * *" "cronjob backup -q cron"))) (home-environment -- cgit v1.2.3 From 06d2acf6fdd5fd2dacb22841727bf7d9a3a71d45 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 24 Aug 2022 17:55:54 -0300 Subject: bin/check: Call out command-specific tests --- bin/check | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/check b/bin/check index b3df0be..6dddc8b 100755 --- a/bin/check +++ b/bin/check @@ -75,6 +75,10 @@ if ! git -C "$PRIV" diff --quiet || ! git -C "$PRIV" diff --quiet --staged; then exit 1 fi +for f in opt/tests/*; do + sh "$f" +done + # FIXME: # verify that the expiry date on the GPG key is greater than 1 year # assert git pushed -- cgit v1.2.3 From 2306da1337af68689678f7a0858f68e9b2a83b8e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 24 Aug 2022 19:30:23 -0300 Subject: etc/sh/rc: Use -r over -e test when sourcing files --- etc/sh/rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/sh/rc b/etc/sh/rc index afd7391..a08da74 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -19,7 +19,7 @@ mkdir -p \ "$XDG_LOG_HOME/euandreh" GUIX_PROFILE="$XDG_CONFIG_HOME"/guix/current -if [ -e "$GUIX_PROFILE"/etc/profile ]; then +if [ -r "$GUIX_PROFILE"/etc/profile ]; then . "$GUIX_PROFILE"/etc/profile fi @@ -261,7 +261,7 @@ case $- in esac F="$XDG_CONFIG_HOME"/sh/privrc.sh -if [ -e "$F" ]; then +if [ -r "$F" ]; then # Extra rc code to be loaded, stored in private repository . "$F" fi -- cgit v1.2.3 From 501575f0eebacecdddac9b6db3794714b5797b36 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 24 Aug 2022 19:31:37 -0300 Subject: etc/sh/rc: Separate interactive from non-interactive section with an early return --- etc/sh/rc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/etc/sh/rc b/etc/sh/rc index a08da74..9664940 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -284,12 +284,19 @@ export HISTCONTROL=ignorespace:ignoredups eval "$(direnv hook bash)" + +# +# From here on, interactive-only bash-specific things. +# + case $- in *i*) - for f in "$HOME_ENVIRONMENT"/profile/etc/bash_completion.d/*; do - . "$f" - done ;; *) + return ;; esac + +for f in "$HOME_ENVIRONMENT"/profile/etc/bash_completion.d/*; do + . "$f" +done -- cgit v1.2.3 From 4b3849eb18a95d93240258262350e8fcf1b63dd5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 24 Aug 2022 19:32:53 -0300 Subject: etc/sh/rc: Load autojump code --- etc/sh/rc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/etc/sh/rc b/etc/sh/rc index 9664940..ad3115b 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -297,6 +297,13 @@ case $- in ;; esac +# IIRC, the Guix profile should do this for f in "$HOME_ENVIRONMENT"/profile/etc/bash_completion.d/*; do . "$f" done + +# IIRC, the Guix package should do this +F="$HOME_ENVIRONMENT"/profile/share/autojump/autojump.bash +if [ -r "$F" ]; then + . "$F" +fi -- cgit v1.2.3 From a58ea37d21e2cb9e02bcf24f386b623198c50744 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 24 Aug 2022 19:33:50 -0300 Subject: etc/sh/vcs-ps1.sh: Exclude autojump process from job count --- etc/sh/vcs-ps1.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/sh/vcs-ps1.sh b/etc/sh/vcs-ps1.sh index d18a24a..b9a849a 100644 --- a/etc/sh/vcs-ps1.sh +++ b/etc/sh/vcs-ps1.sh @@ -128,7 +128,7 @@ shell_status_level() { } shell_status_jobs() { - JOBS="$(jobs -p | wc -l)" + JOBS="$(jobs | grep -v autojump | wc -l)" if [ "$JOBS" != 0 ]; then color -c red "$JOBS" fi -- cgit v1.2.3 From 21a5bf4d7b1173bb6cffadfb8ad6c350e65e592f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 25 Aug 2022 06:16:38 -0300 Subject: bin/gc: Use proper $TMPDIR over hardcoded /tmp path --- bin/gc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/gc b/bin/gc index 1ef92f1..9a1868b 100755 --- a/bin/gc +++ b/bin/gc @@ -79,7 +79,7 @@ gc_trash() { } gc_tmpdir() { - find /tmp/ -type f -atime +10 -exec rm -vf "{}" \; ||: + find "${TMPDIR:-/tmp}" -type f -atime +10 -exec rm -vf "{}" \; ||: } gc_docker() { -- cgit v1.2.3 From 44956eb779b11267b04ffb1d5fadf6a809037f06 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 25 Aug 2022 06:17:08 -0300 Subject: etc/sh/rc: Define and use $PRIV_CONFIG path --- etc/sh/rc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/sh/rc b/etc/sh/rc index ad3115b..f247270 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -47,6 +47,7 @@ export XDG_DATA_DIRS="$XDG_DATA_HOME/flatpak/exports/share:/var/lib/flatpak/expo export HISTSIZE=-1 export HISTFILE="$XDG_STATE_HOME/sh-history" export SRC=~/dev +export PRIV_CONFIG="$XDG_PREFIX"/var/lib/private/tilde export EDITOR='e' export VISUAL="$EDITOR" export PAGER='less -R' @@ -260,7 +261,7 @@ case $- in ;; esac -F="$XDG_CONFIG_HOME"/sh/privrc.sh +F="$PRIV_CONFIG"/privrc.sh if [ -r "$F" ]; then # Extra rc code to be loaded, stored in private repository . "$F" -- cgit v1.2.3 From 8211da295f5ca90ae810d3f6067397958a4447f0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 25 Aug 2022 06:19:56 -0300 Subject: opt/tests/x-tests.sh: Add WIP test file --- opt/tests/x-tests.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 opt/tests/x-tests.sh diff --git a/opt/tests/x-tests.sh b/opt/tests/x-tests.sh new file mode 100755 index 0000000..fe46354 --- /dev/null +++ b/opt/tests/x-tests.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -eu + +x echo +x echo '&&' echo -- cgit v1.2.3 From e6339fe576ba4a4bc3beb62df8a0684bd0d77a16 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 25 Aug 2022 06:20:25 -0300 Subject: etc/tmux/tmux.conf: Use $XDG_RUNTIME_DIR over /tmp for urlscan-buffer file --- etc/tmux/tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/tmux/tmux.conf b/etc/tmux/tmux.conf index f2da33b..20468aa 100644 --- a/etc/tmux/tmux.conf +++ b/etc/tmux/tmux.conf @@ -82,5 +82,5 @@ bind-key t resize-pane -x 80 bind -n M-r attach-session -t . -c '#{pane_current_path}' \; display-message "CWD for session updated to #{pane_current_path}!" -bind-key u capture-pane \; save-buffer /tmp/tmux-urlscan-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan < /tmp/tmux-urlscan-buffer"' +bind-key u capture-pane \; save-buffer $XDG_RUNTIME_DIR/tmux-urlscan-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan < $XDG_RUNTIME_DIR/tmux-urlscan-buffer"' bind-key - last -- cgit v1.2.3 From 0c6c742db37a57cfc624d1da659a1c60d27283c8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 25 Aug 2022 22:41:14 -0300 Subject: bin/menu: Demote "menu yubikey" notification from critical to normal --- bin/menu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/menu b/bin/menu index 532e123..53f10e6 100755 --- a/bin/menu +++ b/bin/menu @@ -128,7 +128,7 @@ case "$ACTION" in ykman oath accounts code "$CHOICE" | awk '{ print $(NF) }' | copy -n - notify-send -t 5000 -u critical -- \ + notify-send -t 5000 -u normal -- \ "$CHOICE" 'code copied to clipboard' fi ;; -- cgit v1.2.3 From e9790762574fefd6b6e363800c1e890386b66b43 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 25 Aug 2022 22:41:54 -0300 Subject: etc/guix/home.scm: Remove packages that come from package-repository Instead, I'm using the locally installed versions. --- etc/guix/home.scm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index b9f5659..c50cb09 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -388,10 +388,6 @@ zenity util-linux guile - ;; git-permalink - ;; remembering - ;; guile-heredoc - ;; td guile-heredoc-latest gzip xz -- cgit v1.2.3 From b63326220d1509bab7b9b033069bcf913ac11ea9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 25 Aug 2022 22:43:16 -0300 Subject: etc/guix/home.scm: Add DBI and DBD::SQLite Perl modules --- etc/guix/home.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index c50cb09..626dd5e 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -327,6 +327,8 @@ clojure-tools openjdk perl + perl-dbi + perl-dbd-sqlite perl-critic perl-json perl-mojolicious -- cgit v1.2.3 From 5bb2572db89df119d7ab4c72b01806a7355daa29 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 25 Aug 2022 23:07:21 -0300 Subject: etc/tmux/tmux.conf: Add and configure tmux-resurrect and tmux-continuum --- etc/tmux/tmux.conf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/etc/tmux/tmux.conf b/etc/tmux/tmux.conf index 20468aa..3e676d7 100644 --- a/etc/tmux/tmux.conf +++ b/etc/tmux/tmux.conf @@ -84,3 +84,12 @@ bind -n M-r attach-session -t . -c '#{pane_current_path}' \; display-message "CW bind-key u capture-pane \; save-buffer $XDG_RUNTIME_DIR/tmux-urlscan-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan < $XDG_RUNTIME_DIR/tmux-urlscan-buffer"' bind-key - last + + +# $XDG_DATA_HOME variable isn't allowed by tmux-resurrect +set -g @resurrect-dir '~/.usr/share/tmux/resurrect' +set -g @continuum-restore 'on' +set -g @resurrect-capture-pane-contents 'on' +set -g @resurrect-processes '~ssh ~e "~alot->alot" "~ranger->ranger" "~newsboat->newsboat" "~entr->entr" "~git->git" "~info->info"' +run-shell ~/dev/tmux/tmux-resurrect/resurrect.tmux +run-shell ~/dev/tmux/tmux-continuum/continuum.tmux -- cgit v1.2.3 From 2273b9f5648eb844369941350f99abfb8b6d27bb Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 29 Aug 2022 22:08:40 -0300 Subject: etc/ssh/known_hosts: Add camarada.site entry --- etc/ssh/known_hosts | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/ssh/known_hosts b/etc/ssh/known_hosts index 95c62d9..b7e6d6c 100644 --- a/etc/ssh/known_hosts +++ b/etc/ssh/known_hosts @@ -74,3 +74,4 @@ git.2f30.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSLZ4G5w4NysBUmAHmr6/V9om42IHS 2001:19f0:5:1d65:5400:3ff:fee3:7463 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF2EgU3IgCwv1ynnWfxFm0SHTSoE0AYG3MJT/TpN3pBz [camarada.site]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 149.28.21.56 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK2cITa9TuC3lzEihIfFYb0KhyJJ5Vg2vnGW1SMMwxhc +camarada.site ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 -- cgit v1.2.3 From 375378e93025f347ce4ed596d908959c1298520e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 1 Sep 2022 15:44:20 -0300 Subject: bin/slugify: Add new (working) utility --- bin/slugify | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 bin/slugify diff --git a/bin/slugify b/bin/slugify new file mode 100755 index 0000000..aa3b50a --- /dev/null +++ b/bin/slugify @@ -0,0 +1,69 @@ +#!/bin/sh +set -eu + + +usage() { + cat <<-'EOF' + Usage: + slugify < STDIN + slugify -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + "slugify" the input string, removing diacritics and punctuation + from the string, on a best-effort basis. + + + Examples: + + Slugify the input string: + + $ echo 'Saçi-pererê, tomando açaí!!' | slugify + saci-perere-tomando-acai + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + esac +done +shift $((OPTIND - 1)) + +iconv -ct ASCII//TRANSLIT | + tr '[:upper:]' '[:lower:]' | + sed \ + -e 's/[^a-z0-9]/-/g' \ + -e 's/--*/-/g' \ + -e 's/^-//' \ + -e 's/-$//' -- cgit v1.2.3 From e65b4793a7ffb689fe201b23ee7025472f4ec448 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 1 Sep 2022 16:33:55 -0300 Subject: bin/html: Add new working utility --- bin/html | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100755 bin/html diff --git a/bin/html b/bin/html new file mode 100755 index 0000000..f3f23de --- /dev/null +++ b/bin/html @@ -0,0 +1,96 @@ +#!/bin/sh +set -eu + + +usage() { + cat <<-'EOF' + Usage: + html [-e|d] + html -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -e escape the string (the default action) + -d unescape (de-escape?) the string + -h, --help show this message + + + Get a string from STDIN and convert it to/from HTML escaping. + + + Examples: + + oij + + $ printf 'a > 5 && !b' | html + a > 5 && !b + + + Unescape the content from a file: + + $ html -d < file.html + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +ENCODE=false +DECODE=false +while getopts 'edh' flag; do + case "$flag" in + e) + ENCODE=true + ;; + d) + DECODE=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ "$ENCODE" = true ] && [ "$DECODE" = true ]; then + printf 'Both -e and -d given. Pick one.\n' >&2 + usage >&2 + exit 2 +elif [ "$DECODE" = true ]; then + sed \ + -e 's|&|\&|g' \ + -e 's|<|<|g' \ + -e 's|>|>|g' \ + -e 's|"|"|g' \ + -e "s|'|'|g" +else + sed \ + -e 's|&|\&|g' \ + -e 's|<|\<|g' \ + -e 's|>|\>|g' \ + -e 's|"|\"|g' \ + -e "s|'|\'|g" +fi -- cgit v1.2.3 From 54aba709600d235ce1f22784779e9977b605edb2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 4 Sep 2022 14:46:40 -0300 Subject: bin/pb: Remove symlink --- bin/pb | 1 - 1 file changed, 1 deletion(-) delete mode 120000 bin/pb diff --git a/bin/pb b/bin/pb deleted file mode 120000 index 846a996..0000000 --- a/bin/pb +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/dev/published/euandre.org/src/bin/pb \ No newline at end of file -- cgit v1.2.3 From 72b20935866c22daa4fd75bd35229aa36e96f5d5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 4 Sep 2022 14:47:09 -0300 Subject: git mv bin/html bin/htmlesc --- bin/html | 96 ------------------------------------------------------------- bin/htmlesc | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 96 deletions(-) delete mode 100755 bin/html create mode 100755 bin/htmlesc diff --git a/bin/html b/bin/html deleted file mode 100755 index f3f23de..0000000 --- a/bin/html +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh -set -eu - - -usage() { - cat <<-'EOF' - Usage: - html [-e|d] - html -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -e escape the string (the default action) - -d unescape (de-escape?) the string - -h, --help show this message - - - Get a string from STDIN and convert it to/from HTML escaping. - - - Examples: - - oij - - $ printf 'a > 5 && !b' | html - a > 5 && !b - - - Unescape the content from a file: - - $ html -d < file.html - EOF -} - - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -ENCODE=false -DECODE=false -while getopts 'edh' flag; do - case "$flag" in - e) - ENCODE=true - ;; - d) - DECODE=true - ;; - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -if [ "$ENCODE" = true ] && [ "$DECODE" = true ]; then - printf 'Both -e and -d given. Pick one.\n' >&2 - usage >&2 - exit 2 -elif [ "$DECODE" = true ]; then - sed \ - -e 's|&|\&|g' \ - -e 's|<|<|g' \ - -e 's|>|>|g' \ - -e 's|"|"|g' \ - -e "s|'|'|g" -else - sed \ - -e 's|&|\&|g' \ - -e 's|<|\<|g' \ - -e 's|>|\>|g' \ - -e 's|"|\"|g' \ - -e "s|'|\'|g" -fi diff --git a/bin/htmlesc b/bin/htmlesc new file mode 100755 index 0000000..d9c59bd --- /dev/null +++ b/bin/htmlesc @@ -0,0 +1,96 @@ +#!/bin/sh +set -eu + + +usage() { + cat <<-'EOF' + Usage: + htmlesc [-e|d] + htmlesc -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -e escape the string (the default action) + -d unescape (de-escape?) the string + -h, --help show this message + + + Get a string from STDIN and convert it to/from HTML escaping. + + + Examples: + + oij + + $ printf 'a > 5 && !b' | htmlesc + a > 5 && !b + + + Unescape the content from a file: + + $ htmlesc -d < file.html + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +ENCODE=false +DECODE=false +while getopts 'edh' flag; do + case "$flag" in + e) + ENCODE=true + ;; + d) + DECODE=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ "$ENCODE" = true ] && [ "$DECODE" = true ]; then + printf 'Both -e and -d given. Pick one.\n' >&2 + usage >&2 + exit 2 +elif [ "$DECODE" = true ]; then + sed \ + -e 's|&|\&|g' \ + -e 's|<|<|g' \ + -e 's|>|>|g' \ + -e 's|"|"|g' \ + -e "s|'|'|g" +else + sed \ + -e 's|&|\&|g' \ + -e 's|<|\<|g' \ + -e 's|>|\>|g' \ + -e 's|"|\"|g' \ + -e "s|'|\'|g" +fi -- cgit v1.2.3 From 931cac47c81f909927f23888d82f7d02ce4b7023 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 4 Sep 2022 14:47:29 -0300 Subject: bin/uri: Improve example from help string --- bin/uri | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/uri b/bin/uri index 4e57f7c..23716b9 100755 --- a/bin/uri +++ b/bin/uri @@ -32,7 +32,8 @@ sub help($fh) { Encode the URL: - $ echo 'https://euandre.org' | uri + $ echo "https://euandre.org/?q=$(printf '%s' 'a param' | uri)" + https://euandre.org/?q=a%20param Decode the content from the file: -- cgit v1.2.3 From 7392a64f8f8d0a9ddc90cb46e04de2612c6e9c79 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 8 Sep 2022 07:16:18 -0300 Subject: mv etc/sbcl/sbclrc.lisp etc/common-lisp/init.lisp --- etc/common-lisp/init.lisp | 5 +++++ etc/sbcl/sbclrc.lisp | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 etc/common-lisp/init.lisp delete mode 100644 etc/sbcl/sbclrc.lisp diff --git a/etc/common-lisp/init.lisp b/etc/common-lisp/init.lisp new file mode 100644 index 0000000..0f01d57 --- /dev/null +++ b/etc/common-lisp/init.lisp @@ -0,0 +1,5 @@ +#-quicklisp +(let ((quicklisp-init (merge-pathnames "dev/quicklisp/setup.lisp" + (user-homedir-pathname)))) + (when (probe-file quicklisp-init) + (load quicklisp-init))) diff --git a/etc/sbcl/sbclrc.lisp b/etc/sbcl/sbclrc.lisp deleted file mode 100644 index df7f57a..0000000 --- a/etc/sbcl/sbclrc.lisp +++ /dev/null @@ -1,6 +0,0 @@ -;;; The following lines added by ql:add-to-init-file: -#-quicklisp -(let ((quicklisp-init (merge-pathnames "dev/quicklisp/setup.lisp" - (user-homedir-pathname)))) - (when (probe-file quicklisp-init) - (load quicklisp-init))) -- cgit v1.2.3 From 73918e11d3f419be185305493df25c638360a835 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 8 Sep 2022 17:59:18 -0300 Subject: git mv common-lisp/ lisp-cli/ --- etc/common-lisp/init.lisp | 5 ----- etc/lisp-cli/init.lisp | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 etc/common-lisp/init.lisp create mode 100644 etc/lisp-cli/init.lisp diff --git a/etc/common-lisp/init.lisp b/etc/common-lisp/init.lisp deleted file mode 100644 index 0f01d57..0000000 --- a/etc/common-lisp/init.lisp +++ /dev/null @@ -1,5 +0,0 @@ -#-quicklisp -(let ((quicklisp-init (merge-pathnames "dev/quicklisp/setup.lisp" - (user-homedir-pathname)))) - (when (probe-file quicklisp-init) - (load quicklisp-init))) diff --git a/etc/lisp-cli/init.lisp b/etc/lisp-cli/init.lisp new file mode 100644 index 0000000..0f01d57 --- /dev/null +++ b/etc/lisp-cli/init.lisp @@ -0,0 +1,5 @@ +#-quicklisp +(let ((quicklisp-init (merge-pathnames "dev/quicklisp/setup.lisp" + (user-homedir-pathname)))) + (when (probe-file quicklisp-init) + (load quicklisp-init))) -- cgit v1.2.3 From f1097703ac9064cbba02d6d7d4dd062215212a36 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 18 Sep 2022 23:32:13 -0300 Subject: bin/email: Add UTF-8 content-type header --- bin/email | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/email b/bin/email index c16ed62..deaf0f0 100755 --- a/bin/email +++ b/bin/email @@ -67,7 +67,7 @@ shift $((OPTIND - 1)) eval "$(assert-arg "${SUBJECT:-}" '-s SUBJECT')" eval "$(assert-arg "${1:-}" 'ADDRESS')" -printf 'Subject: %s\n\n%s' \ +printf 'Content-Type: text/plain; charset=UTF-8\nSubject: %s\n\n%s' \ "$(echo "$SUBJECT" | tr -d '\n')" \ "$(cat)" | msmtpq -a euandreh "$@" -- cgit v1.2.3 From f5eab253f25f01626d1da7d97574080c598babde Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 19 Sep 2022 20:42:29 -0300 Subject: Move Git config out of Guix Home, and use a "include" for the smtp command path --- etc/git/config | 21 +++++++++++++++++++++ etc/guix/home.scm | 28 +++++----------------------- 2 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 etc/git/config diff --git a/etc/git/config b/etc/git/config new file mode 100644 index 0000000..8b378a0 --- /dev/null +++ b/etc/git/config @@ -0,0 +1,21 @@ +[user] + email = eu@euandre.org + name = EuAndreh + signingkey = 81F90EC3CD356060 +[transfer] + fsckobjects = true +[push] + default = current +[commit] + gpgsign = true + verbose = true +[init] + defaultBranch = main +[sendemail] + assume8bitEncoding = UTF-8 + smtpserveroption = -a + smtpserveroption = euandreh + annotate = yes + confirm = never +[include] + path = config-extra diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 626dd5e..0b61883 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -94,28 +94,10 @@ (define (xdg-config-home s) (string-append (getenv "XDG_CONFIG_HOME") "/" s)) -(define gitconfig - (mixed-text-file "gitconfig" #"- - [user] - email = eu@euandre.org - name = EuAndreh - signingkey = 81F90EC3CD356060 - [transfer] - fsckobjects = true - [push] - default = current - [commit] - gpgsign = true - verbose = true - [init] - defaultBranch = main - [sendemail] - assume8bitEncoding = UTF-8 - smtpserveroption = -a - smtpserveroption = euandreh - annotate = yes - confirm = never - smtpserver = "# msmtp-non-hardcoded "/bin/msmtpq\n")) +(define gitconfig-extra + (mixed-text-file + "gitconfig-extra" + "[sendemail]\n smtpserver = " msmtp-non-hardcoded "/bin/msmtpq\n")) (define gpg-agent.conf (mixed-text-file "gpg-agent.conf" #"- @@ -140,7 +122,7 @@ (define config-files `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) - ("git/config" ,gitconfig) + ("git/config-extra" ,gitconfig-extra) ("ssh/config" ,ssh.conf))) (define dot-config -- cgit v1.2.3 From d5be0e02fff11e0d40c3e9b98daebf8442045f6a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 2 Oct 2022 07:53:27 -0300 Subject: etc/guix/system.scm: Add nix-service-type --- etc/guix/system.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index a4fbfac..3afee7e 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -9,6 +9,7 @@ (gnu services base) (gnu services cups) (gnu services desktop) + (gnu services nix) (gnu services security-token) (gnu services sound) (gnu services virtualization) @@ -80,6 +81,7 @@ (service libvirt-service-type) (service virtlog-service-type) (service unattended-upgrade-service-type) + (service nix-service-type) (service cups-service-type (cups-configuration (web-interface? #t))) -- cgit v1.2.3 From 7ce13600a5e039683e9619feb6a9a3b0535c4a36 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 2 Oct 2022 07:53:46 -0300 Subject: etc/guix/system.scm: Remove gnome-desktop-service-type --- etc/guix/system.scm | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 3afee7e..16222e0 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -77,7 +77,6 @@ (list (service bluetooth-service-type) (service pcscd-service-type) - (service gnome-desktop-service-type) (service libvirt-service-type) (service virtlog-service-type) (service unattended-upgrade-service-type) -- cgit v1.2.3 From 213cff8aa7a5df33f5488e3bf10af5b0f38272e3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 2 Oct 2022 07:54:17 -0300 Subject: etc/guix/system.scm: Remove xmonad packages --- etc/guix/system.scm | 3 --- 1 file changed, 3 deletions(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 16222e0..89c00ef 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -63,9 +63,6 @@ (map (compose list specification->package+output symbol->string) '(nss-certs i3-wm - xmonad-next - ghc-xmonad-contrib - ghc guile guile-heredoc-latest)) (list) -- cgit v1.2.3 From 0586552b58b7c9ad49a4f5457e85c0a17467ab61 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 2 Oct 2022 08:23:38 -0300 Subject: etc/guix/system.scm: Remove "Other Self" account --- etc/guix/system.scm | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 89c00ef..8072b4f 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -44,19 +44,12 @@ (host-name "velhinho") (users (append - (let ((user-groups '("netdev" "audio" "video")) - (admin-groups '("wheel"))) - (list - (user-account - (name "andreh") - (comment "EuAndreh") - (group "users") - (supplementary-groups (append admin-groups user-groups))) - (user-account - (name "other") - (comment "Other Self") - (group "users") - (supplementary-groups user-groups)))) + (list + (user-account + (name "andreh") + (comment "EuAndreh") + (group "users") + (supplementary-groups '("netdev" "audio" "video" "wheel")))) %base-user-accounts)) (packages (append -- cgit v1.2.3 From 34a981ac1db3040cbc84f13547c63de0d87d074f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 8 Oct 2022 11:48:07 -0300 Subject: etc/guix/home.scm: Stop generating "etc/ssh/config" file OpenSSH support ${ENVVAR} in its config, so there is no need to generated the file to get its value dynamically. --- etc/guix/home.scm | 15 +-------------- etc/ssh/config | 5 +++++ 2 files changed, 6 insertions(+), 14 deletions(-) create mode 100644 etc/ssh/config diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 0b61883..6835efc 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -108,22 +108,9 @@ enable-ssh-support pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) -(define ssh.conf - (plain-file "ssh.conf" - (string-replace-substring #"- - Host * - UserKnownHostsFile @XDG_CONFIG_HOME@/ssh/known_hosts - - Include ~/dev/libre/servers/src/infrastructure/ssh.conf - Include ~/dev/others/lawtech/src/infrastructure/ssh.conf - "# - "@XDG_CONFIG_HOME@" - (getenv "XDG_CONFIG_HOME")))) - (define config-files `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) - ("git/config-extra" ,gitconfig-extra) - ("ssh/config" ,ssh.conf))) + ("git/config-extra" ,gitconfig-extra))) (define dot-config (let ((prefix-with-config diff --git a/etc/ssh/config b/etc/ssh/config new file mode 100644 index 0000000..8df05c0 --- /dev/null +++ b/etc/ssh/config @@ -0,0 +1,5 @@ +Host * + UserKnownHostsFile ${XDG_CONFIG_HOME}/ssh/known_hosts + +Include ~/dev/libre/servers/src/infrastructure/ssh.conf +Include ~/dev/others/lawtech/src/infrastructure/ssh.conf -- cgit v1.2.3 From 42cd0d155ae884f8e362666c35fdccd389523402 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 10 Oct 2022 17:34:37 -0300 Subject: etc/git/config: Always fetch the notes from "origin" remotes --- etc/git/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/git/config b/etc/git/config index 8b378a0..27486cf 100644 --- a/etc/git/config +++ b/etc/git/config @@ -17,5 +17,7 @@ smtpserveroption = euandreh annotate = yes confirm = never +[remote "origin"] + fetch = +refs/notes/*:refs/notes/* [include] path = config-extra -- cgit v1.2.3 From 28d33d4692c7a4e76ac50a974c7298b90f52f8c9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 10 Oct 2022 17:34:57 -0300 Subject: etc/git/ignore: Ignore /vendor/ directories by default --- etc/git/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/git/ignore b/etc/git/ignore index 37a4b27..9103c3d 100644 --- a/etc/git/ignore +++ b/etc/git/ignore @@ -1,2 +1,3 @@ /tmp/ /FIXME +/vendor/ -- cgit v1.2.3 From 0098984a613dd0802b57f15b2f263d6993b729cb Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 10 Oct 2022 17:36:24 -0300 Subject: etc/tmux/tmux.conf: Save continuum data once every hour Instead of the default [0] of 15 minutes. [0]: https://github.com/tmux-plugins/tmux-continuum/blob/6e58336c288958a3b1ff7773fb945770126db16e/scripts/variables.sh#L8 --- etc/tmux/tmux.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/tmux/tmux.conf b/etc/tmux/tmux.conf index 3e676d7..08a1bd9 100644 --- a/etc/tmux/tmux.conf +++ b/etc/tmux/tmux.conf @@ -89,6 +89,7 @@ bind-key - last # $XDG_DATA_HOME variable isn't allowed by tmux-resurrect set -g @resurrect-dir '~/.usr/share/tmux/resurrect' set -g @continuum-restore 'on' +set -g @continuum-save-interval '60' set -g @resurrect-capture-pane-contents 'on' set -g @resurrect-processes '~ssh ~e "~alot->alot" "~ranger->ranger" "~newsboat->newsboat" "~entr->entr" "~git->git" "~info->info"' run-shell ~/dev/tmux/tmux-resurrect/resurrect.tmux -- cgit v1.2.3 From 219cca48ea4a08e20cc1b07d7473ca99afff5d82 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 10 Oct 2022 17:38:38 -0300 Subject: etc/tmux/tmux.conf: Add "make" to the allow-list of ressurectable commands --- etc/tmux/tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/tmux/tmux.conf b/etc/tmux/tmux.conf index 08a1bd9..4f4bd34 100644 --- a/etc/tmux/tmux.conf +++ b/etc/tmux/tmux.conf @@ -91,6 +91,6 @@ set -g @resurrect-dir '~/.usr/share/tmux/resurrect' set -g @continuum-restore 'on' set -g @continuum-save-interval '60' set -g @resurrect-capture-pane-contents 'on' -set -g @resurrect-processes '~ssh ~e "~alot->alot" "~ranger->ranger" "~newsboat->newsboat" "~entr->entr" "~git->git" "~info->info"' +set -g @resurrect-processes '~make ~ssh ~e "~alot->alot" "~ranger->ranger" "~newsboat->newsboat" "~entr->entr" "~git->git" "~info->info"' run-shell ~/dev/tmux/tmux-resurrect/resurrect.tmux run-shell ~/dev/tmux/tmux-continuum/continuum.tmux -- cgit v1.2.3 From 5fd34df3755fc5348ba119691cbab81d836ddf7f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 10 Oct 2022 17:43:47 -0300 Subject: bin/wms: Add new working binary, and integrate it with i3 --- bin/wms | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ etc/i3/config | 3 ++ 2 files changed, 98 insertions(+) create mode 100755 bin/wms diff --git a/bin/wms b/bin/wms new file mode 100755 index 0000000..6fe895e --- /dev/null +++ b/bin/wms @@ -0,0 +1,95 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + wms ACTION + wms -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + ACTION one of: + - uuid + - date + - clear-notification + + + Helper script to launch CLI commands, without having complex + quoting, piping, flow control, etc. clutter the wm configuration + file. + + + Examples: + + Generate a new UUID, copy it to the clipboard and send a + desktop notification: + + $ wms uuid + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) +ACTION="${1:-}" + +eval "$(assert-arg "$ACTION" 'ACTION')" + + +copy_and_notify() { + STR="$1" + LABEL="$2" + printf '%s' "$STR" | copy -n + notify-send -t 5000 -u normal -- \ + "$STR" "$LABEL copied to clipboard" +} + +case "$ACTION" in + uuid) + copy_and_notify "$(uuid)" 'UUID' + ;; + date) + copy_and_notify "$(date '+%Y-%m-%d')" 'date' + ;; + clear-notification) + dunstctl close + ;; + *) + printf 'Bad ACTION: %s.\n\n' "$ACTION" >&2 + usage >&2 + exit 2 + ;; +esac diff --git a/etc/i3/config b/etc/i3/config index 06e578b..9637c28 100644 --- a/etc/i3/config +++ b/etc/i3/config @@ -55,6 +55,9 @@ bindsym $mod+Shift+q kill +bindsym $mod+u exec wms uuid +bindsym $mod+t exec wms date +bindsym $mod+m exec wms clear-notification bindsym $mod+p exec menu bin bindsym $mod+o exec menu emoji bindsym $mod+v exec menu clipboard -- cgit v1.2.3 From 26158ce2ebcf1f91abd4dcd43ff8aa7185754a0f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 10 Oct 2022 18:11:06 -0300 Subject: bin/vm: Add VM management script etc/guix/system.scm: Include myself in the "kvm" group so that the QEMU commands can be given the "--enable-kvm" flag; etc/ssh/config: Include the generated SSH config file --- bin/vm | 176 ++++++++++++++++++++++++++++++++++++++++++++++++++++ etc/guix/system.scm | 2 +- etc/ssh/config | 1 + etc/ssh/known_hosts | 2 + 4 files changed, 180 insertions(+), 1 deletion(-) create mode 100755 bin/vm diff --git a/bin/vm b/bin/vm new file mode 100755 index 0000000..f4ba093 --- /dev/null +++ b/bin/vm @@ -0,0 +1,176 @@ +#!/bin/sh +set -eu + + +usage() { + cat <<-'EOF' + Usage: + vm ACTION [OS] + vm -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -h, --help show this message + + ACTION one of: + - up + - down + - status + OS the name of the OS to be acted upon + + + Manage the state of known virtual machines. + + The VM QCOW2 images are stored under + $XDG_STATE_HOME/euandreh/qemu/, as "$OS.qcow2" files. The PIDs + of the running images are stored in individual files under + $XDG_RUNTIME_DIR/vm-pids/, as "$OS.pid" files. + + It also generates an SSH configuration file to bu `Included` + by the main $XDG_CONFIG_HOME/ssh/config file, which contains + one alias entry for each VM, so that one can do a combination + of `vm up alpine && ssh alpine`. + + + Examples: + + Start the VM for Alpine: + + $ vm up alpine + + + Stop the VM for Slackware, which was already down + + $ vm down slackware + The VM for "slackware" is not running, already. + + + List the available VMs, and their current state: + + $ vm status + alpine:up + slackware:down + freebsd:up + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +ACTION="${1:-}" +OS="${2:-}" + +eval "$(assert-arg "$ACTION" 'ACTION')" + + +VMS=' +alpine:60022 +' + +for vm in $VMS; do + NAME="$(echo "$vm" | cut -d: -f1)" + PORT="$(echo "$vm" | cut -d: -f2)" + cat <<-EOF + Host $NAME + HostName localhost + Port $PORT + + EOF +done > "$XDG_DATA_HOME"/euandreh/vm-ssh.conf + +PIDS_DIR="${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/vm-pids" +PID_F="$PIDS_DIR/$OS.pid" +mkdir -p "$PIDS_DIR" + + +port_for_os() { + _OS="$1" + _PORT="$(echo "$VMS" | awk -F: -vOS="$_OS" '$1 == OS { print $2 }')" + if [ -z "$_PORT" ]; then + printf 'Unknown OS: "%s".\n\n' "$_OS" >&2 + usage >&2 + exit 2 + fi + printf '%s' "$_PORT" +} + +case "$ACTION" in + status) + echo "$VMS" | awk -F: '$0=$1' | while read -r vm; do + if [ -e "$PIDS_DIR/$vm.pid" ]; then + STATUS=up + else + STATUS=down + fi + printf '%s:%s\n' "$vm" "$STATUS" + done + ;; + up) + eval "$(assert-arg "$OS" 'OS')" + PORT="$(port_for_os "$OS")" + + if [ -e "$PID_F" ]; then + printf 'The VM for "%s" is already running with PID %s.\n' \ + "$OS" "$(cat "$PID_F")" >&2 + else + QCOW="$XDG_STATE_HOME"/euandreh/qemu/"$OS".qcow2 + qemu-system-x86_64 \ + -m 1G \ + -nic user,model=virtio,hostfwd=tcp::"$PORT"-:22 \ + -drive file="$QCOW",media=disk,if=virtio \ + -enable-kvm \ + -nographic 1>/dev/null 2>&1 & + printf '%s' $! > "$PID_F.pid" + fi + ;; + down) + eval "$(assert-arg "$OS" 'OS')" + PORT="$(port_for_os "$OS")" + + if [ ! -e "$PID_F" ]; then + printf 'The VM for "%s" is not running, already.\n' "$OS" >&2 + else + # shellcheck disable=2064 + trap "rm -f $PID_F" EXIT + kill "$(cat "$PID_F")" + fi + ;; + *) + printf 'Unrecognized action: "%s".\n\n' "$ACTION" >&2 + usage >&2 + exit 2 +esac diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 8072b4f..948a398 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -49,7 +49,7 @@ (name "andreh") (comment "EuAndreh") (group "users") - (supplementary-groups '("netdev" "audio" "video" "wheel")))) + (supplementary-groups '("netdev" "audio" "video" "wheel" "kvm")))) %base-user-accounts)) (packages (append diff --git a/etc/ssh/config b/etc/ssh/config index 8df05c0..e548fe2 100644 --- a/etc/ssh/config +++ b/etc/ssh/config @@ -3,3 +3,4 @@ Host * Include ~/dev/libre/servers/src/infrastructure/ssh.conf Include ~/dev/others/lawtech/src/infrastructure/ssh.conf +Include ~/.usr/share/euandreh/vm-ssh.conf diff --git a/etc/ssh/known_hosts b/etc/ssh/known_hosts index b7e6d6c..c2c3d1e 100644 --- a/etc/ssh/known_hosts +++ b/etc/ssh/known_hosts @@ -75,3 +75,5 @@ git.2f30.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSLZ4G5w4NysBUmAHmr6/V9om42IHS [camarada.site]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 149.28.21.56 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK2cITa9TuC3lzEihIfFYb0KhyJJ5Vg2vnGW1SMMwxhc camarada.site ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 +[127.0.0.1]:60022 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuoUWqrJ8WLBDWwWG7zCyYVYz1upMlg1mSXMGMHIVzY +[localhost]:60022 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuoUWqrJ8WLBDWwWG7zCyYVYz1upMlg1mSXMGMHIVzY -- cgit v1.2.3 From bcfa981ddef2b243e7803db9e83efdfa7449ceb2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 10 Oct 2022 18:21:15 -0300 Subject: bin/menu: Fix help strings --- bin/menu | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/menu b/bin/menu index 53f10e6..6f9ab9f 100755 --- a/bin/menu +++ b/bin/menu @@ -4,7 +4,7 @@ set -eu usage() { cat <<-'EOF' Usage: - menu + menu ACTION menu -h EOF } @@ -16,12 +16,12 @@ help() { -h, --help show this message ACTION one of: - - emoji - - username - - password - - bin - - clipboard - - yubikey + - emoji + - username + - password + - bin + - clipboard + - yubikey Lauch an interactive GUI menu for various desktop activities, to -- cgit v1.2.3 From a386da30f24352d4dd1153011c25782467b45ad2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 10 Oct 2022 18:36:13 -0300 Subject: bin/ootb: Add working, very useful utility --- bin/ootb | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100755 bin/ootb diff --git a/bin/ootb b/bin/ootb new file mode 100755 index 0000000..3aa58db --- /dev/null +++ b/bin/ootb @@ -0,0 +1,103 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + ootb BUILD_DIRECTORY < FILE... + ootb -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -h, --help show this message + + BUILD_DIRECTORY the path of the build directory + FILE the files to be linked + + + Create a directory out of symlinks of the given files. + + The goal is to enable parallel build directories to coexist, + so that one do *O*ut *O*f *T*ree *B*uilds without requiring the + build system or the project to explicitly support it. + + If a repository contains the files: + + .git/ + Makefile + README.md + src/ + file1.ext + file2.ext + + Running `git ls-files | ootb build-1/` would create the + 'build-1/' directory with: + + build-1/ + Makefile -> /absolute/path/to/Makefile + README.md -> /absolute/path/to/README.md + src/ + file1.ext -> /absolute/path/to/file1.ext + file2.ext -> /absolute/path/to/file2.ext + + With that one can `cd build-1/` and run builds there, without + the build artifacts littering the source tree. Also, one could + create a build-2/ directory, where different compiler flags or + build options are given, such as debug/release, while sharing the + underlying source code. + + + Examples: + + Create a 'build/' directory with the files from the Git repository: + + $ git ls-files | ootb build/ + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +BUILD_DIRECTORY="${1:-}" +eval "$(assert-arg "$BUILD_DIRECTORY" 'BUILD_DIRECTORY')" +mkdir -p "$BUILD_DIRECTORY" + + +while read -r f; do + mkdir -p "$BUILD_DIRECTORY"/"$(dirname "$f")" + ln -fs "$PWD"/"$f" "$BUILD_DIRECTORY"/"$f" +done -- cgit v1.2.3 From ca61adaa797adbb82380cc8b3788243b597564d4 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 10 Oct 2022 18:46:30 -0300 Subject: bin/status-bar: Include count of up VMs --- bin/status-bar | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/status-bar b/bin/status-bar index 65cef1c..31f9bd2 100755 --- a/bin/status-bar +++ b/bin/status-bar @@ -89,8 +89,14 @@ while (my ($statusline) = ( =~ /^,?(.*)/)) { my $mpris = `player current`; chomp $mpris; + my $vms = `vm status | grep :up\$ | wc -l`; + chomp $vms; + @blocks = ({ - full_text => "$mpris", + full_text => $vms, + name => 'vms', + }, { + full_text => $mpris, name => 'mpris', }, @blocks); -- cgit v1.2.3 From 844f1cd76a4a1e39a7122966a443d3ea4ab6509b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 10 Oct 2022 18:47:22 -0300 Subject: bin/vm: Fix name of PID file when creating it --- bin/vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/vm b/bin/vm index f4ba093..813f1e6 100755 --- a/bin/vm +++ b/bin/vm @@ -154,7 +154,7 @@ case "$ACTION" in -drive file="$QCOW",media=disk,if=virtio \ -enable-kvm \ -nographic 1>/dev/null 2>&1 & - printf '%s' $! > "$PID_F.pid" + printf '%s' $! > "$PID_F" fi ;; down) -- cgit v1.2.3 From a7e0e9d190b8acfbe7fb8c58d84b81bac501c6a6 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 14 Oct 2022 13:43:07 -0300 Subject: bin/x: Rewrite in Perl, overcome quoting issues --- bin/x | 178 +++++++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 112 insertions(+), 66 deletions(-) diff --git a/bin/x b/bin/x index ed967a5..21bd1f7 100755 --- a/bin/x +++ b/bin/x @@ -1,94 +1,140 @@ -#!/bin/sh -set -eu +#!/usr/bin/env perl -usage() { - cat <<-'EOF' +use v5.34; +use strict; +use warnings; +use feature 'signatures'; +no warnings 'experimental'; +use Getopt::Std (); + +sub usage($fh) { + print $fh <<~'EOF' Usage: - x COMMANDS... [ '&&' / '||' / '|' ] COMMANDS... + x COMMANDS... [ '&&' / '||' / '|' ] COMMANDS... + x COMMANDS... [ 'AND' / 'OR' / 'PIPE' ] COMMANDS... x -h - EOF + EOF } -help() { - cat <<-'EOF' +sub help($fh) { + print $fh <<~'EOF' Options: -h, --help show this message COMMAND the command to be executed - && "AND" logical operator - || "OR" logical operator - | pipe operator + '&&' / AND "AND" logical operator + '||' / OR "OR" logical operator + '|' / PIPE pipe operator Run command chained together with operators. + NOTE: Remember to quote '&&', 'OR' and '|' operators, otherwise + they'll get captured by the shell and not be passed to the 'x' + program! + Examples: Measure the time of two commands: $ time x sleep 1 '&&' sleep 2 - # same as: + # equivalent to: $ time sh -c 'sleep 1 && sleep 2' Notify when either of the commands finish: $ boop x cmd-1 '||' cmd-2 - EOF + EOF +} + + +for (@ARGV) { + last if $_ eq '--'; + if ($_ eq '--help') { + usage *STDOUT; + help *STDOUT; + exit; + } +} + +my %opts; +if (!Getopt::Std::getopts('h', \%opts)) { + usage *STDERR; + exit 2; } -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -CMD='' -for arg in "$@"; do - case "$arg" in - '&&'|'||') - set +e - sh -c "$CMD" - STATUS=$? - set -e - CMD='' - if [ "$arg" = '&&' ] && [ "$STATUS" != 0 ]; then - exit "$STATUS" - elif [ "$arg" = '||' ] && [ "$STATUS" = 0 ]; then - exit 0 - fi - ;; - *) - CMD="$CMD${CMD:+ }'$arg'" - ;; - esac -done - -sh -c "$CMD" +if ($opts{h}) { + usage *STDOUT; + help *STDOUT; + exit; +} + + +sub status_for($n) { + if ($n == -1) { + return 127; + } elsif ($n & 127) { + return $n & 127; + } else { + return $n >> 8; + } +} + +my @AND = ('&&', 'AND'); +my @OR = ('||', 'OR'); +my @PIPE = ('|', 'PIPE'); +my @OPS = (@AND, @OR, @PIPE); + +my @CMD; +for (@ARGV) { + if ($_ ~~ @OPS) { + system @CMD; + @CMD = (); + if ($_ ~~ @AND && $?) { + exit status_for($?); + } elsif ($_ ~~ @OR && !$?) { + exit 0; + } elsif ($_ ~~ @PIPE) { + ... + } + } else { + push @CMD, $_; + } +} + +exit status_for(system @CMD); + +# FIXME: implement manpage in pod +__END__ +.TH x 1 1970-01-01 "x latest" "x user manual" + + +.SH NAME + +x - chain shell commands without creating a subshell. + + +.SH SYNOPSYS + +\fBx\fR [\fIOPTIONS\fR] COMMAND... [ \fI'&&'\fR / \fI'||'\fR / \fI'|'\fR ] COMMAND... + + +.SH DESCRIPTION + +\fBx\fR is a \m[blue]\fBtool\fP\m[], from +.pdfhref W -D https://euandre.org/ -- The best website ever +. + + +.SH OPTIONS + +.TP +\fB-h\fR, \fB--help\fR +Show help text. + + +.SH OPERATORS + -- cgit v1.2.3 From 6c1d1cdb79184c4992f14062b40218f120a1d6b7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 14 Oct 2022 23:17:09 -0300 Subject: bin/uri: Split help option parsing from main program logic --- bin/uri | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/uri b/bin/uri index 23716b9..dfd4cfe 100755 --- a/bin/uri +++ b/bin/uri @@ -66,7 +66,10 @@ if ($opts{h}) { say STDERR ''; usage *STDERR; exit 2; -} elsif ($opts{d}) { +} + + +if ($opts{d}) { print URI::Escape::uri_unescape(); } else { print URI::Escape::uri_escape(); -- cgit v1.2.3 From d65daabc492a2a3fa4942ada52d7a7ef1566559d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 09:26:18 -0300 Subject: etc/guix/home.scm: Increase GPG cache TTL --- etc/guix/home.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 6835efc..10501a1 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -99,12 +99,13 @@ "gitconfig-extra" "[sendemail]\n smtpserver = " msmtp-non-hardcoded "/bin/msmtpq\n")) +;; 2592000 = 60 * 60 * 24 * 30 (define gpg-agent.conf (mixed-text-file "gpg-agent.conf" #"- default-cache-ttl 172800 default-cache-ttl-ssh 172800 - max-cache-ttl 604800 - max-cache-ttl-ssh 604800 + max-cache-ttl 2592000 + max-cache-ttl-ssh 2592000 enable-ssh-support pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) -- cgit v1.2.3 From 53e6cfbeb9267870ec0bbca210d143c5e3cf02b3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:29:33 -0300 Subject: etc/guix/home.scm: Remove custom SBCL package --- etc/guix/home.scm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 10501a1..9c5c745 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -71,9 +71,6 @@ (define wget-with-options (with-options wget "wget" "--hsts-file=\"$XDG_STATE_HOME\"/wget-hsts")) -(define sbcl-with-options - (with-options sbcl "sbcl" "--userinit \"$XDG_CONFIG_HOME\"/sbcl/sbclrc.lisp")) - (define tmux-with-options (with-options tmux "tmux" "-f \"$XDG_CONFIG_HOME\"/tmux/tmux.conf")) @@ -406,7 +403,6 @@ (list msmtp-non-hardcoded isync-with-options wget-with-options - sbcl-with-options tmux-with-options myrepos-with-options texinfo-with-options -- cgit v1.2.3 From 41e329b9648184397e54902685067efca12c4601 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:30:58 -0300 Subject: etc/guix/home.scm: Add (guix licenses) module with prefix --- etc/guix/home.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 9c5c745..81136e7 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -1,5 +1,7 @@ (use-modules ((ice-9 textual-ports) #:prefix textual-ports:) + ((guix licenses) #:prefix licenses:) + ((srfi srfi-1) #:prefix s1:) ((xyz euandreh heredoc) #:prefix heredoc:) (gnu home) (gnu home services) @@ -21,8 +23,7 @@ (guix gexp) (guix modules) (guix packages) - (guix utils) - ((srfi srfi-1) #:prefix s1:)) + (guix utils)) (heredoc:enable-syntax) (define msmtp-non-hardcoded -- cgit v1.2.3 From c5ea790cbe70b873e22e67dd83a364403f9aa659 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:33:46 -0300 Subject: etc/guix/home.scm: Include all outputs of pcre package --- etc/guix/home.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 81136e7..2fef1c2 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -213,7 +213,10 @@ autoconf automake libtool - pcre + pcre:out + pcre:bin + pcre:doc + pcre:static pcre2 avahi libgcrypt -- cgit v1.2.3 From 0fab0b1340507cfa3e993746a513eba1e715dfb7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:35:15 -0300 Subject: etc/guix/home.scm: Include day-do-day packages for compilation and scripting --- etc/guix/home.scm | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 2fef1c2..d3bdc3c 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -176,6 +176,7 @@ gawk bc nvi + patchelf man-pages posix-man-pages @@ -237,19 +238,19 @@ ant mpc maven - libgcrypt pkg-config fzf ranger blueman pavucontrol ledger + siege curl curl:doc xclip cloc strace - file + file@5.39 urlscan rlwrap direnv @@ -267,6 +268,8 @@ gettext lilypond groff + groff:doc + grap ghostscript texlive jq @@ -285,6 +288,19 @@ makefile2graph po4a-text mdpo-patched + universal-ctags + gron + reptyr + xpdf + perf-tools + + ;; for compiling ECL + libatomic-ops + libgc + libffi + ;; for compiling CLISP + libffcall + libsigsegv cryptsetup btrfs-progs @@ -309,6 +325,7 @@ perl-uri-escape ruby python + python-sphinx python-slixmpp python-unidecode python-yubikey-manager @@ -360,6 +377,8 @@ procps zenity util-linux + lightning + lmdb guile guile-heredoc-latest gzip -- cgit v1.2.3 From 5533664e69ca36863fb8a893ede16cd749aca388 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:36:42 -0300 Subject: etc/guix/home.scm: Use clang over clang-toolchain --- etc/guix/home.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index d3bdc3c..3ff2553 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -341,7 +341,7 @@ flex bison gcc-toolchain - clang-toolchain + clang tcc fuse node -- cgit v1.2.3 From 2fcc17bda19cb4d044f01475ffbb4008f3fbf674 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:37:37 -0300 Subject: etc/guix/home.scm: Include a bunch of Lisp implementations --- etc/guix/home.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 3ff2553..bbeb7c3 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -312,6 +312,7 @@ sqlite clojure clojure-tools + leiningen openjdk perl perl-dbi @@ -352,6 +353,21 @@ arandr openssl + sbcl + gcl + ecl + clisp + ccl + abcl + janet + kawa + chez-scheme + racket + chibi-scheme + ;; chicken + gambit-c + gauche + st i3status xmessage -- cgit v1.2.3 From 7f847121f26df1105fd9f080ee8fac70b6af0cf8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:39:58 -0300 Subject: etc/guix/home.scm: Add CLI utilities --- etc/guix/home.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index bbeb7c3..2ca001d 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -352,6 +352,7 @@ xrandr arandr openssl + fswatch sbcl gcl @@ -373,6 +374,7 @@ xmessage dmenu clipmenu + httpd ;; for htpasswd weechat alot @@ -391,6 +393,7 @@ libnotify espeak-ng procps + htop zenity util-linux lightning -- cgit v1.2.3 From 2875b2c94f8dc0064c364c934976789207ac3c8a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:42:26 -0300 Subject: etc/guix/home.scm: Mark conflicting packages (chicken, docutils) --- etc/guix/home.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 2ca001d..5555507 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -336,7 +336,7 @@ python-beautifulsoup4 python-docx python-telegram-bot - python-docutils + ; python-docutils ; FIXME: conflicts with python-sphinx python-mkdocs valgrind flex @@ -365,7 +365,7 @@ chez-scheme racket chibi-scheme - ;; chicken + ; chicken ; FIXME: conflicts with gcc-toolchain gambit-c gauche -- cgit v1.2.3 From 2b6f6d628636327ee1f915bd1ef73bfdfe7cd1f4 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:43:08 -0300 Subject: etc/guix/home.scm: Add Rust and related packages --- etc/guix/home.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 5555507..565b84b 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -353,6 +353,9 @@ arandr openssl fswatch + rust + rust:cargo + rust:rustfmt sbcl gcl -- cgit v1.2.3 From dad4b41453a2ea67fd33cc66d7fc4db702021a1a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:43:35 -0300 Subject: etc/guix/home.scm: Remove unused GUI packages Frescobaldi: I'm now on vi + entr + zathura; Rhythmbox: Quodlibet; Calibre: ranger. --- etc/guix/home.scm | 3 --- 1 file changed, 3 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 565b84b..bfe2f3e 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -438,11 +438,8 @@ transmission:gui audacity inkscape - frescobaldi libreoffice - rhythmbox quodlibet - calibre ungoogled-chromium firefox)) (list msmtp-non-hardcoded -- cgit v1.2.3 From 4ea720bd8ab72ae834b2b6945103dd92df45cfa3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:45:13 -0300 Subject: etc/guix/home.scm: Inline definition of cronjobs --- etc/guix/home.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index bfe2f3e..e2528e4 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -457,4 +457,6 @@ (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" ". ~/.usr/etc/sh/rc"))) (simple-service 'config-files home-files-service-type dot-config) - (simple-service 'home-cron home-mcron-service-type cronjobs)))) + (service home-mcron-service-type + (home-mcron-configuration + (jobs cronjobs)))))) -- cgit v1.2.3 From 033c9987b9873281f3422956a935faf004a2e3df Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:46:23 -0300 Subject: etc/guix/home.scm: WIP implementation of CMUCL package --- etc/guix/home.scm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index e2528e4..e369b68 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -20,12 +20,46 @@ (gnu packages video) (gnu services) (guix build-system trivial) + (guix download) (guix gexp) (guix modules) (guix packages) (guix utils)) (heredoc:enable-syntax) +(define cmucl + (package + (name "cmucl-binary") + (version "21b") + (source + (origin + (method url-fetch) + (uri (string-append "https://common-lisp.net/project/cmucl/downloads/release/" + version + "/cmucl-" + version + "-x86-linux.tar.bz2")) + (sha256 + (base32 "13k3b5ygnbsq6n2i3r5i4ljw3r1qlskn2p5f4x9hrx6vfvbb3k7a")))) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let ((source (assoc-ref %build-inputs "source")) + (bin (string-append %output "/bin"))) + (mkdir-p bin) + (copy-file (string-append source "/bin/lisp") + (string-append bin "/lisp")))))) + (home-page "https://www.cons.org/cmucl/") + (synopsis "The CMU implementation of Common Lisp") + (description #"- + CMUCL is a free implementation of the Common Lisp programming language + which runs on most major Unix platforms. It mainly conforms to the + ANSI Common Lisp standard."#) + (license licenses:public-domain))) + (define msmtp-non-hardcoded (package (inherit msmtp) @@ -443,6 +477,7 @@ ungoogled-chromium firefox)) (list msmtp-non-hardcoded + ;; cmucl isync-with-options wget-with-options tmux-with-options -- cgit v1.2.3 From 7b2c72270728d676722bfc97d88e8904510ddb3e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:49:39 -0300 Subject: etc/guix/home.scm: WIP implementation of poweralertd service --- etc/guix/home.scm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index e369b68..e3bdaca 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -7,6 +7,7 @@ (gnu home services) (gnu home services mcron) (gnu home services shells) + (gnu home services shepherd) (gnu packages) (gnu packages gnupg) (gnu packages mail) @@ -194,6 +195,32 @@ #~(job "5 */6 * * *" "cronjob m") #~(job "30 0 * * *" "cronjob backup -q cron"))) +(define (poweralertd-shepherd-services _config) + (list + (shepherd-service + (provision '(poweralertd)) + (documentation + #"- + Shepherd service that manages poweralertd."#) + (modules `((gnu packages freedesktop))) + (start + #~(make-forkexec-constructor + (list #$(file-append poweralertd "/bin/poweralertd")))) + (stop #~(make-kill-destructor))))) + +(define poweralertd-service-type + (service-type + (name 'poweralertd) + (extensions + (list + (service-extension home-shepherd-service-type + poweralertd-shepherd-services))) + (default-value '()) + (description + #"- + Service that runs poweralertd as a daemon under Shepherd. + + It has no configuration."#))) (home-environment (packages @@ -489,6 +516,7 @@ "/sh/cronjob.sh")))))) (services (list + ;; (service poweralertd-service-type) (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" ". ~/.usr/etc/sh/rc"))) (simple-service 'config-files home-files-service-type dot-config) -- cgit v1.2.3 From c3d09372f579a1badebeef21a78f7a583af158d2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:51:29 -0300 Subject: Temporarily use greenclip over clipmenu --- bin/menu | 4 +++- etc/guix/home.scm | 1 + etc/i3/config | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/menu b/bin/menu index 6f9ab9f..9f1fe09 100755 --- a/bin/menu +++ b/bin/menu @@ -120,7 +120,9 @@ case "$ACTION" in bins | show 'bins' | sh ;; clipboard) - clipmgr -l | show 'clipboard' | copy + greenclip print | show 'clipboard' | copy + notify-send -t 5000 -u low -- \ + "oiwjef" 'copied to clipboard' ;; yubikey) CHOICE="$(ykman oath accounts list | show 'OTP')" diff --git a/etc/guix/home.scm b/etc/guix/home.scm index e3bdaca..46daa2f 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -438,6 +438,7 @@ xmessage dmenu clipmenu + greenclip httpd ;; for htpasswd weechat diff --git a/etc/i3/config b/etc/i3/config index 9637c28..83e9b50 100644 --- a/etc/i3/config +++ b/etc/i3/config @@ -24,6 +24,7 @@ exec nm-applet exec blueman-applet exec poweralertd exec dunst +exec greenclip daemon # Use pactl to adjust volume in PulseAudio. set $refresh_i3status killall -SIGUSR1 i3status -- cgit v1.2.3 From 8c9e0c1605672448b1698dda00a9e475faba6026 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:58:49 -0300 Subject: etc/sh/rc: Remove annoying alias for "rm" --- etc/sh/rc | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/sh/rc b/etc/sh/rc index f247270..ff54700 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -130,7 +130,6 @@ alias less='less -R' alias tree='tree -aC' alias make='make -e' alias mv='mv -i' -alias rm='rm -i' alias vi='echo "Use \"e\" instead."; false' alias sqlite='rlwrap sqlite3' -- cgit v1.2.3 From 58b11e81883dc79a1d01075f877b30e623fd1fb0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 12:59:04 -0300 Subject: etc/sh/rc: Remove alias for "sbcl" This one is in the process of being replaced by the bin/cl utility. --- etc/sh/rc | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/sh/rc b/etc/sh/rc index ff54700..1c54e34 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -133,7 +133,6 @@ alias mv='mv -i' alias vi='echo "Use \"e\" instead."; false' alias sqlite='rlwrap sqlite3' -alias sbcl='rlwrap sbcl' alias perl='rlwrap perl' alias guile='guile -l "$XDG_CONFIG_HOME"/guile/init.scm' -- cgit v1.2.3 From 81af5684f0190e66f0480f4e0eba77c1854877d7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 13:00:20 -0300 Subject: etc/sh/rc: Include more files in e.list.txt --- etc/sh/rc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/sh/rc b/etc/sh/rc index 1c54e34..d42e50e 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -195,13 +195,14 @@ cat <<-EOF | sed "s|$HOME|~|" > "$XDG_DATA_HOME"/euandreh/e.list.txt $XDG_CONFIG_HOME/sh/rc $XDG_CONFIG_HOME/guix/home.scm $XDG_CONFIG_HOME/guix/system.scm - $(find ~/Documents/txt/*.md -not -name TODOs.md | + $(find ~/Documents/txt/*.txt ~/Documents/txt/*.md -not -name TODOs.md | sed "s|^$HOME|~|" | LANG=POSIX.UTF-8 sort) ~/dev/libre/package-repository/dependencies.dot ~/dev/others/dinheiros/dinheiros.ledger ~/dev/libre/dotfiles/sh/fake-symlinks.sh $XDG_CONFIG_HOME/guix/channels.scm + $XDG_CONFIG_HOME/lisp-cli/init.lisp EOF -- cgit v1.2.3 From 5f218b59e0bde8e90cd5860ab40313aec772d669 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 15:17:40 -0300 Subject: etc/guix/home.scm: Add scdoc package --- etc/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 46daa2f..a89b3b5 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -354,6 +354,7 @@ reptyr xpdf perf-tools + scdoc ;; for compiling ECL libatomic-ops -- cgit v1.2.3 From 2281a7f92894a840767dbe4ace2e99769cdd6622 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 16:27:08 -0300 Subject: bin/*.pl: Explicitly name the excluded warnings The previous version had a catch-all for all warnings, even the ones I don't know that I have, or future warnings that could appear. --- bin/nato | 2 +- bin/status-bar | 2 +- bin/uri | 2 +- bin/x | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/nato b/bin/nato index 75c208e..5287acd 100755 --- a/bin/nato +++ b/bin/nato @@ -4,7 +4,7 @@ use v5.34; use strict; use warnings; use feature 'signatures'; -no warnings 'experimental'; +no warnings ('experimental::signatures'); use Getopt::Std (); sub usage($fh) { diff --git a/bin/status-bar b/bin/status-bar index 31f9bd2..a96e5ae 100755 --- a/bin/status-bar +++ b/bin/status-bar @@ -9,7 +9,7 @@ use v5.34; use strict; use warnings; use feature 'signatures'; -no warnings 'experimental'; +no warnings ('experimental::signatures'); use Getopt::Std (); use JSON (); diff --git a/bin/uri b/bin/uri index dfd4cfe..77022c9 100755 --- a/bin/uri +++ b/bin/uri @@ -4,7 +4,7 @@ use v5.34; use strict; use warnings; use feature 'signatures'; -no warnings 'experimental'; +no warnings ('experimental::signatures'); use Getopt::Std (); use URI::Escape (); diff --git a/bin/x b/bin/x index 21bd1f7..b51ce96 100755 --- a/bin/x +++ b/bin/x @@ -4,7 +4,7 @@ use v5.34; use strict; use warnings; use feature 'signatures'; -no warnings 'experimental'; +no warnings ('experimental::signatures', 'experimental::smartmatch'); use Getopt::Std (); sub usage($fh) { -- cgit v1.2.3 From f2e1f6851e8268607816f6d175fb235fc4dd3400 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 16:30:50 -0300 Subject: bin/*.pl: Do not "use strict" explicitly Ever since Pelr 5.12 (as in perl5120delta(1)), "use strict" is already done by default. Since all these files do use a number greater than 5.12 (5,34 as of this commit), this "use strict" is redundant. --- bin/nato | 1 - bin/status-bar | 1 - bin/uri | 1 - bin/x | 1 - 4 files changed, 4 deletions(-) diff --git a/bin/nato b/bin/nato index 5287acd..a9c21bf 100755 --- a/bin/nato +++ b/bin/nato @@ -1,7 +1,6 @@ #!/usr/bin/env perl use v5.34; -use strict; use warnings; use feature 'signatures'; no warnings ('experimental::signatures'); diff --git a/bin/status-bar b/bin/status-bar index a96e5ae..bd55b05 100755 --- a/bin/status-bar +++ b/bin/status-bar @@ -6,7 +6,6 @@ # use v5.34; -use strict; use warnings; use feature 'signatures'; no warnings ('experimental::signatures'); diff --git a/bin/uri b/bin/uri index 77022c9..9b7a61b 100755 --- a/bin/uri +++ b/bin/uri @@ -1,7 +1,6 @@ #!/usr/bin/env perl use v5.34; -use strict; use warnings; use feature 'signatures'; no warnings ('experimental::signatures'); diff --git a/bin/x b/bin/x index b51ce96..e171061 100755 --- a/bin/x +++ b/bin/x @@ -1,7 +1,6 @@ #!/usr/bin/env perl use v5.34; -use strict; use warnings; use feature 'signatures'; no warnings ('experimental::signatures', 'experimental::smartmatch'); -- cgit v1.2.3 From 592d5e802d0e099efcaf9365a134e1f1efb5ce1c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 16 Oct 2022 22:22:53 -0300 Subject: bin/without-env: Better handling of "--" separator --- bin/without-env | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/without-env b/bin/without-env index 4f8fb14..685472d 100755 --- a/bin/without-env +++ b/bin/without-env @@ -64,6 +64,8 @@ eval "$(assert-arg "${3:-}" '--')" eval "export $1=\"\$(echo \"\$$1\" | sed \"s|\$2:||g\")\"" shift # drop $1 shift # drop $2 -shift # drop -- +if [ "${1:-}" = '--' ]; then + shift # drop -- +fi "$@" -- cgit v1.2.3 From 25124bb113063897d324c11bb6f5622ef78231a3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 17 Oct 2022 23:48:48 -0300 Subject: etc/guix/home.scm: Use main Guix channel versions of packages --- etc/guix/home.scm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index a89b3b5..9e3b7b6 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -240,7 +240,7 @@ patchelf man-pages - posix-man-pages + man-pages-posix bash-completion @@ -347,8 +347,8 @@ cmark cmake makefile2graph - po4a-text - mdpo-patched + po4a + mdpo universal-ctags gron reptyr @@ -379,7 +379,7 @@ perl perl-dbi perl-dbd-sqlite - perl-critic + ; perl-critic ; FIXME: wait for https://issues.guix.gnu.org/58603 to be applied perl-json perl-mojolicious perl-regexp-grammars @@ -452,7 +452,7 @@ imagemagick ffmpeg pandoc - mktorrent-latest + mktorrent jekyll flac mediainfo -- cgit v1.2.3 From 4b6ea2f799112bb47df648f7cb49be3f1cd2b354 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 18 Oct 2022 11:57:34 -0300 Subject: etc/guix/home.scm: Re-add perl-critic The upstream patch was applied. --- etc/guix/home.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 9e3b7b6..62b26a9 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -379,7 +379,7 @@ perl perl-dbi perl-dbd-sqlite - ; perl-critic ; FIXME: wait for https://issues.guix.gnu.org/58603 to be applied + perl-critic perl-json perl-mojolicious perl-regexp-grammars -- cgit v1.2.3 From bb8adb088873da92939d738f9815c9c369c8bdec Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 18 Oct 2022 23:42:04 -0300 Subject: etc/guix/home.scm: Add hunspell-iconv and dictionaries --- etc/guix/home.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 62b26a9..6d29a54 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -9,7 +9,9 @@ (gnu home services shells) (gnu home services shepherd) (gnu packages) + (gnu packages base) (gnu packages gnupg) + (gnu packages libreoffice) (gnu packages mail) (gnu packages music) (gnu packages wget) @@ -23,11 +25,56 @@ (guix build-system trivial) (guix download) (guix gexp) + (guix git-download) (guix modules) (guix packages) (guix utils)) (heredoc:enable-syntax) +(define-public hunspell-iconv + (package + (inherit hunspell) + (name "hunspell-iconv") + (inputs + `(("libiconv" ,libiconv) + ,@(package-inputs hunspell))))) + +(define (hunspell-dictionary-utf8 dict-name) + (package + (name (string-append "hunspell-dict-" dict-name "-utf8")) + (version "630b34e6f8f3cbe7aa7b27b6d8ab118e27252fd1") + (source + (origin + (method git-fetch) + (uri + (git-reference + (url "https://github.com/wooorm/dictionaries") + (commit version))) + (file-name + (git-file-name "hunspell-dictionary-utf8" version)) + (sha256 + (base32 "1iknwzh5h04m067ddw9hlzc1qqj4mr9mdkcfapsnay304laaiyn5")))) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let ((source-prefix (string-append (assoc-ref %build-inputs "source") + "/dictionaries/" + ,dict-name + "/index")) + (install-prefix (string-append %output "/share/hunspell/"))) + (mkdir-p install-prefix) + (copy-file (string-append source-prefix ".aff") + (string-append install-prefix ,dict-name ".aff")) + (copy-file (string-append source-prefix ".dic") + (string-append install-prefix ,dict-name ".dic")))))) + (synopsis (string-append "Hunspell " dict-name " dictionary in UTF-8")) + (description (string-append "Hunspell " dict-name " dictionary in UTF-8")) + (license licenses:expat) + (home-page "https://github.com/wooorm/dictionaries"))) + (define cmucl (package (name "cmucl-binary") @@ -514,6 +561,11 @@ texinfo-with-options mpv-with-options openssh-with-options + hunspell-iconv + (hunspell-dictionary-utf8 "en") + (hunspell-dictionary-utf8 "pt") + (hunspell-dictionary-utf8 "fr") + (hunspell-dictionary-utf8 "eo") (script "cronjob" (slurp (string-append (getenv "XDG_CONFIG_HOME") "/sh/cronjob.sh")))))) (services -- cgit v1.2.3 From 50f28b6958cb65e368cd9138b170cc2f0ce18ab2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 18 Oct 2022 23:43:50 -0300 Subject: etc/git/config: Incluse base commit when possible --- etc/git/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/git/config b/etc/git/config index 27486cf..ade021a 100644 --- a/etc/git/config +++ b/etc/git/config @@ -19,5 +19,7 @@ confirm = never [remote "origin"] fetch = +refs/notes/*:refs/notes/* +[format] + useAutoBase = whenAble [include] path = config-extra -- cgit v1.2.3 From 91777aaea23bf715e8b002e4e1e97af041e605b0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 18 Oct 2022 23:44:43 -0300 Subject: share/man/man1/ootb.1: Add WIP manpage --- share/man/man1/ootb.1 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 share/man/man1/ootb.1 diff --git a/share/man/man1/ootb.1 b/share/man/man1/ootb.1 new file mode 100644 index 0000000..55761fb --- /dev/null +++ b/share/man/man1/ootb.1 @@ -0,0 +1,26 @@ +.TH OOTB 1 2022-10-10 "ootb 0.1.0" "ootb user manual" + + +.SH NAME + +ootb - build a symlink tree of files, to allow out-of-tree builds. + + +.SH SYNOPSYS + +\fBootb\fP \fIBUILD_DIRECTORY\fP +\fBootb\fP \fB-h\fP + + +.SH DESCRIPTION + +\fBootb\fP is a \m[blue]tool\fP\m[], from here. + + +.SH OPTIONS + +.TP +\fB-h\fP, \fB--help\fP +Show thep text. + +.\" FIXME -- cgit v1.2.3 From 6319cbd4dcec63e9a07ce88e169820fc653613e9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 18 Oct 2022 23:46:45 -0300 Subject: opt/tests/x-tests.sh: Add WIP markers for more tests to be added --- opt/tests/x-tests.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/opt/tests/x-tests.sh b/opt/tests/x-tests.sh index fe46354..4cb6faf 100755 --- a/opt/tests/x-tests.sh +++ b/opt/tests/x-tests.sh @@ -1,5 +1,12 @@ #!/bin/sh set -eu -x echo -x echo '&&' echo +perl ~/.usr/bin/x2 echo +perl ~/.usr/bin/x2 echo '&&' echo + +# Quoting stuff works +perl bin/x2 echo "'abc\'" + +# "OR" has a stronger precedence +perl bin/x2 echo a '||' this-executable-does-not-exist +# FIXME -- cgit v1.2.3 From 4550864822d4f9eebbc943b444f30db6e25d170d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 18 Oct 2022 23:47:24 -0300 Subject: bin/check: Add podchecker to the TODO list --- bin/check | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/check b/bin/check index 6dddc8b..4dd96f1 100755 --- a/bin/check +++ b/bin/check @@ -82,3 +82,4 @@ done # FIXME: # verify that the expiry date on the GPG key is greater than 1 year # assert git pushed +# podchecker -- cgit v1.2.3 From d7e06589f619e5a7ed5f13a44b69655e26efabac Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 18 Oct 2022 23:47:52 -0300 Subject: bin/x: Add WIP manpage in POD --- bin/x | 74 ++++++++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/bin/x b/bin/x index e171061..2133c2f 100755 --- a/bin/x +++ b/bin/x @@ -106,34 +106,58 @@ for (@ARGV) { exit status_for(system @CMD); -# FIXME: implement manpage in pod __END__ -.TH x 1 1970-01-01 "x latest" "x user manual" - - -.SH NAME - -x - chain shell commands without creating a subshell. - - -.SH SYNOPSYS -\fBx\fR [\fIOPTIONS\fR] COMMAND... [ \fI'&&'\fR / \fI'||'\fR / \fI'|'\fR ] COMMAND... +=head1 NAME +z - automatically uncompress arguments to other commands -.SH DESCRIPTION +=head1 SYNOPSYS -\fBx\fR is a \m[blue]\fBtool\fP\m[], from -.pdfhref W -D https://euandre.org/ -- The best website ever -. - - -.SH OPTIONS - -.TP -\fB-h\fR, \fB--help\fR -Show help text. - - -.SH OPERATORS +z COMMAND FILE... ARGUMENTS... +=cut +# FIXME: implement manpage in pod +# .TH x 1 1970-01-01 "x latest" "x user manual" +# +# +# .SH NAME +# +# x - chain shell commands without creating a subshell. +# +# +# .SH SYNOPSYS +# +# \fBx\fR [\fIOPTIONS\fR] COMMAND... [ \fI'&&'\fR / \fI'||'\fR / \fI'|'\fR ] COMMAND... +# +# +# .SH DESCRIPTION +# +# \fBx\fR is a \m[blue]\fBtool\fP\m[], from +# .pdfhref W -D https://euandre.org/ -- The best website ever +# . +# +# +# .SH OPTIONS +# +# .TP +# \fB-h\fR, \fB--help\fR +# Show help text. +# +# +# .SH OPERATORS +# +# +# =pod +# =head1 Heading Text +# =head2 Heading Text +# =head3 Heading Text +# =head4 Heading Text +# =over indentlevel +# =item stuff +# =back +# =begin format +# =end format +# =for format text... +# =encoding type +# =cut -- cgit v1.2.3 From 1235bf098a6d5ca4bd829c77728e4c4413b6d815 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 18 Oct 2022 23:51:00 -0300 Subject: etc/sh/rc: Ensure common-lisp/source symlink always exist --- etc/sh/rc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/sh/rc b/etc/sh/rc index d42e50e..0ae2cdf 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -266,6 +266,10 @@ if [ -r "$F" ]; then . "$F" fi +mkdir -p "$XDG_DATA_HOME"/common-lisp +if [ ! -e "$XDG_DATA_HOME"/common-lisp/source ]; then + ln -s "$SRC"/libre "$XDG_DATA_HOME"/common-lisp/source +fi -- cgit v1.2.3 From 345af3cf746b69fa62f49916cd6048899777a741 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 00:05:35 -0300 Subject: bin/without-env: Don't bother with looking at the 3rd argument --- bin/without-env | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/without-env b/bin/without-env index 685472d..fb1f807 100755 --- a/bin/without-env +++ b/bin/without-env @@ -59,7 +59,6 @@ shift $((OPTIND - 1)) eval "$(assert-arg "${1:-}" 'ENVVAR')" eval "$(assert-arg "${2:-}" 'PATH')" -eval "$(assert-arg "${3:-}" '--')" eval "export $1=\"\$(echo \"\$$1\" | sed \"s|\$2:||g\")\"" shift # drop $1 -- cgit v1.2.3 From 7b468dc4390748b2d0a1f480b626a79fc6f57167 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 00:05:59 -0300 Subject: bin/without-env: Fix -h flag in USAGE string --- bin/without-env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/without-env b/bin/without-env index fb1f807..fd9d1e8 100755 --- a/bin/without-env +++ b/bin/without-env @@ -5,7 +5,7 @@ usage() { cat <<-'EOF' Usage: without-env ENVVAR PATH -- COMMAND... - without-env [-h] + without-env -h EOF } -- cgit v1.2.3 From a4c54ebde90d2f5effdecf12aa590414bdb838ed Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 11:30:32 -0300 Subject: etc/guix/home.scm: Add lzop compression utility --- etc/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 6d29a54..6df9f7c 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -517,6 +517,7 @@ xz bzip2 lzip + lzop which libxml2 psmisc -- cgit v1.2.3 From a8358c4809e3deaeaeff46c90f86d3aaac6b4354 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 11:43:29 -0300 Subject: bin/z: Add working utility Pilfer initial version of manpage from zrun. --- bin/z | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 bin/z diff --git a/bin/z b/bin/z new file mode 100644 index 0000000..0558436 --- /dev/null +++ b/bin/z @@ -0,0 +1,153 @@ +#!/usr/bin/env perl + +use v5.34; +use warnings; +use feature 'signatures'; +no warnings qw(experimental::signatures); +use Getopt::Std (); +use File::Temp (); +use File::Basename (); +use List::Util qw(any); + + +sub usage($fh) { + print $fh <<~'EOF' + Usage: + z COMMANDS... + z -h + EOF +} + +sub help($fh) { + print $fh <<~'EOF' + + + Options: + -h, --help show this message + + + Wrapper that uncompresses file arguments to commands. + This enables having commands that operate on plain files to not + need to know if they're compressed or not. + + It doesn't depend on the file extension, but on what file(1) says + of it. + + + Examples: + + Replacement for zcat(1p): + + $ z cat a-file.gz + + + Transparent grep (where my-file.dat is xz compressed): + + $ z grep -E '[a-z]+' my-file.dat + EOF +} + +for (@ARGV) { + last if $_ eq '--'; + if ($_ eq '--help') { + usage *STDOUT; + help *STDOUT; + exit; + } +} + +my %opts; +if (!Getopt::Std::getopts('h', \%opts)) { + usage *STDERR; + exit 2; +} + +if ($opts{h}) { + usage *STDOUT; + help *STDOUT; + exit; +} + + +# Transform +# FILENAME: content/type; charset=some\n +# into +# content/type +sub trim($x) { + chomp $x; + $x =~ s/^.*?: //; + $x =~ s/;.*$//; + return $x; +} + +my %TYPES = ( + 'application/gzip' => [qw(gzip -dc)], + 'application/x-bzip2' => [qw(bzip2 -dc)], + 'application/x-xz' => [qw(xz -dc)], + 'application/x-lzma' => [qw(lzma -dc)], +); + +my @tmpfiles; +sub arg_for($arg) { + if (! -e $arg) { + return $arg; + } + + my $type = trim `file -i $_`; + if (any { $type eq $_ } keys %TYPES) { + my $template = File::Basename::basename $arg . '.XXXXXX'; + my ($fh, $tmpname) = File::Temp::tempfile(TEMPLATE => $template); + push @tmpfiles, $tmpname; + my @command = @{$TYPES{$type}}; + print $fh `@command $arg`; + die $! if $?; + close $fh; + return $tmpname; + } + + return $arg; +} + +sub status_for($n) { + if ($n == -1) { + return 127; + } elsif ($n & 127) { + return $n & 127; + } else { + return $n >> 8; + } +} + +my @CMD = map { arg_for $_ } @ARGV; +exit status_for(system @CMD); + +END { + unlink @tmpfiles; +} + + +__END__ + +=head1 NAME + +z - Wrapper that uncompresses file arguments to commands. + +=head1 SYNOPSIS + +z COMMAND FILE... + +=head1 DESCRIPTION + +Prefixing a shell command with "zrun" causes any compressed files that are +arguments of the command to be transparently uncompressed to temp files +(not pipes) and the uncompressed files fed to the command. + +This is a quick way to run a command that does not itself support +compressed files, without manually uncompressing the files. + +The following compression types are supported: gz bz2 Z xz lzma lzo + +If zrun is linked to some name beginning with z, like zprog, and the link is +executed, this is equivalent to executing "zrun prog". + +=cut -- cgit v1.2.3 From 88c8d0318f3c10c29e84c191d758e732075352bd Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 11:45:42 -0300 Subject: Makefile: Add to generate manpages from POD --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2cbee71 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +.POSIX: + + +pod2man = \ + share/man/man1/z.1 \ + + +all: $(pod2man) + + +share/man/man1/z.1: bin/z + pod2man bin/z > $@ -- cgit v1.2.3 From f5763edf230849ad0dc5d9be1b5258ce79c8a2bd Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 11:54:58 -0300 Subject: etc/sh/rc: Move creation of common-lisp/source to Makefile --- Makefile | 5 ++++- etc/sh/rc | 5 ----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 2cbee71..b4642a3 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,11 @@ pod2man = \ share/man/man1/z.1 \ -all: $(pod2man) +all: $(pod2man) $(XDG_DATA_HOME)/common-lisp/source share/man/man1/z.1: bin/z pod2man bin/z > $@ + +$(XDG_DATA_HOME)/common-lisp/source: + ln -s $(SRC)/libre $@ diff --git a/etc/sh/rc b/etc/sh/rc index 0ae2cdf..ecb49b7 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -266,11 +266,6 @@ if [ -r "$F" ]; then . "$F" fi -mkdir -p "$XDG_DATA_HOME"/common-lisp -if [ ! -e "$XDG_DATA_HOME"/common-lisp/source ]; then - ln -s "$SRC"/libre "$XDG_DATA_HOME"/common-lisp/source -fi - # -- cgit v1.2.3 From e5fb1012c99b241835b46655cda27d3eff481150 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 12:47:14 -0300 Subject: etc/sh/rc: Move generation of GPG/SSH public keys and e.list.txt to Makefile --- Makefile | 22 +++++++++++++++++++++- etc/sh/rc | 26 -------------------------- opt/aux/gen-e-list.sh | 24 ++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 27 deletions(-) create mode 100755 opt/aux/gen-e-list.sh diff --git a/Makefile b/Makefile index b4642a3..5d8e2c4 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,15 @@ pod2man = \ share/man/man1/z.1 \ -all: $(pod2man) $(XDG_DATA_HOME)/common-lisp/source +derived-assets = \ + $(pod2man) \ + $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ + $(XDG_DATA_HOME)/common-lisp/source \ + $(XDG_DATA_HOME)/euandreh/e.list.txt \ + + + +all: $(derived-assets) share/man/man1/z.1: bin/z @@ -13,3 +21,15 @@ share/man/man1/z.1: bin/z $(XDG_DATA_HOME)/common-lisp/source: ln -s $(SRC)/libre $@ + +$(XDG_CONFIG_HOME)/ssh/id_rsa.pub: + gpg --export-ssh-key eu@euandre.org > $@ + chmod 600 $@ + +$(XDG_DATA_HOME)/euandreh/e.list.txt: ~/Documents/txt/ opt/aux/gen-e-list.sh + sh opt/aux/gen-e-list.sh > $@ + + + +clean: + rm -f $(derived-assets) diff --git a/etc/sh/rc b/etc/sh/rc index ecb49b7..af3870f 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -189,22 +189,6 @@ f() { fi } -cat <<-EOF | sed "s|$HOME|~|" > "$XDG_DATA_HOME"/euandreh/e.list.txt - ~/Documents/txt/TODOs.md - ~/Documents/txt/scratch.txt - $XDG_CONFIG_HOME/sh/rc - $XDG_CONFIG_HOME/guix/home.scm - $XDG_CONFIG_HOME/guix/system.scm - $(find ~/Documents/txt/*.txt ~/Documents/txt/*.md -not -name TODOs.md | - sed "s|^$HOME|~|" | - LANG=POSIX.UTF-8 sort) - ~/dev/libre/package-repository/dependencies.dot - ~/dev/others/dinheiros/dinheiros.ledger - ~/dev/libre/dotfiles/sh/fake-symlinks.sh - $XDG_CONFIG_HOME/guix/channels.scm - $XDG_CONFIG_HOME/lisp-cli/init.lisp -EOF - reload() { @@ -239,17 +223,7 @@ SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) GPG_TTY=$(tty ||:) export GPG_TTY SSH_AUTH_SOCK gpgconf --launch gpg-agent -gpg --export-ssh-key eu@euandre.org > "$XDG_CONFIG_HOME"/ssh/id_rsa.pub -chmod 600 "$XDG_CONFIG_HOME"/ssh/id_rsa.pub - -PUB_GPG_FILES=" -$HOME/dev/libre/package-repository/EuAndreh.key -$HOME/dev/published/euandre.org/public.asc -" -for f in $PUB_GPG_FILES; do - gpg --armour --export eu@euandre.org > "$f" -done case $- in diff --git a/opt/aux/gen-e-list.sh b/opt/aux/gen-e-list.sh new file mode 100755 index 0000000..aa0951a --- /dev/null +++ b/opt/aux/gen-e-list.sh @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu + +{ + cat <<-EOF + ~/Documents/txt/TODOs.md + ~/Documents/txt/scratch.txt + $XDG_CONFIG_HOME/sh/rc + $XDG_CONFIG_HOME/guix/home.scm + $XDG_CONFIG_HOME/guix/system.scm + EOF + + find ~/Documents/txt/*.txt ~/Documents/txt/*.md -not -name TODOs.md | + sed "s|^$HOME|~|" | + LANG=POSIX.UTF-8 sort + + cat <<-EOF + ~/dev/libre/package-repository/dependencies.dot + ~/dev/others/dinheiros/dinheiros.ledger + ~/dev/libre/dotfiles/sh/fake-symlinks.sh + $XDG_CONFIG_HOME/guix/channels.scm + $XDG_CONFIG_HOME/lisp-cli/init.lisp + EOF +} | sed "s|$HOME|~|" -- cgit v1.2.3 From 69d26f531c77bc65eb2fedfe0efd43c67dbbba6f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 13:34:46 -0300 Subject: bin/check: Move tests to Makefile --- Makefile | 44 +++++++++++++++++++++++++++++++++++ bin/check | 47 ++++++++------------------------------ opt/tests/assert-gpg-expiration.sh | 22 ++++++++++++++++++ 3 files changed, 76 insertions(+), 37 deletions(-) create mode 100755 opt/tests/assert-gpg-expiration.sh diff --git a/Makefile b/Makefile index 5d8e2c4..c1723b3 100644 --- a/Makefile +++ b/Makefile @@ -31,5 +31,49 @@ $(XDG_DATA_HOME)/euandreh/e.list.txt: ~/Documents/txt/ opt/aux/gen-e-list.sh +check-shellcheck: + git ls-files | \ + xargs awk '/^#!\/bin\/sh$$/ { print FILENAME } { nextfile }' | \ + xargs shellcheck -x + +check-perlcritic: + git ls-files | \ + xargs awk '/^#!\/usr\/bin\/env perl$$/ { print FILENAME } { nextfile }' | \ + xargs perlcritic + +check-fixme: + if git grep FIXME -- ':(exclude)Makefile'; then \ + printf 'Leftover FIXME markers.\n' >&2; \ + exit 1; \ + fi + +check-dirty-public: + if ! git diff --quiet || ! git diff --quiet --staged; then \ + printf 'Dirty tilde repository.\n' >&2; \ + exit 1; \ + fi + +check-dirty-private: + if ! git -C $(PRIV_CONFIG) diff --quiet || \ + ! git -C $(PRIV_CONFIG) diff --quiet --staged; then \ + printf 'Dirty private tilde repository.\n' >&2; \ + exit 1; \ + fi + +check-opt: + find opt/tests/ -name '*.sh' -exec {} + + +check-pod: + podchecker bin/z + +check-sync: + if git status --short --branch --porcelain | head -n1 | grep -E '(ahead|behind)'; then \ + printf 'Out of sync with origin.\n' >&2; \ + exit 1; \ + fi + +check: check-shellcheck check-perlcritic check-fixme check-dirty-public \ + check-dirty-private check-opt check-pod check-sync + clean: rm -f $(derived-assets) diff --git a/bin/check b/bin/check index 4dd96f1..5919482 100755 --- a/bin/check +++ b/bin/check @@ -1,19 +1,25 @@ #!/bin/sh set -eu + usage() { cat <<-'EOF' Usage: - check.sh - check.sh -h + check + check -h EOF } help() { cat <<-'EOF' + Options: -h, --help show this message + + + Run Makefile tests. This binary is available to simplify the + cronjob. EOF } @@ -47,39 +53,6 @@ while getopts 'h' flag; do done shift $((OPTIND - 1)) -cd -- "$(dirname -- "$0")" -cd -- "$(git rev-parse --show-toplevel)" - - -git ls-files | - xargs awk 'FNR==1 && /^#!\/bin\/sh$/ { print FILENAME }' | - xargs shellcheck -x - -git ls-files | - xargs awk 'FNR==1 && /^#!\/usr\/bin\/env perl$/ { print FILENAME }' | - xargs perlcritic - -if git grep FIXME -- ":(exclude)$0"; then - printf 'Leftover FIXME markers\n' >&2 - exit 1 -fi - -if ! git diff --quiet || ! git diff --quiet --staged; then - printf 'Dirty tilde repository.\n' >&2 - exit 1 -fi - -PRIV="$XDG_CONFIG_HOME/../var/lib/private/tilde" -if ! git -C "$PRIV" diff --quiet || ! git -C "$PRIV" diff --quiet --staged; then - printf 'Dirty private tilde repository.\n' >&2 - exit 1 -fi - -for f in opt/tests/*; do - sh "$f" -done -# FIXME: -# verify that the expiry date on the GPG key is greater than 1 year -# assert git pushed -# podchecker +cd ~/.usr/ +make check diff --git a/opt/tests/assert-gpg-expiration.sh b/opt/tests/assert-gpg-expiration.sh new file mode 100755 index 0000000..d17486e --- /dev/null +++ b/opt/tests/assert-gpg-expiration.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -eu + + +SECRET_KEY='81F90EC3CD356060' +NEXT_6_MONTHS="$(echo "$(date '+%s') + (60 * 60 * 24 * 30 * 6)" | bc)" + +gpg --with-colons --fixed-list-mode --list-keys "$SECRET_KEY" | + grep -e ^pub -e ^sub | + while read -r subkey; do + EXPIRY="$(echo "$subkey" | cut -d: -f7)" + if [ -z "$EXPIRY" ]; then + continue + fi + + if [ "$EXPIRY" -gt "$(date '+%s')" ] && + [ "$EXPIRY" -lt "$NEXT_6_MONTHS" ]; then + printf 'Key %s to expire soon!.\n' \ + "$(echo "$subkey" | cut -d: -f5)" >&2 + exit 1 + fi + done -- cgit v1.2.3 From 056f2719a082fdde90d0c4815ccf8d9f19f34ffd Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 13:37:45 -0300 Subject: bin/z: Mark as executable --- bin/z | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/z diff --git a/bin/z b/bin/z old mode 100644 new mode 100755 -- cgit v1.2.3 From 6579aebb68d01d97d39a6f5aa5ec66097548e639 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 23:08:48 -0300 Subject: etc/sh/rc: Stop wraping perl with rlwrap --- etc/sh/rc | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/sh/rc b/etc/sh/rc index af3870f..0f0ed5d 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -133,7 +133,6 @@ alias mv='mv -i' alias vi='echo "Use \"e\" instead."; false' alias sqlite='rlwrap sqlite3' -alias perl='rlwrap perl' alias guile='guile -l "$XDG_CONFIG_HOME"/guile/init.scm' alias flush='sync && echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null' -- cgit v1.2.3 From 432c518f73e3619fe8b79dd01de2e5a2f50faac3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 23:08:35 -0300 Subject: bin/cl: Add first working version, integrated with Makefile and etc/sh/rc --- Makefile | 17 ++- bin/cl | 296 +++++++++++++++++++++++++++++++++++++++++++++++++ etc/lisp-cli/init.lisp | 26 +++++ etc/sh/rc | 1 + 4 files changed, 336 insertions(+), 4 deletions(-) create mode 100755 bin/cl diff --git a/Makefile b/Makefile index c1723b3..7384fb2 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,11 @@ pod2man = \ derived-assets = \ - $(pod2man) \ - $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ - $(XDG_DATA_HOME)/common-lisp/source \ - $(XDG_DATA_HOME)/euandreh/e.list.txt \ + $(pod2man) \ + $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ + $(XDG_DATA_HOME)/common-lisp/source \ + $(XDG_DATA_HOME)/euandreh/e.list.txt \ + $(XDG_DATA_HOME)/lisp-cli/clisp.image \ @@ -29,6 +30,14 @@ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub: $(XDG_DATA_HOME)/euandreh/e.list.txt: ~/Documents/txt/ opt/aux/gen-e-list.sh sh opt/aux/gen-e-list.sh > $@ +$(XDG_DATA_HOME)/lisp-cli/clisp.image: $(XDG_CONFIG_HOME)/lisp-cli/init.lisp bin/cl + cl \ + -I clisp \ + -v \ + -e '(ql:quickload :trivial-dump-core)' \ + -e '(trivial-dump-core:dump-image "$@")' \ + -e '(uiop:quit)' + check-shellcheck: diff --git a/bin/cl b/bin/cl new file mode 100755 index 0000000..1b9a659 --- /dev/null +++ b/bin/cl @@ -0,0 +1,296 @@ +#!/bin/sh +set -eu + + +uuid() { + od -xN20 /dev/urandom | + head -n1 | + awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}' +} + +tmpname() { + echo "${TMPDIR:-/tmp}/cl.tmpfile.$(uuid)" +} + +mkstemp() { + name="$(tmpname)" + touch "$name" + echo "$name" +} + +escape_name() { + printf '%s' "$1" | + sed 's|"|\\"|g' | + printf '(load "%s")\n' "$(cat -)" +} + + +IMPLEMENTATIONS=' +abcl +allegro +ccl +clasp +clisp +cmucl +ecl +jscl +mkcl +sbcl +' + +usage() { + cat <<-'EOF' + Usage: + cl [-e EXP] [-f FILE] [-p] [-M IMAGE] [-I IMPL] [-n] [-v] [FILE...] + cl -l + cl -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -e EXP an sexp to be evaluated (can be given more than once) + -f FILE FIXME + -p print the value of the last given expression + -M IMAGE load the given Lisp image + -m disable looking for the default image under $XDG_DATA_HOME + -I IMPL use the given implementation (default: $LISP_CLI_IMPL) + -n skip loading the implementation's init file + -v verbose mode + -l list the known types of implementations + -h, --help show this message + + FILE FIXME + + + Lauch the desired Lisp implementation, properly adapting the given + CLI options. + + When the implementation is not explicited on the command line, and + the $LISP_CLI_IMPL environment variable in unset, implementations are + searched for alphabetically in $PATH, untill one is found, otherwise + an error is emitted. + + The supported implementations are: + EOF + + + for i in $IMPLEMENTATIONS; do + printf '%s\n' "$i" + done + + cat <<-'EOF' + + + Examples: + + Launch CLISP REPL, when $LISP_CLI_IMPL is set to 'clisp': + + $ cl + + + Lauch SBCL REPL, with the given Lisp image loaded, skipping the + loading of the '.sbclrc' file: + + $ cl -n -Isbcl sbcl.image + + + Run file1.lisp with ABCL: + + $ cl -Iabcl file1.lisp + + + Process STDIN: + + $ cat <<-EOS > process.lisp + + EOS + $ cat f1.txt f2.txt | cl -p process.lisp + + + Print a value on all types of implementations: + + $ for i in `cl -l`; do cl -I$i -pe 'call-arguments-list'; done + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +NO_RC=false +SCRIPT="$(mkstemp)" +LISP_CLI_RC="${XDG_CONFIG_HOME:-$HOME/.config}/lisp-cli/init.lisp" +VERBOSE=false +IMAGE='' +SKIP_DEFAULT_IMAGE=false +IMPL="${LISP_CLI_IMPL:-}" +while getopts 'e:f:pM:mI:nvlh' flag; do + case "$flag" in + e) + printf '%s\n' "$OPTARG" >> "$SCRIPT" + ;; + f) + escape_name "$OPTARG" >> "$SCRIPT" + ;; + M) + IMAGE="$OPTARG" + ;; + m) + SKIP_DEFAULT_IMAGE=true + ;; + I) + IMPL="$OPTARG" + ;; + n) + NO_RC=true + ;; + v) + VERBOSE=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +INTERACTIVE=true +for f in "$@"; do + INTERACTIVE=false + escape_name "$f" >> "$SCRIPT" +done + +MAIN="$(mkstemp)" +if [ "$NO_RC" = false ] && [ -e "$LISP_CLI_RC" ]; then + escape_name "$LISP_CLI_RC" > "$MAIN" +fi + +if [ "$INTERACTIVE" = true ]; then + escape_name "$SCRIPT" >> "$MAIN" +else + cat <<-EOF >> "$MAIN" + (handler-case + (progn + (load "$SCRIPT" + :verbose NIL + :print NIL) + (uiop:quit 0)) + (error (e) + (format *error-output* "~&~%ERROR: ~a" e) + (uiop:quit 1))) + EOF +fi + +if [ -z "$IMPL" ]; then + for i in $IMPLEMENTATIONS; do + if command -v "$i" > /dev/null; then + IMPL="$i" + break + fi + done + if [ -z "$IMPL" ]; then + printf 'Could not find any implementation in $PATH.\n' >&2 + exit 2 + fi +fi + +DEFAULT_IMAGE="${XDG_DATA_HOME:-$HOME/.local/share}/lisp-cli/$IMPL.image" +if [ "$SKIP_DEFAULT_IMAGE" = false ] && [ -z "$IMAGE" ] && + [ -e "$DEFAULT_IMAGE" ]; then + IMAGE="$DEFAULT_IMAGE" +fi + +case "$IMPL" in + abcl) + exit 4 + ;; + allegro) + exit 4 + ;; + ccl) + exit 4 + ;; + clasp) + exit 4 + ;; + clisp) + ARGS="-ansi -i $MAIN" + if [ -n "$IMAGE" ]; then + set -- -M "$IMAGE" + fi + if [ "$NO_RC" = true ]; then + ARGS="$ARGS -norc" + fi + if [ "$VERBOSE" = false ]; then + ARGS="$ARGS -q -q" + else + set -x + fi + exec clisp $ARGS "$@" + ;; + cmucl) + exit 4 + ;; + ecl) + exit 4 + ;; + jscl) + exit 4 + ;; + mkcl) + exit 4 + ;; + sbcl) + ARGS="--disable-debugger --script $MAIN" + if [ "$VERBOSE" = false ]; then + ARGS="$ARGS --noinform" + fi + if [ "$NO_RC" = true ]; then + ARGS="$ARGS --no-sysinit --no-userinit" + fi + if [ -n "$IMAGE" ]; then + set -- --core "$IMAGE" + fi + exec sbcl $ARGS "$@" + ;; + *) + printf 'Unsupported implementation: "%s".\n\n' "$IMPL" >&2 + usage >&2 + exit 2 + ;; +esac + +exit + +# https://www.cliki.net/cl-launch +# buildapp +# https://github.com/memleaks/clbuild +# https://www.cliki.net/roswell +# https://github.com/shinmera/cl-all +# https://fare.livejournal.com/184127.html +# https://github.com/rolpereira/trivial-dump-core +# FIXME: enable readline from CL itself +when competing with roswell, add completion +FIXME: implement the example from help string diff --git a/etc/lisp-cli/init.lisp b/etc/lisp-cli/init.lisp index 0f01d57..062446e 100644 --- a/etc/lisp-cli/init.lisp +++ b/etc/lisp-cli/init.lisp @@ -3,3 +3,29 @@ (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) + +(defun load-once (p) + (let ((k (intern + (concatenate 'string + (string :ql/) + (string p)) + "KEYWORD"))) + (unless (member k *features*) + (ql:quickload p) + (pushnew k *features*)) + k)) + +(mapcar #'load-once + (list + :cl-ppcre + :cffi + :trivial-dump-core + :named-readtables + :rstring)) + +(mapcar (lambda (p) + (pushnew (concatenate 'string p "/") cffi:*foreign-library-directories* + :test #'equal)) + (cl-ppcre:split ":" (uiop:getenv "LIBRARY_PATH"))) + +(load-once :cl-fswatch) diff --git a/etc/sh/rc b/etc/sh/rc index 0f0ed5d..d5801b8 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -87,6 +87,7 @@ export LEX=flex export LDFLAGS='-flto' export LISP='sbcl --eval' export N_PROCS GUILE_EFFECTIVE_VERSION +export LISP_CLI_IMPL=clisp add_prefix() { export GUILE_LOAD_PATH="$1/share/guile/site/$GUILE_EFFECTIVE_VERSION${GUILE_LOAD_PATH:+:}${GUILE_LOAD_PATH:-:}" -- cgit v1.2.3 From b5260d6af32ad0960b4bf974730934ca5c56d48b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 23:40:40 -0300 Subject: Makefile: Include working Lisp image for SBCL --- Makefile | 12 ++++++++---- bin/cl | 16 +++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 7384fb2..f5a86ab 100644 --- a/Makefile +++ b/Makefile @@ -5,12 +5,16 @@ pod2man = \ share/man/man1/z.1 \ +lisp-images = \ + $(XDG_DATA_HOME)/lisp-cli/clisp.image \ + $(XDG_DATA_HOME)/lisp-cli/sbcl.image \ + derived-assets = \ $(pod2man) \ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ $(XDG_DATA_HOME)/common-lisp/source \ $(XDG_DATA_HOME)/euandreh/e.list.txt \ - $(XDG_DATA_HOME)/lisp-cli/clisp.image \ + $(lisp-images) @@ -30,9 +34,9 @@ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub: $(XDG_DATA_HOME)/euandreh/e.list.txt: ~/Documents/txt/ opt/aux/gen-e-list.sh sh opt/aux/gen-e-list.sh > $@ -$(XDG_DATA_HOME)/lisp-cli/clisp.image: $(XDG_CONFIG_HOME)/lisp-cli/init.lisp bin/cl - cl \ - -I clisp \ +$(lisp-images): $(XDG_CONFIG_HOME)/lisp-cli/init.lisp bin/cl + I=`echo $@ | awk -F/ '$$0=$$(NF)' | cut -d. -f1` && cl \ + -I $$I \ -v \ -e '(ql:quickload :trivial-dump-core)' \ -e '(trivial-dump-core:dump-image "$@")' \ diff --git a/bin/cl b/bin/cl index 1b9a659..2135f5c 100755 --- a/bin/cl +++ b/bin/cl @@ -198,7 +198,7 @@ else :print NIL) (uiop:quit 0)) (error (e) - (format *error-output* "~&~%ERROR: ~a" e) + (format *error-output* "~&~%error: ~a~%" e) (uiop:quit 1))) EOF fi @@ -263,17 +263,19 @@ case "$IMPL" in exit 4 ;; sbcl) - ARGS="--disable-debugger --script $MAIN" - if [ "$VERBOSE" = false ]; then - ARGS="$ARGS --noinform" + ARGS="--load $MAIN" + if [ -n "$IMAGE" ]; then + set -- --core "$IMAGE" fi if [ "$NO_RC" = true ]; then ARGS="$ARGS --no-sysinit --no-userinit" fi - if [ -n "$IMAGE" ]; then - set -- --core "$IMAGE" + if [ "$VERBOSE" = false ]; then + ARGS="--noinform $ARGS" + else + set -x fi - exec sbcl $ARGS "$@" + exec sbcl "$@" $ARGS ;; *) printf 'Unsupported implementation: "%s".\n\n' "$IMPL" >&2 -- cgit v1.2.3 From 21b8fb9e3b847733ead51b56e997fbf4370c2e03 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 23:46:56 -0300 Subject: bin/cl: Handle -l option --- bin/cl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/cl b/bin/cl index 2135f5c..77f6fb6 100755 --- a/bin/cl +++ b/bin/cl @@ -163,6 +163,12 @@ while getopts 'e:f:pM:mI:nvlh' flag; do v) VERBOSE=true ;; + l) + for i in $IMPLEMENTATIONS; do + printf '%s\n' "$i" + done + exit + ;; h) usage help -- cgit v1.2.3 From 7c3a0a4f09c81558918b66deeafa486234a73294 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 20 Oct 2022 11:07:19 -0300 Subject: Fix all ShellCheck warnings IOW, `make check-shellcheck` passes. --- bin/backup | 2 ++ bin/bins | 4 +++- bin/boop | 2 +- bin/cl | 26 +++++++++++++++----------- bin/color | 1 + bin/dice | 9 ++++++++- bin/grun | 2 ++ bin/httpno | 8 +++++++- bin/lines | 2 +- bin/menu | 8 +++++++- bin/msg | 1 - bin/yt | 3 +++ etc/sh/cronjob.sh | 1 + etc/sh/rc | 1 + etc/sh/vcs-ps1.sh | 2 +- 15 files changed, 53 insertions(+), 19 deletions(-) diff --git a/bin/backup b/bin/backup index 0ebef43..be7d996 100755 --- a/bin/backup +++ b/bin/backup @@ -93,6 +93,8 @@ ARCHIVE_TAG="${1:-manual}" run() { set -x + # The contents of $VERBOSE_FLAGS doesn't involve user input: + # shellcheck disable=2086 borg create \ $VERBOSE_FLAGS \ --comment "$COMMENT" \ diff --git a/bin/bins b/bin/bins index 28e92f1..710cf8a 100755 --- a/bin/bins +++ b/bin/bins @@ -64,8 +64,10 @@ shift $((OPTIND- 1)) F="$XDG_CACHE_HOME/euandreh/bins" IFS=: +# Word-splitting is the goal: +# shellcheck disable=2086 if stest -rdq -n "$F" $PATH; then - trap "rm -f $F-tmp" EXIT + trap 'rm -f $F-tmp' EXIT stest -lxf $PATH | sort -u > "$F"-tmp mv "$F"-tmp "$F" fi diff --git a/bin/boop b/bin/boop index d2de30f..a7792b3 100755 --- a/bin/boop +++ b/bin/boop @@ -77,7 +77,7 @@ else N=1 fi -CMD="$@" +CMD="$*" msg -"$N" -bs -D "${MESSAGE:-$CMD}" exit "$STATUS" diff --git a/bin/cl b/bin/cl index 77f6fb6..a38d00a 100755 --- a/bin/cl +++ b/bin/cl @@ -187,6 +187,7 @@ for f in "$@"; do INTERACTIVE=false escape_name "$f" >> "$SCRIPT" done +set -- MAIN="$(mkstemp)" if [ "$NO_RC" = false ] && [ -e "$LISP_CLI_RC" ]; then @@ -217,7 +218,7 @@ if [ -z "$IMPL" ]; then fi done if [ -z "$IMPL" ]; then - printf 'Could not find any implementation in $PATH.\n' >&2 + printf "Could not find any implementation in \$PATH.\n" >&2 exit 2 fi fi @@ -228,6 +229,7 @@ if [ "$SKIP_DEFAULT_IMAGE" = false ] && [ -z "$IMAGE" ] && IMAGE="$DEFAULT_IMAGE" fi + case "$IMPL" in abcl) exit 4 @@ -242,19 +244,19 @@ case "$IMPL" in exit 4 ;; clisp) - ARGS="-ansi -i $MAIN" + set -- -ansi -i "$MAIN" if [ -n "$IMAGE" ]; then - set -- -M "$IMAGE" + set -- "$@" -M "$IMAGE" fi if [ "$NO_RC" = true ]; then - ARGS="$ARGS -norc" + set -- "$@" -norc fi if [ "$VERBOSE" = false ]; then - ARGS="$ARGS -q -q" + set -- "$@" -q -q else set -x fi - exec clisp $ARGS "$@" + exec clisp "$@" ;; cmucl) exit 4 @@ -269,19 +271,21 @@ case "$IMPL" in exit 4 ;; sbcl) - ARGS="--load $MAIN" + set -- --load "$MAIN" if [ -n "$IMAGE" ]; then - set -- --core "$IMAGE" + # The '--core' "C runtime option" must appear before the + # other "Lisp options", such as '--load'. + set -- --core "$IMAGE" "$@" fi if [ "$NO_RC" = true ]; then - ARGS="$ARGS --no-sysinit --no-userinit" + set -- "$@" --no-sysinit --no-userinit fi if [ "$VERBOSE" = false ]; then - ARGS="--noinform $ARGS" + set -- "$@" --noinform else set -x fi - exec sbcl "$@" $ARGS + exec sbcl "$@" ;; *) printf 'Unsupported implementation: "%s".\n\n' "$IMPL" >&2 diff --git a/bin/color b/bin/color index 05ef95b..dc610e9 100755 --- a/bin/color +++ b/bin/color @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=2059 set -eu usage() { diff --git a/bin/dice b/bin/dice index 93556a5..4a145d0 100755 --- a/bin/dice +++ b/bin/dice @@ -18,15 +18,21 @@ help() { SIZE the size of the dice (default: 6) + Roll a dice of SIZE. Caveat: rolling a dice more than once in + the same second will give you the same number. + + Examples: Roll a dice of size 6: $ dice + 3 Roll a D20: $ dice 20 + 15 EOF } @@ -63,4 +69,5 @@ shift $((OPTIND - 1)) SIZE="${1:-6}" -echo $(((RANDOM % SIZE) + 1)) +RAND="$(awk 'BEGIN { srand(); print int(rand()*32768) }' /dev/null)" +echo $(((RAND % SIZE) + 1)) diff --git a/bin/grun b/bin/grun index 982420a..74d8819 100755 --- a/bin/grun +++ b/bin/grun @@ -91,4 +91,6 @@ else OUT="$(gpg -dq "$FILENAME" | "$@")" fi +# GPG recipients can't contain spaces: +# shellcheck disable=2086 echo "$OUT" | gpg -e ${RECIPIENTS_FLAG:--r eu@euandre.org} | sponge "$FILENAME" diff --git a/bin/httpno b/bin/httpno index 0e8d66f..e64b872 100755 --- a/bin/httpno +++ b/bin/httpno @@ -45,7 +45,8 @@ help() { } DATA() { - awk 'd == 1 { print; next } /^__DATA__$/ { d = 1 }' "$0" + awk 'd == 1 { print; next } /^__DATA__$/ { d = 1 }' "$0" | + head -n -1 # trim ShellCheck quote } @@ -88,6 +89,10 @@ fi exit + +# Make ShellCheck happy. See https://github.com/koalaman/shellcheck/issues/1201 +# shellcheck disable=1112 +echo " __DATA__ 100 Continue 101 Switching Protocols @@ -148,3 +153,4 @@ __DATA__ 509 Bandwidth Limit Exceeded 510 Not Extended 511 Network Authentication Required +" diff --git a/bin/lines b/bin/lines index b2558b8..2f0bf46 100755 --- a/bin/lines +++ b/bin/lines @@ -73,7 +73,7 @@ START="${1:-}" if [ -z "${2:-}" ]; then END=1 else - END=$(($2 - $START + 1)) + END=$(($2 - START + 1)) fi eval "$(assert-arg "$START" 'START')" diff --git a/bin/menu b/bin/menu index 9f1fe09..94e124f 100755 --- a/bin/menu +++ b/bin/menu @@ -76,7 +76,8 @@ eval "$(assert-arg "$ACTION" 'ACTION')" DATA() { - awk 'd == 1 { print; next } /^__DATA__$/ { d = 1 }' "$0" + awk 'd == 1 { print; next } /^__DATA__$/ { d = 1 }' "$0" | + head -n -1 # trim ShellCheck quote } show() { @@ -144,6 +145,10 @@ esac exit + +# Make ShellCheck happy. See https://github.com/koalaman/shellcheck/issues/1201 +# shellcheck disable=1112 +echo ' __DATA__ grinning face 😀 smiling face with open mouth 😃 @@ -1577,3 +1582,4 @@ Western Sahara 🇪🇭 Yemen 🇾🇪 Zambia 🇿🇲 Zimbabwe 🇿🇼 +' diff --git a/bin/msg b/bin/msg index f685ffb..b2a6794 100755 --- a/bin/msg +++ b/bin/msg @@ -68,7 +68,6 @@ MAIL=false DESKTOP=false BELL=false ACTION_DONE=false -SHOW_USAGE=false while getopts '01XsSmDbh' flag; do case "$flag" in 0) diff --git a/bin/yt b/bin/yt index ddcc02d..d0ff37e 100755 --- a/bin/yt +++ b/bin/yt @@ -100,6 +100,9 @@ if [ -z "${FORCE:-}" ]; then EXTRA_OPTIONS="--download-archive $HOME/Downloads/yt-dl/seen.txt" fi +# The value of $EXTRA_OPTIONS doesn't depend on user input, and can't contain +# spaces, unless $HOME contains spaces: +# shellcheck disable=2086 youtube-dl \ --batch-file "$F" \ --format best \ diff --git a/etc/sh/cronjob.sh b/etc/sh/cronjob.sh index 1e11b50..05022e0 100755 --- a/etc/sh/cronjob.sh +++ b/etc/sh/cronjob.sh @@ -65,6 +65,7 @@ done shift $((OPTIND - 1)) +# shellcheck disable=1090 . ~/.usr/etc/sh/rc CMD="$*" with-email -s "$CMD" -- "$@" 1>>"$XDG_LOG_HOME"/euandreh/mcron.log 2>&1 diff --git a/etc/sh/rc b/etc/sh/rc index d5801b8..69606fa 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=1090,1091 export ENV=~/.profile diff --git a/etc/sh/vcs-ps1.sh b/etc/sh/vcs-ps1.sh index b9a849a..7cc528d 100644 --- a/etc/sh/vcs-ps1.sh +++ b/etc/sh/vcs-ps1.sh @@ -128,7 +128,7 @@ shell_status_level() { } shell_status_jobs() { - JOBS="$(jobs | grep -v autojump | wc -l)" + JOBS="$(jobs | grep -c autojump)" if [ "$JOBS" != 0 ]; then color -c red "$JOBS" fi -- cgit v1.2.3 From 02e6cb2407490cb70bc6006f7ba8efe69b2428bc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 20 Oct 2022 12:36:54 -0300 Subject: Makefile: Exclude subroutine lint of perlcritic --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f5a86ab..5764eb2 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ check-shellcheck: check-perlcritic: git ls-files | \ xargs awk '/^#!\/usr\/bin\/env perl$$/ { print FILENAME } { nextfile }' | \ - xargs perlcritic + xargs perlcritic --exclude=subroutine check-fixme: if git grep FIXME -- ':(exclude)Makefile'; then \ -- cgit v1.2.3 From 55f968cfb0cbacb2ca06d37f288f27d066728cf7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 00:23:42 -0300 Subject: Makefile: Exclude global gitignore file from check-fixme target --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5764eb2..4e2f14a 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ check-perlcritic: xargs perlcritic --exclude=subroutine check-fixme: - if git grep FIXME -- ':(exclude)Makefile'; then \ + if git grep FIXME -- ':(exclude)Makefile' ':(exclude)etc/git/ignore'; then \ printf 'Leftover FIXME markers.\n' >&2; \ exit 1; \ fi -- cgit v1.2.3 From 8d9df7203a9bc81114a63ec9294b73487edfde79 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 00:24:53 -0300 Subject: bin/repos: Add new working utility This will be the base replacement for mr(1) (A.K.A. myrepos). Instead of having to feed what repositories to track or not manually to the ~/.mrconfig file, dynamically discover them with this new utility. --- bin/repos | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100755 bin/repos diff --git a/bin/repos b/bin/repos new file mode 100755 index 0000000..27e0879 --- /dev/null +++ b/bin/repos @@ -0,0 +1,187 @@ +#!/bin/sh +set -eu + + +usage() { + cat <<-'EOF' + Usage: + repos [-v] [DIRECTORY] + repos -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -v enable verbose mode + -h, --help show this message + + DIRECTORY the folder to traverse + + + Traverse DIRECTORY looking for VCS repositores. As soon as + one is found, stop recursing, and emit its name alongside its + type. + + On verbose mode, print the directories being visited. + + + Examples: + + Show all repositories under ~/dev/, excluding a few directories: + + $ repos -e ~/dev/go/ -e ~/dev/quicklisp/ ~/dev/ + # ... + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + + +# Similar to urlencode but only for % and \n (and not \0). +array_encode() { + sed 's/%/%25/g' | sed -e :a -e '$!N; s/\n/%0A/; ta' +} + +array_decode() { + sed -e 's/%0A/\ +/g' -e 's/%25/%/g' +} + + +# +# To avoid needing to keep decoding the array elements on every call to +# `arr_includes`, assume directory names don't contain newlines. This makes the +# current code scanning ~/dev/ from 8 seconds go to 1 second. +# + +arr_push() { + ARR="$1" + ELT="$2" + if [ -n "$ARR" ]; then + echo "$ARR" + fi + echo "$ELT" # | array_encode +} + +arr_includes() { + ARR="$1" + ELT="$2" + echo "$ARR" | while read -r el; do + # if [ "$(printf '%s\n' "$el" | array_decode)" = "$ELT" ]; then + if [ "$el" = "$ELT" ]; then + return 2 + fi + done + if [ $? = 2 ]; then + return 0 + else + return 1 + fi +} + +EXCLUDE= +VERBOSE=false +while getopts 'e:vh' flag; do + case "$flag" in + e) + case "$OPTARG" in + */) + ARG="$OPTARG" + ;; + *) + ARG="$OPTARG/" + ;; + esac + EXCLUDE="$(arr_push "$EXCLUDE" "$ARG")" + ;; + v) + VERBOSE=true + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +is_repository() { + if [ -e "$1"/.git ]; then + printf 'git:%s\n' "$1" + return 0 + elif [ -e "$1"/.hg ]; then + printf 'mercurial:%s\n' "$1" + return 0 + elif [ -e "$1"/.bk ]; then + printf 'bitkeeper:%s\n' "$1" + return 0 + elif [ -e "$1"/_darcs ]; then + printf 'darcs:%s\n' "$1" + return 0 + elif [ -e "$1"/CVS/ ]; then + printf 'cvs:%s\n' "$1" + return 0 + elif [ -e "$1"/"$(basename "$1")".fossil ]; then + printf 'fossil:%s\n' "$1" + return 0 + fi + return 1 +} + + +traverse_directory() { + if [ "$VERBOSE" = true ]; then + printf 'cur: %s\n' "$1" >&2 + fi + if arr_includes "$EXCLUDE" "$1"; then + return + fi + if is_repository "$1"; then + return + fi + for d in "$1"/*; do + if [ "$VERBOSE" = true ]; then + printf 'cur: %s\n' "$d" >&2 + fi + if [ ! -d "$d" ]; then + continue + fi + if arr_includes "$EXCLUDE" "$d/"; then + continue + fi + if ! is_repository "$d"; then + traverse_directory "$d" + fi + done +} + +if [ -z "${1:-}" ]; then + set -- "$PWD" +fi + +for dir in "$@"; do + traverse_directory "${dir%%/}" +done -- cgit v1.2.3 From e265e9ca31615589ad5020be7595f7ca578987ba Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 14:53:03 -0300 Subject: bin/vcs: Add initial version of VCS compatibility utility --- bin/vcs | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100755 bin/vcs diff --git a/bin/vcs b/bin/vcs new file mode 100755 index 0000000..3cd8ed0 --- /dev/null +++ b/bin/vcs @@ -0,0 +1,96 @@ +#!/bin/sh +set -eu + + +usage() { + cat <<-'EOF' + Usage: + vcs TYPE ACTION + vcs -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -h, --help show this message + + TYPE the type of the underlying VCS: + - git + - darcs + - mercurial + - fossil + - cvs + ACTION the action to be performed on the repository: + - fetch + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + esac +done +shift $((OPTIND - 1)) + + +git_fetch() { + git fetch +} + +darcs_fetch() { + darcs fetch +} + +mercurial_fetch() { + hg pull +} + +fossil_fetch() { + fossil pull +} + +cvs_fetch() { + cvs update +} + + +VCS="${1:-}" +ACTION="${2:-}" + +eval "$(assert-arg "$VCS" 'VCS')" +eval "$(assert-arg "$ACTION" 'ACTION')" + + +CMD="$VCS"_"$ACTION" +if ! command -v "$CMD" >/dev/null; then + printf 'Invalid VCS/action combination: %s %s.\n' "$VCS" "$ACTION" >&2 + exit 2 +fi + +"$CMD" -- cgit v1.2.3 From 313ea64cbb927604d90e9173c4318bd7a5ca265c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 14:53:56 -0300 Subject: bin/update: Combine `repos` and `vcs` to fetch updates from repositories Remove FIXME marker. --- bin/update | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/update b/bin/update index 7ec5bd8..9eda076 100755 --- a/bin/update +++ b/bin/update @@ -76,5 +76,10 @@ wait rfc -u newsboat -x reload -# FIXME -# mr -j "$N_PROC" fetch # git pull for all repos under ~/dev/ +repos -e ~/dev/go/ -e ~/dev/quicklisp/ -e ~/dev/archive/ ~/dev/ | + while read -r line; do + TYPE="$(echo "$line" | cut -d: -f1)" + DIR="$( echo "$line" | cut -d: -f2-)" + cd "$DIR" + vcs "$TYPE" fetch || printf 'Failed to fetch repository: %s.\n' "$DIR" >&2 + done -- cgit v1.2.3 From d5b0642608a705d5c5de9e8a7f46095e23efa0bf Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 15:01:53 -0300 Subject: bin/x: Generate WIP version of the POD manpage Remove FIXME marker. --- Makefile | 4 ++++ bin/x | 53 +++++++---------------------------------------------- 2 files changed, 11 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index 4e2f14a..f0ef75c 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ pod2man = \ + share/man/man1/x.1 \ share/man/man1/z.1 \ @@ -21,6 +22,9 @@ derived-assets = \ all: $(derived-assets) +share/man/man1/x.1: bin/x + pod2man bin/x > $@ + share/man/man1/z.1: bin/z pod2man bin/z > $@ diff --git a/bin/x b/bin/x index 2133c2f..42f5770 100755 --- a/bin/x +++ b/bin/x @@ -106,58 +106,19 @@ for (@ARGV) { exit status_for(system @CMD); + __END__ =head1 NAME -z - automatically uncompress arguments to other commands +x - chain shell commands without creating a subshell =head1 SYNOPSYS -z COMMAND FILE... ARGUMENTS... +x COMMANDS... [ '&&' / '||' / '|' ] COMMANDS... + +x COMMANDS... [ 'AND' / 'OR' / 'PIPE' ] COMMANDS... + +x -h =cut -# FIXME: implement manpage in pod -# .TH x 1 1970-01-01 "x latest" "x user manual" -# -# -# .SH NAME -# -# x - chain shell commands without creating a subshell. -# -# -# .SH SYNOPSYS -# -# \fBx\fR [\fIOPTIONS\fR] COMMAND... [ \fI'&&'\fR / \fI'||'\fR / \fI'|'\fR ] COMMAND... -# -# -# .SH DESCRIPTION -# -# \fBx\fR is a \m[blue]\fBtool\fP\m[], from -# .pdfhref W -D https://euandre.org/ -- The best website ever -# . -# -# -# .SH OPTIONS -# -# .TP -# \fB-h\fR, \fB--help\fR -# Show help text. -# -# -# .SH OPERATORS -# -# -# =pod -# =head1 Heading Text -# =head2 Heading Text -# =head3 Heading Text -# =head4 Heading Text -# =over indentlevel -# =item stuff -# =back -# =begin format -# =end format -# =for format text... -# =encoding type -# =cut -- cgit v1.2.3 From 35de760f49b1897a2c8829a17163d06651d160dc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 15:03:31 -0300 Subject: share/man/man1/ootb.1: Remove standalone manpage Stick to the help message. --- share/man/man1/ootb.1 | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 share/man/man1/ootb.1 diff --git a/share/man/man1/ootb.1 b/share/man/man1/ootb.1 deleted file mode 100644 index 55761fb..0000000 --- a/share/man/man1/ootb.1 +++ /dev/null @@ -1,26 +0,0 @@ -.TH OOTB 1 2022-10-10 "ootb 0.1.0" "ootb user manual" - - -.SH NAME - -ootb - build a symlink tree of files, to allow out-of-tree builds. - - -.SH SYNOPSYS - -\fBootb\fP \fIBUILD_DIRECTORY\fP -\fBootb\fP \fB-h\fP - - -.SH DESCRIPTION - -\fBootb\fP is a \m[blue]tool\fP\m[], from here. - - -.SH OPTIONS - -.TP -\fB-h\fP, \fB--help\fP -Show thep text. - -.\" FIXME -- cgit v1.2.3 From 5131d2400fe7f1b47ba26b93ebc0b291ea5f07b3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 15:05:42 -0300 Subject: opt/tests/x-tests.sh: Remove unused test files --- opt/tests/x-tests.sh | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100755 opt/tests/x-tests.sh diff --git a/opt/tests/x-tests.sh b/opt/tests/x-tests.sh deleted file mode 100755 index 4cb6faf..0000000 --- a/opt/tests/x-tests.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -set -eu - -perl ~/.usr/bin/x2 echo -perl ~/.usr/bin/x2 echo '&&' echo - -# Quoting stuff works -perl bin/x2 echo "'abc\'" - -# "OR" has a stronger precedence -perl bin/x2 echo a '||' this-executable-does-not-exist -# FIXME -- cgit v1.2.3 From c34e88692310531fff09944b11168d3543ff290b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 15:13:01 -0300 Subject: bin/menu: Settle with passwords in clipboard daemon for now --- bin/menu | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bin/menu b/bin/menu index 94e124f..3b031b0 100755 --- a/bin/menu +++ b/bin/menu @@ -109,8 +109,6 @@ case "$ACTION" in password) CHOICE="$(pass_list | show 'password')" if [ -n "$CHOICE" ]; then - echo trap 'clipctl enable' EXIT # FIXME - echo clipctl disable if pass show -c1 "$CHOICE"; then notify-send -t 5000 -u critical -- \ "$CHOICE" 'password copied to clipboard' @@ -122,8 +120,6 @@ case "$ACTION" in ;; clipboard) greenclip print | show 'clipboard' | copy - notify-send -t 5000 -u low -- \ - "oiwjef" 'copied to clipboard' ;; yubikey) CHOICE="$(ykman oath accounts list | show 'OTP')" -- cgit v1.2.3 From b3372e864a8c8ec5393d731919da0fc94e63d1da Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 15:19:31 -0300 Subject: bin/update: Add more explicit warning when vcs fetch fails --- bin/update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/update b/bin/update index 9eda076..2c7bba8 100755 --- a/bin/update +++ b/bin/update @@ -81,5 +81,5 @@ repos -e ~/dev/go/ -e ~/dev/quicklisp/ -e ~/dev/archive/ ~/dev/ | TYPE="$(echo "$line" | cut -d: -f1)" DIR="$( echo "$line" | cut -d: -f2-)" cd "$DIR" - vcs "$TYPE" fetch || printf 'Failed to fetch repository: %s.\n' "$DIR" >&2 + vcs "$TYPE" fetch || printf 'WARNING: Failed to fetch repository: %s.\n' "$DIR" >&2 done -- cgit v1.2.3 From bb23752c782f90263c06d1fea534fa09d2372240 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 18:48:35 -0300 Subject: bin/vcs: Don't wait more than 5 minutes for CVS locks --- bin/vcs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/vcs b/bin/vcs index 3cd8ed0..800574d 100755 --- a/bin/vcs +++ b/bin/vcs @@ -76,7 +76,7 @@ fossil_fetch() { } cvs_fetch() { - cvs update + timeout 300 cvs update } -- cgit v1.2.3 From 8da93bea02daea1f849b682c2eddcc97c467236f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 18:54:49 -0300 Subject: bin/untill: Change default wait from 60 seconds to 5 seconds --- bin/untill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/untill b/bin/untill index 403717f..030f921 100755 --- a/bin/untill +++ b/bin/untill @@ -14,7 +14,7 @@ help() { Options: -n SECONDS the amount of seconds to sleep between - attempts (default: 60) + attempts (default: 5) -h, --help show this message @@ -52,7 +52,7 @@ for flag in "$@"; do esac done -_SECONDS=60 +_SECONDS=5 while getopts 'n:h' flag; do case "$flag" in n) -- cgit v1.2.3 From 64547cb318bf60456063b6faad2ef433bfd3e177 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 21 Oct 2022 19:05:31 -0300 Subject: etc/sh/rc: Remove rreload --- etc/sh/rc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/etc/sh/rc b/etc/sh/rc index 69606fa..d1fc6de 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -112,7 +112,6 @@ add_prefix "$XDG_PREFIX" unalias -a alias r='reload' -alias rr='rreload' alias p='ping euandre.org -c 3' alias c='tmux send-keys -R \; clear-history' @@ -194,10 +193,6 @@ f() { reload() { . ~/.profile -} - -rreload() { - reload xset r rate 225 100 # FIXME: move xorg conf } -- cgit v1.2.3 From 1a65aa8dc42ca84927981ec59349b1647689be10 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 22 Oct 2022 13:00:55 -0300 Subject: bin/yt: Move path to "seen.txt" file --- bin/yt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/yt b/bin/yt index d0ff37e..9aed64f 100755 --- a/bin/yt +++ b/bin/yt @@ -97,7 +97,7 @@ YT_TEMPLATE="$HOME/Downloads/yt-dl/%(uploader)s/%(upload_date)s %(title)s.%(ext) EXTRA_OPTIONS='' if [ -z "${FORCE:-}" ]; then - EXTRA_OPTIONS="--download-archive $HOME/Downloads/yt-dl/seen.txt" + EXTRA_OPTIONS="--download-archive $HOME/Documents/yt-dl-seen.txt" fi # The value of $EXTRA_OPTIONS doesn't depend on user input, and can't contain -- cgit v1.2.3 From dd7fa3dd8df17398f99189a3a1245f1aac0cfbe9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 22 Oct 2022 14:41:01 -0300 Subject: etc/guix/system.scm: Add qemu-binfmt-service-type --- etc/guix/system.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 948a398..b625d7f 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -71,6 +71,10 @@ (service virtlog-service-type) (service unattended-upgrade-service-type) (service nix-service-type) + (service qemu-binfmt-service-type + (qemu-binfmt-configuration + (platforms + (lookup-qemu-platforms "arm" "aarch64")))) (service cups-service-type (cups-configuration (web-interface? #t))) -- cgit v1.2.3 From 3c245bb637d48c8c2bca0440af10a8eec974517c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 22 Oct 2022 17:10:20 -0300 Subject: etc/sh/vcs-ps1.sh: Fix $JOBS count Bug introduced in 7c3a0a4f09c81558918b66deeafa486234a73294, when ShellCheck suggested to replace a 'grep | wc -l' combo with 'grep -c', but when I did I mishandled the '-v' option that was there. --- etc/sh/vcs-ps1.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/sh/vcs-ps1.sh b/etc/sh/vcs-ps1.sh index 7cc528d..72df2c4 100644 --- a/etc/sh/vcs-ps1.sh +++ b/etc/sh/vcs-ps1.sh @@ -128,7 +128,7 @@ shell_status_level() { } shell_status_jobs() { - JOBS="$(jobs | grep -c autojump)" + JOBS="$(jobs | grep -cv autojump)" if [ "$JOBS" != 0 ]; then color -c red "$JOBS" fi -- cgit v1.2.3 From 777699f59d808dbb808d6a003167c6c49dddfb58 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 23 Oct 2022 08:30:23 -0300 Subject: bin/gc: remove "current-guix" profile too --- bin/gc | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/gc b/bin/gc index 9a1868b..1570f84 100755 --- a/bin/gc +++ b/bin/gc @@ -66,6 +66,7 @@ disk() { gc_guix() { pass show velhinho/0-andreh-password | head -n1 | sudo -iS guix system delete-generations + pass show velhinho/0-andreh-password | head -n1 | sudo -iS guix gc -d guix home delete-generations guix gc -d } -- cgit v1.2.3 From 401705e9af8be15835c0b43d4f16ce36f1b1b9b5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 23 Oct 2022 22:59:07 -0300 Subject: bin/upgrade: Add equivalent of `update` script --- bin/upgrade | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 bin/upgrade diff --git a/bin/upgrade b/bin/upgrade new file mode 100755 index 0000000..12f319c --- /dev/null +++ b/bin/upgrade @@ -0,0 +1,66 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + upgrade + upgrade -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + Upgrades the system: + - reconfigure the Guix "home" environment and "system". + + + Examples: + + Just use it: + + $ upgrade + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +pass show velhinho/0-andreh-password | + head -n1 | + sudo -iS guix system -v3 reconfigure /etc/guix/configuration.scm +guix home -v3 reconfigure ~/.usr/etc/guix/home.scm -- cgit v1.2.3 From c770584d8e1447c3a0105d0541c16c8fb9e53dc2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 23 Oct 2022 22:59:47 -0300 Subject: etc/guix/home.scm: Register cronjob for "update && upgrade" --- etc/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 6df9f7c..529d174 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -240,6 +240,7 @@ #~(job "0 0 * * *" "cronjob msmtp-queue -r") #~(job "0 0 * * *" "cronjob check") #~(job "5 */6 * * *" "cronjob m") + #~(job "30 0 * * *" "cronjob x update AND upgrade") #~(job "30 0 * * *" "cronjob backup -q cron"))) (define (poweralertd-shepherd-services _config) -- cgit v1.2.3 From 7579ec0e96079de410d0116442a938f3f4347d7b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 24 Oct 2022 14:21:59 -0300 Subject: Move some FIXME markers to ~/.usr/FIXME file --- bin/e | 1 - etc/sh/rc | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/bin/e b/bin/e index dc7b47d..d0b261a 100755 --- a/bin/e +++ b/bin/e @@ -81,7 +81,6 @@ else if [ $# -eq 0 ]; then f="$(fzf --select-1 --exit-0 < "$XDG_DATA_HOME"/euandreh/e.list.txt)" if [ -n "$f" ]; then - # FIXME history -s e "$f" sh -c "$CMD $f" fi diff --git a/etc/sh/rc b/etc/sh/rc index d1fc6de..efd01e8 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -24,7 +24,6 @@ if [ -r "$GUIX_PROFILE"/etc/profile ]; then . "$GUIX_PROFILE"/etc/profile fi -# FIXME idempotent_path_add() { case "$(eval "echo \$$1")" in *"$2"*) @@ -148,7 +147,6 @@ alias flush='sync && echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null' -# FIXME: fix "history" commands # g '^\w.*json_destroy(' g() { # shellcheck disable=2086 @@ -176,7 +174,6 @@ g() { } f() { - # FIXME: speed # profile="f-shell-function$(pwd | sed -e 's_/_-_g')" # file="$(git ls-files | grep ${2:-.} | remembering -p "$profile" -c "fzf --select-1 --exit-0 --preview 'cat {}'")" # shellcheck disable=2086 @@ -193,7 +190,7 @@ f() { reload() { . ~/.profile - xset r rate 225 100 # FIXME: move xorg conf + xset r rate 225 100 } _edit_without_executing() { -- cgit v1.2.3 From 9a511d58ce5963dd9342293c89c85a59d8ac4127 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 24 Oct 2022 14:26:46 -0300 Subject: bin/cl: WIP improve help string --- bin/cl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cl b/bin/cl index a38d00a..a9c83b6 100755 --- a/bin/cl +++ b/bin/cl @@ -53,7 +53,7 @@ help() { Options: -e EXP an sexp to be evaluated (can be given more than once) - -f FILE FIXME + -f FILE a file to be evaluated (can be given more than once) -p print the value of the last given expression -M IMAGE load the given Lisp image -m disable looking for the default image under $XDG_DATA_HOME @@ -63,7 +63,7 @@ help() { -l list the known types of implementations -h, --help show this message - FILE FIXME + FILE the file to be executed as a script Lauch the desired Lisp implementation, properly adapting the given -- cgit v1.2.3 From e215ea1ac6615848253609be68c95a66a53d01ae Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 24 Oct 2022 14:31:05 -0300 Subject: bin/cl: s/NIL/nil/ --- bin/cl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cl b/bin/cl index a9c83b6..5a252ec 100755 --- a/bin/cl +++ b/bin/cl @@ -201,8 +201,8 @@ else (handler-case (progn (load "$SCRIPT" - :verbose NIL - :print NIL) + :verbose nil + :print nil) (uiop:quit 0)) (error (e) (format *error-output* "~&~%error: ~a~%" e) -- cgit v1.2.3 From abad340cfac10498cb71cff42b06cc5b1f2e525b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 24 Oct 2022 15:41:50 -0300 Subject: bin/cl: Move automatic image handling out to bin/li --- Makefile | 8 ++--- bin/cl | 14 ++------- bin/li | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 18 deletions(-) create mode 100755 bin/li diff --git a/Makefile b/Makefile index f0ef75c..22e961c 100644 --- a/Makefile +++ b/Makefile @@ -39,12 +39,8 @@ $(XDG_DATA_HOME)/euandreh/e.list.txt: ~/Documents/txt/ opt/aux/gen-e-list.sh sh opt/aux/gen-e-list.sh > $@ $(lisp-images): $(XDG_CONFIG_HOME)/lisp-cli/init.lisp bin/cl - I=`echo $@ | awk -F/ '$$0=$$(NF)' | cut -d. -f1` && cl \ - -I $$I \ - -v \ - -e '(ql:quickload :trivial-dump-core)' \ - -e '(trivial-dump-core:dump-image "$@")' \ - -e '(uiop:quit)' + I=`echo $@ | awk -F/ '$$0=$$(NF)' | cut -d. -f1` && \ + li -vI $$I -e '(uiop:quit)' diff --git a/bin/cl b/bin/cl index 5a252ec..82620ba 100755 --- a/bin/cl +++ b/bin/cl @@ -56,7 +56,6 @@ help() { -f FILE a file to be evaluated (can be given more than once) -p print the value of the last given expression -M IMAGE load the given Lisp image - -m disable looking for the default image under $XDG_DATA_HOME -I IMPL use the given implementation (default: $LISP_CLI_IMPL) -n skip loading the implementation's init file -v verbose mode @@ -138,9 +137,8 @@ SCRIPT="$(mkstemp)" LISP_CLI_RC="${XDG_CONFIG_HOME:-$HOME/.config}/lisp-cli/init.lisp" VERBOSE=false IMAGE='' -SKIP_DEFAULT_IMAGE=false IMPL="${LISP_CLI_IMPL:-}" -while getopts 'e:f:pM:mI:nvlh' flag; do +while getopts 'e:f:pM:I:nvlh' flag; do case "$flag" in e) printf '%s\n' "$OPTARG" >> "$SCRIPT" @@ -151,9 +149,6 @@ while getopts 'e:f:pM:mI:nvlh' flag; do M) IMAGE="$OPTARG" ;; - m) - SKIP_DEFAULT_IMAGE=true - ;; I) IMPL="$OPTARG" ;; @@ -223,15 +218,10 @@ if [ -z "$IMPL" ]; then fi fi -DEFAULT_IMAGE="${XDG_DATA_HOME:-$HOME/.local/share}/lisp-cli/$IMPL.image" -if [ "$SKIP_DEFAULT_IMAGE" = false ] && [ -z "$IMAGE" ] && - [ -e "$DEFAULT_IMAGE" ]; then - IMAGE="$DEFAULT_IMAGE" -fi - case "$IMPL" in abcl) + ... exit 4 ;; allegro) diff --git a/bin/li b/bin/li new file mode 100755 index 0000000..e62060b --- /dev/null +++ b/bin/li @@ -0,0 +1,106 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + li [-I IMPL ] [-v] [OPTIONS...] + li -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -I IMPL use the given implementation (default: $LISP_CLI_IMPL) + -v verbose mode + -h, --help show this message + + OPTIONS options to be forwarded to cl (lisp-cli) + + + Run the cl(1) executable with OPTIONS, but make sure an up-to-date + image exists and load it. + + + Examples: + + Launch a REPL from an image: + + $ li + + + Give options to cl(1): + + $ li -I sbcl -e '(print 123)' + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +VERBOSE=false +IMPL="${LISP_CLI_IMPL:-clisp}" +while getopts ':I:vh' flag; do + case "$flag" in + I) + IMPL="$OPTARG" + ;; + v) + VERBOSE=true + ;; + h) + usage + help + exit + ;; + *) + ;; + esac +done +if [ "${1:-}" = '--' ]; then + shift +fi + + +IMAGE="${XDG_DATA_HOME:-$HOME/.local/share}/lisp-cli/$IMPL.image" +BIN=~/.usr/bin/cl +INIT="${XDG_CONFIG_HOME:-$HOME/.config}/lisp-cli/init.lisp" +if [ ! -e "$IMAGE" ]; then + printf 'Bootstrapping a new "%s" image...\n' "$IMPL" >&2 + cl \ + -I "$IMPL" \ + -v \ + -e '(ql:quickload :trivial-dump-core)' \ + -e "(trivial-dump-core:dump-image \"$IMAGE\")" \ + -e '(uiop:quit)' +elif [ "$0" -nt "$IMAGE" ] || [ "$BIN" -nt "$IMAGE" ] || [ "$INIT" -nt "$IMAGE" ]; then + printf 'Refresh existing "%s" image...\n' "$IMPL" >&2 + cl \ + -M "$IMAGE" \ + -I "$IMPL" \ + -v \ + -e '(ql:quickload :trivial-dump-core)' \ + -e "(trivial-dump-core:dump-image \"$IMAGE\")" \ + -e '(uiop:quit)' +fi + +if [ "$VERBOSE" = true ]; then + set -x +fi +exec cl -M "$IMAGE" "$@" -- cgit v1.2.3 From 09b3774da826e9da548c63315af1725ba9a21772 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 24 Oct 2022 15:42:11 -0300 Subject: bin/cl: Prefix implementation list items with a hyphen --- bin/cl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cl b/bin/cl index 82620ba..ba93598 100755 --- a/bin/cl +++ b/bin/cl @@ -78,7 +78,7 @@ help() { for i in $IMPLEMENTATIONS; do - printf '%s\n' "$i" + printf -- '- %s\n' "$i" done cat <<-'EOF' -- cgit v1.2.3 From 9dcc071b2ce13baf8e14ac4af142c8807fdc36b8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 24 Oct 2022 15:42:53 -0300 Subject: bin/cl: Remove attempt add "..." operator --- bin/cl | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/cl b/bin/cl index ba93598..232c867 100755 --- a/bin/cl +++ b/bin/cl @@ -221,7 +221,6 @@ fi case "$IMPL" in abcl) - ... exit 4 ;; allegro) -- cgit v1.2.3 From 1fd3869b0e5dc613b0d1eab1ce9948dcd9fe8797 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 24 Oct 2022 19:27:54 -0300 Subject: bin/cl: Reorder SBCL non-verbose argument --- bin/cl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cl b/bin/cl index 232c867..245c0db 100755 --- a/bin/cl +++ b/bin/cl @@ -270,7 +270,7 @@ case "$IMPL" in set -- "$@" --no-sysinit --no-userinit fi if [ "$VERBOSE" = false ]; then - set -- "$@" --noinform + set -- --noinform "$@" else set -x fi -- cgit v1.2.3 From 304657029cd02fb33d9ec432dbad9348d7493541 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 24 Oct 2022 19:46:02 -0300 Subject: bin/cl: Allow giving "-- --option" to the underlying Lisp command --- bin/cl | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/bin/cl b/bin/cl index 245c0db..cadc9d5 100755 --- a/bin/cl +++ b/bin/cl @@ -41,7 +41,7 @@ sbcl usage() { cat <<-'EOF' Usage: - cl [-e EXP] [-f FILE] [-p] [-M IMAGE] [-I IMPL] [-n] [-v] [FILE...] + cl [-e EXP] [-f FILE] [-p] [-M IMAGE] [-I IMPL] [-n] [-v] [FILE...] [-- LISP_OPTIONS] cl -l cl -h EOF @@ -52,17 +52,18 @@ help() { Options: - -e EXP an sexp to be evaluated (can be given more than once) - -f FILE a file to be evaluated (can be given more than once) - -p print the value of the last given expression - -M IMAGE load the given Lisp image - -I IMPL use the given implementation (default: $LISP_CLI_IMPL) - -n skip loading the implementation's init file - -v verbose mode - -l list the known types of implementations - -h, --help show this message + -e EXP an sexp to be evaluated (can be given more than once) + -f FILE a file to be evaluated (can be given more than once) + -p print the value of the last given expression + -M IMAGE load the given Lisp image + -I IMPL use the given implementation (default: $LISP_CLI_IMPL) + -n skip loading the implementation's init file + -v verbose mode + -l list the known types of implementations + -h, --help show this message - FILE the file to be executed as a script + FILE the file to be executed as a script + LISP_OPTIONS options to be forwarrded to the underlying Lisp command Lauch the desired Lisp implementation, properly adapting the given @@ -177,12 +178,21 @@ while getopts 'e:f:pM:I:nvlh' flag; do done shift $((OPTIND - 1)) +PRESERVE_ARGS=false INTERACTIVE=true for f in "$@"; do + if [ "$f" = '--' ]; then + PRESERVE_ARGS=true + shift + break + fi INTERACTIVE=false escape_name "$f" >> "$SCRIPT" done -set -- + +if [ "$PRESERVE_ARGS" = false ]; then + set -- +fi MAIN="$(mkstemp)" if [ "$NO_RC" = false ] && [ -e "$LISP_CLI_RC" ]; then @@ -233,7 +243,7 @@ case "$IMPL" in exit 4 ;; clisp) - set -- -ansi -i "$MAIN" + set -- -ansi -i "$MAIN" "$@" if [ -n "$IMAGE" ]; then set -- "$@" -M "$IMAGE" fi @@ -260,7 +270,7 @@ case "$IMPL" in exit 4 ;; sbcl) - set -- --load "$MAIN" + set -- --load "$MAIN" "$@" if [ -n "$IMAGE" ]; then # The '--core' "C runtime option" must appear before the # other "Lisp options", such as '--load'. -- cgit v1.2.3 From 6f996b8387b9a040707e8a1613311e8fcd1105e5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 00:13:32 -0300 Subject: bin/cl: Setup Clozure --- Makefile | 1 + bin/cl | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 22e961c..dc2600a 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ pod2man = \ lisp-images = \ + $(XDG_DATA_HOME)/lisp-cli/ccl.image \ $(XDG_DATA_HOME)/lisp-cli/clisp.image \ $(XDG_DATA_HOME)/lisp-cli/sbcl.image \ diff --git a/bin/cl b/bin/cl index cadc9d5..6ecfbba 100755 --- a/bin/cl +++ b/bin/cl @@ -28,7 +28,7 @@ escape_name() { IMPLEMENTATIONS=' abcl allegro -ccl +clozure clasp clisp cmucl @@ -236,8 +236,20 @@ case "$IMPL" in allegro) exit 4 ;; - ccl) - exit 4 + clozure) + set -- -l "$MAIN" "$@" + if [ -n "$IMAGE" ]; then + set -- -I "$IMAGE" "$@" + fi + if [ "$NO_RC" = true ]; then + set -- -n "$@" + fi + if [ "$VERBOSE" = false ]; then + set -- -Q "$@" + else + set -x + fi + exec ccl "$@" ;; clasp) exit 4 -- cgit v1.2.3 From 26f57c646b600603a376169470f2f12b09f9533f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 00:14:19 -0300 Subject: bin/cl: Grow "$@" at the beginning --- bin/cl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/cl b/bin/cl index 6ecfbba..ee75b9a 100755 --- a/bin/cl +++ b/bin/cl @@ -257,13 +257,13 @@ case "$IMPL" in clisp) set -- -ansi -i "$MAIN" "$@" if [ -n "$IMAGE" ]; then - set -- "$@" -M "$IMAGE" + set -- -M "$IMAGE" "$@" fi if [ "$NO_RC" = true ]; then - set -- "$@" -norc + set -- -norc "$@" fi if [ "$VERBOSE" = false ]; then - set -- "$@" -q -q + set -- -q -q "$@" else set -x fi @@ -289,7 +289,7 @@ case "$IMPL" in set -- --core "$IMAGE" "$@" fi if [ "$NO_RC" = true ]; then - set -- "$@" --no-sysinit --no-userinit + set -- --no-sysinit --no-userinit "$@" fi if [ "$VERBOSE" = false ]; then set -- --noinform "$@" -- cgit v1.2.3 From 5763cf89b4424ce9fa4c2e4dac2c2f18a29fd65a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 00:16:18 -0300 Subject: bin/cl: Allow "--" to flow to underlying Lisp command --- bin/cl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/cl b/bin/cl index ee75b9a..12de987 100755 --- a/bin/cl +++ b/bin/cl @@ -176,7 +176,11 @@ while getopts 'e:f:pM:I:nvlh' flag; do ;; esac done -shift $((OPTIND - 1)) + +shift $((OPTIND - 2)) +if [ "$1" != '--' ]; then + shift +fi PRESERVE_ARGS=false INTERACTIVE=true -- cgit v1.2.3 From 2d2ba4e9c973feea0ad0da5e6bf783bd75b3f0b7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 00:17:48 -0300 Subject: Makefile: s/ccl/clozure/ --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index dc2600a..00e89d6 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,9 @@ pod2man = \ lisp-images = \ - $(XDG_DATA_HOME)/lisp-cli/ccl.image \ - $(XDG_DATA_HOME)/lisp-cli/clisp.image \ - $(XDG_DATA_HOME)/lisp-cli/sbcl.image \ + $(XDG_DATA_HOME)/lisp-cli/clozure.image \ + $(XDG_DATA_HOME)/lisp-cli/clisp.image \ + $(XDG_DATA_HOME)/lisp-cli/sbcl.image \ derived-assets = \ $(pod2man) \ -- cgit v1.2.3 From 3f4b1c440db863452ecb3d7b3149fe35e364b5c8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 00:18:12 -0300 Subject: bin/cl: Alphabetically order Clozure code --- bin/cl | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/bin/cl b/bin/cl index 12de987..73dbb7a 100755 --- a/bin/cl +++ b/bin/cl @@ -28,9 +28,9 @@ escape_name() { IMPLEMENTATIONS=' abcl allegro -clozure clasp clisp +clozure cmucl ecl jscl @@ -240,21 +240,6 @@ case "$IMPL" in allegro) exit 4 ;; - clozure) - set -- -l "$MAIN" "$@" - if [ -n "$IMAGE" ]; then - set -- -I "$IMAGE" "$@" - fi - if [ "$NO_RC" = true ]; then - set -- -n "$@" - fi - if [ "$VERBOSE" = false ]; then - set -- -Q "$@" - else - set -x - fi - exec ccl "$@" - ;; clasp) exit 4 ;; @@ -273,6 +258,21 @@ case "$IMPL" in fi exec clisp "$@" ;; + clozure) + set -- -l "$MAIN" "$@" + if [ -n "$IMAGE" ]; then + set -- -I "$IMAGE" "$@" + fi + if [ "$NO_RC" = true ]; then + set -- -n "$@" + fi + if [ "$VERBOSE" = false ]; then + set -- -Q "$@" + else + set -x + fi + exec ccl "$@" + ;; cmucl) exit 4 ;; -- cgit v1.2.3 From cd187ea895fec86a92f1db99ba18167c343fcb2f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 00:21:30 -0300 Subject: bin/cl: Move TODOs to ~/.usr/FIXME --- bin/cl | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/bin/cl b/bin/cl index 73dbb7a..48cc8af 100755 --- a/bin/cl +++ b/bin/cl @@ -308,16 +308,3 @@ case "$IMPL" in exit 2 ;; esac - -exit - -# https://www.cliki.net/cl-launch -# buildapp -# https://github.com/memleaks/clbuild -# https://www.cliki.net/roswell -# https://github.com/shinmera/cl-all -# https://fare.livejournal.com/184127.html -# https://github.com/rolpereira/trivial-dump-core -# FIXME: enable readline from CL itself -when competing with roswell, add completion -FIXME: implement the example from help string -- cgit v1.2.3 From 6dc2f455570784e477b1c95ce27ccbae4d12fc14 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 00:56:03 -0300 Subject: etc/guix/home.scm: Name "broken" the incompatible packages --- etc/guix/home.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 529d174..1d561c4 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -446,7 +446,7 @@ python-beautifulsoup4 python-docx python-telegram-bot - ; python-docutils ; FIXME: conflicts with python-sphinx + ; python-docutils ; broken: conflicts with python-sphinx python-mkdocs valgrind flex @@ -478,7 +478,7 @@ chez-scheme racket chibi-scheme - ; chicken ; FIXME: conflicts with gcc-toolchain + ; chicken ; broken: conflicts with gcc-toolchain gambit-c gauche -- cgit v1.2.3 From 9ef0ba6009746c1370fc469ecef704044e46a6df Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 01:04:05 -0300 Subject: bin/li: Use "$(find $a -newer $b)" over [ $a -nt $b ] --- bin/li | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/li b/bin/li index e62060b..8636a07 100755 --- a/bin/li +++ b/bin/li @@ -89,7 +89,7 @@ if [ ! -e "$IMAGE" ]; then -e '(ql:quickload :trivial-dump-core)' \ -e "(trivial-dump-core:dump-image \"$IMAGE\")" \ -e '(uiop:quit)' -elif [ "$0" -nt "$IMAGE" ] || [ "$BIN" -nt "$IMAGE" ] || [ "$INIT" -nt "$IMAGE" ]; then +elif [ -n "$(find "$0" "$BIN" "$INIT" -newer "$IMAGE")" ]; then printf 'Refresh existing "%s" image...\n' "$IMPL" >&2 cl \ -M "$IMAGE" \ -- cgit v1.2.3 From dae03cc7dc2dc4078ceae308b1f483a4d2b4caf1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 09:26:48 -0300 Subject: Makefile: Refresh Lisp images on li(1) changes --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 00e89d6..552e7cc 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub: $(XDG_DATA_HOME)/euandreh/e.list.txt: ~/Documents/txt/ opt/aux/gen-e-list.sh sh opt/aux/gen-e-list.sh > $@ -$(lisp-images): $(XDG_CONFIG_HOME)/lisp-cli/init.lisp bin/cl +$(lisp-images): $(XDG_CONFIG_HOME)/lisp-cli/init.lisp bin/cl bin/li I=`echo $@ | awk -F/ '$$0=$$(NF)' | cut -d. -f1` && \ li -vI $$I -e '(uiop:quit)' -- cgit v1.2.3 From 92c500fc4685902211a82144d7a438170262fa20 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 14:07:52 -0300 Subject: etc/myrepos/config: Remove myrepos, superseded by repos(1) and vcs(1) --- etc/guix/home.scm | 4 ---- etc/myrepos/config | 1 - 2 files changed, 5 deletions(-) delete mode 120000 etc/myrepos/config diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 1d561c4..674e1ae 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -157,9 +157,6 @@ (define tmux-with-options (with-options tmux "tmux" "-f \"$XDG_CONFIG_HOME\"/tmux/tmux.conf")) -(define myrepos-with-options - (with-options myrepos "mr" "-c \"$XDG_CONFIG_HOME\"/myrepos/config")) - (define texinfo-with-options (with-options texinfo "info" "--init-file \"$XDG_CONFIG_HOME\"/info/infokey")) @@ -559,7 +556,6 @@ isync-with-options wget-with-options tmux-with-options - myrepos-with-options texinfo-with-options mpv-with-options openssh-with-options diff --git a/etc/myrepos/config b/etc/myrepos/config deleted file mode 120000 index 0f9e030..0000000 --- a/etc/myrepos/config +++ /dev/null @@ -1 +0,0 @@ -../../var/lib/private/tilde/myrepos/config \ No newline at end of file -- cgit v1.2.3 From 89c6d06099c2ffacf375cc627c3dbec1168842f2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 15:24:49 -0300 Subject: etc/guix/home.scm: Add "dig", "stunnel" and "nc" network utilities --- etc/guix/home.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 674e1ae..ae5d147 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -350,6 +350,9 @@ blueman pavucontrol ledger + bind:utils + stunnel + netcat siege curl curl:doc -- cgit v1.2.3 From dc5bceaa66aa8d8a99f7263dad60e78d2eef643a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 25 Oct 2022 19:53:54 -0300 Subject: bin/menu: Use exec over spawning new processes for "bin" action --- bin/menu | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/menu b/bin/menu index 3b031b0..c389a2f 100755 --- a/bin/menu +++ b/bin/menu @@ -116,7 +116,10 @@ case "$ACTION" in fi ;; bin) - bins | show 'bins' | sh + CHOICE="$(bins | show 'bins')" + if [ -n "$CHOICE" ]; then + exec "$CHOICE" + fi ;; clipboard) greenclip print | show 'clipboard' | copy -- cgit v1.2.3 From 0dfd2ccf8e9c5dee553ccfd88843bc724db71cbb Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 01:14:51 -0300 Subject: Remove configuration files from email programs Generate them instead with the new mailcfg(1). --- Makefile | 30 +++- bin/mailcfg | 280 +++++++++++++++++++++++++++++++++++++ etc/alot/config | 1 - etc/mailcfg | 1 + etc/mbsync/config | 1 - etc/msmtp/config | 1 - etc/notmuch/default/config | 1 - etc/notmuch/default/hooks/post-new | 1 - 8 files changed, 306 insertions(+), 10 deletions(-) create mode 100755 bin/mailcfg delete mode 120000 etc/alot/config create mode 120000 etc/mailcfg delete mode 120000 etc/mbsync/config delete mode 120000 etc/msmtp/config delete mode 120000 etc/notmuch/default/config delete mode 120000 etc/notmuch/default/hooks/post-new diff --git a/Makefile b/Makefile index 552e7cc..b94b8bf 100644 --- a/Makefile +++ b/Makefile @@ -12,14 +12,18 @@ lisp-images = \ $(XDG_DATA_HOME)/lisp-cli/sbcl.image \ derived-assets = \ - $(pod2man) \ - $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ - $(XDG_DATA_HOME)/common-lisp/source \ - $(XDG_DATA_HOME)/euandreh/e.list.txt \ + $(pod2man) \ + $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ + $(XDG_CONFIG_HOME)/alot/config \ + $(XDG_CONFIG_HOME)/mbsync/config \ + $(XDG_CONFIG_HOME)/msmtp/config \ + $(XDG_CONFIG_HOME)/notmuch/default/config \ + $(XDG_CONFIG_HOME)/notmuch/default/hooks/post-new \ + $(XDG_DATA_HOME)/common-lisp/source \ + $(XDG_DATA_HOME)/euandreh/e.list.txt \ $(lisp-images) - all: $(derived-assets) @@ -32,6 +36,22 @@ share/man/man1/z.1: bin/z $(XDG_DATA_HOME)/common-lisp/source: ln -s $(SRC)/libre $@ +$(XDG_CONFIG_HOME)/alot/config: bin/mailcfg + mailcfg alot > $@ + +$(XDG_CONFIG_HOME)/mbsync/config: bin/mailcfg + mailcfg mbsync > $@ + +$(XDG_CONFIG_HOME)/msmtp/config: bin/mailcfg + mailcfg msmtp > $@ + +$(XDG_CONFIG_HOME)/notmuch/default/config: bin/mailcfg + mailcfg notmuchcfg > $@ + +$(XDG_CONFIG_HOME)/notmuch/default/hooks/post-new: bin/mailcfg + mailcfg notmuchhook > $@ + chmod +x $@ + $(XDG_CONFIG_HOME)/ssh/id_rsa.pub: gpg --export-ssh-key eu@euandre.org > $@ chmod 600 $@ diff --git a/bin/mailcfg b/bin/mailcfg new file mode 100755 index 0000000..ea53a31 --- /dev/null +++ b/bin/mailcfg @@ -0,0 +1,280 @@ +#!/bin/sh +# shellcheck disable=1090,2153 +set -eu + +usage() { + cat <<-'EOF' + Usage: + mailcfg ACTION + mailcfg -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + ACTION one of: + - mbsync + - msmtp + - notmuchcfg + - notmuchhook + - alot + + + Emit the generated configuration file for the chosen email + program. Get the configuration files from + $XDG_CONFIG_HOME/mailcfg/*.env, where every *.env file is a + shell script that defines the variables used in this program: + - $NAME + - $LABEL + - $IMAP + - $SMTP + - $ADDR + + One of the files also needs to define: + - $DEFAULT_NAME + - $DEFAULT_ADDR + + An example of such file could be "30-andre@work.com.env": + + #!/bin/sh + set -eu + + + NAME='André!' + LABEL='Work' + IMAP='imap.work.com' + SMTP='smtp.work.com' + ADDR='andre@work.com' + + + Examples: + + Get the alot configuration file: + + $ mailcfg alot + EOF +} + + +for flag; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +ACTION="${1:-}" +eval "$(assert-arg "$ACTION" 'ACTION')" + +CFGDIR="${XDG_CONFIG_HOME:-$HOME/.config}/mailcfg" + + +mbsync() { + cat <<-'EOF' + SyncState * + Create Both + Expunge Both + Remove Both + Sync All + EOF + + for env in "$CFGDIR"/*.env; do + . "$env" + cat <<-EOF + + + ## $LABEL + + IMAPAccount $LABEL + Host $IMAP + User $ADDR + PassCmd "pass show $ADDR" + SSLType IMAPS + + IMAPStore ${LABEL}Remote + Account $LABEL + + MaildirStore ${LABEL}Local + Path ~/Maildir/$LABEL/ + Inbox ~/Maildir/$LABEL/INBOX + SubFolders Verbatim + + Channel ${LABEL}Folders + Far :${LABEL}Remote: + Near :${LABEL}Local: + Patterns * + + Group $LABEL + Channel ${LABEL}Folders + EOF + done +} + +msmtp() { + cat <<-'EOF' + defaults + auth on + tls on + port 587 + syslog on + logfile ~/.local/var/log/msmtp + EOF + + for env in "$CFGDIR"/*.env; do + . "$env" + cat <<-EOF + + account $LABEL + host $SMTP + from $ADDR + user $ADDR + passwordeval pass show $ADDR + EOF + done + + cat <<-EOF + + account default : $DEFAULT_LABEL_LC + EOF +} + +notmuchcfg() { + for env in "$CFGDIR"/*.env; do + . "$env" + done + + cat <<-EOF + [user] + name = $DEFAULT_NAME + primary_email = $DEFAULT_ADDR + EOF + + printf 'other_email = ' + for env in "$CFGDIR"/*.env; do + . "$env" + if [ "$ADDR" = "$DEFAULT_ADDR" ]; then + continue + fi + echo "$ADDR" + done | paste -sd';' + + cat <<-'EOF' + + [new] + tags = new; + ignore = .mbsyncstate;.uidvalidity + + [search] + exclude_tags = deleted;spam + + [maildir] + synchronize_flags = true + EOF +} + +notmuchhook() { + LABELS='' + for env in "$CFGDIR"/*.env; do + . "$env" + if [ -z "$LABELS" ]; then + LABELS="$LABEL" + else + LABELS="$LABELS $LABEL" + fi + done + sed "s|@DIRS@|$LABELS|g" "$CFGDIR"/post-new +} + +alot() { + cat <<-'EOF' + attachment_prefix = "~/Downloads/" + + [bindings] + i = toggletags inbox + I = search folder:/INBOX/ AND NOT tag:killed AND NOT tag:archive + EOF + echo " + z archive + s spam + u unread + r keep + t track + " | while read -r l; do + if [ -z "$l" ]; then + continue + fi + LC="$( echo "$l" | cut -d' ' -f1)" + TAG="$(echo "$l" | cut -d' ' -f2)" + UC="$(echo "$LC" | tr '[:lower:]' '[:upper:]')" + cat <<-EOF + $LC = toggletags $TAG + $UC = search tag:$TAG AND NOT tag:killed + EOF + done + + cat <<-'EOF' + M = search folder:/lists/ AND NOT tag:killed + m = compose --tags inbox + [[thread]] + v = pipeto urlscan 2>/dev/null + V = pipeto 'gpg -d | less' + r = reply --all + R = reply + ' ' = fold; untag unread; move next unfolded + P = pipeto 'git am' + + [accounts] + EOF + + for env in "$CFGDIR"/*.env; do + . "$env" + cat <<-EOF + [[$LABEL_LC]] + realname = $NAME + address = $ADDR + sendmail_command = msmtpq --account=$LABEL_LC -t + sent_box = maildir://~/Maildir/$LABEL/Sent + draft_box = maildir://~/Maildir/$LABEL/Drafts + gpg_key = 5BDAE9B8B2F6C6BCBB0D6CE581F90EC3CD356060 + EOF + done +} + + +case "$ACTION" in + mbsync|msmtp|notmuchcfg|notmuchhook|alot) + "$1" + ;; + *) + printf 'Unsupported ACTION: "%s".\n\n' "$ACTION" >&2 + usage >&2 + exit 2 + ;; +esac diff --git a/etc/alot/config b/etc/alot/config deleted file mode 120000 index 745714d..0000000 --- a/etc/alot/config +++ /dev/null @@ -1 +0,0 @@ -../../var/lib/private/tilde/alot/config \ No newline at end of file diff --git a/etc/mailcfg b/etc/mailcfg new file mode 120000 index 0000000..fe1b0d6 --- /dev/null +++ b/etc/mailcfg @@ -0,0 +1 @@ +/home/andreh/.usr/var/lib/private/tilde/mailcfg \ No newline at end of file diff --git a/etc/mbsync/config b/etc/mbsync/config deleted file mode 120000 index a447e0e..0000000 --- a/etc/mbsync/config +++ /dev/null @@ -1 +0,0 @@ -../../var/lib/private/tilde/mbsync/config \ No newline at end of file diff --git a/etc/msmtp/config b/etc/msmtp/config deleted file mode 120000 index e05c85a..0000000 --- a/etc/msmtp/config +++ /dev/null @@ -1 +0,0 @@ -../../var/lib/private/tilde/msmtp/config \ No newline at end of file diff --git a/etc/notmuch/default/config b/etc/notmuch/default/config deleted file mode 120000 index a315fdc..0000000 --- a/etc/notmuch/default/config +++ /dev/null @@ -1 +0,0 @@ -../../../var/lib/private/tilde/notmuch/default/config \ No newline at end of file diff --git a/etc/notmuch/default/hooks/post-new b/etc/notmuch/default/hooks/post-new deleted file mode 120000 index 5d96e3e..0000000 --- a/etc/notmuch/default/hooks/post-new +++ /dev/null @@ -1 +0,0 @@ -../../../../var/lib/private/tilde/notmuch/default/hooks/post-new \ No newline at end of file -- cgit v1.2.3 From 12722a87ac7f3ea40c248642b06339278a5fac85 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 18:27:50 -0300 Subject: etc/sh/root-rc: Add /root/.profile contents --- etc/sh/root-rc | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 etc/sh/root-rc diff --git a/etc/sh/root-rc b/etc/sh/root-rc new file mode 100644 index 0000000..a803b11 --- /dev/null +++ b/etc/sh/root-rc @@ -0,0 +1,83 @@ +export ENV=~/.profile + +XDG_PREFIX=~/.usr +export XDG_CACHE_HOME="$XDG_PREFIX/var/cache" +export XDG_CONFIG_HOME="$XDG_PREFIX/etc" +export XDG_DATA_HOME="$XDG_PREFIX/share" +export XDG_STATE_HOME="$XDG_PREFIX/state" +export XDG_LOG_HOME="$XDG_PREFIX/var/log" + +mkdir -p \ + "$XDG_CACHE_HOME" \ + "$XDG_CONFIG_HOME" \ + "$XDG_DATA_HOME" \ + "$XDG_STATE_HOME" \ + "$XDG_LOG_HOME" + +GUIX_PROFILE="$XDG_CONFIG_HOME"/guix/current +if [ -e "$GUIX_PROFILE"/etc/profile ]; then + . "$GUIX_PROFILE"/etc/profile +fi + +HISTSIZE=-1 +HISTFILE="$XDG_STATE_HOME"/bash-history +HISTCONTROL=ignorespace:ignoredups + +export EDITOR='vi' +export VISUAL="$EDITOR" +export PAGER='less -R' +export GUILE_HISTORY="$XDG_STATE_HOME"/guile-history +export RLWRAP_HOME="$XDG_CACHE_HOME"/rlwrap +export LESSHISTFILE="$XDG_STATE_HOME"/lesshst +export EXINIT=' + " set number + set autoindent + set ruler + set showmode + set showmatch +' + +alias l='ls -lahF --color=auto' +alias grep='grep --color=auto' +alias diff='diff --color' +alias less='less -R' +alias mv='mv -i' +alias rm='rm -i' +alias r='reload' + +reload() { + . ~/.profile +} + + + +# +# PS1 +# + +error_marker() { + STATUS=$? + if [ "$STATUS" != 0 ]; then + printf ' (!! %s !!) ' "$STATUS" + fi +} + +shell_level() { + if [ -n "${TMUX:-}" ]; then + LVL=$((SHLVL - 1)) + else + LVL="$SHLVL" + fi + if [ "$LVL" != 1 ]; then + printf '[%s] ' "$LVL" + fi +} + +guix_env() { + if [ -n "${GUIX_ENVIRONMENT:-}" ]; then + printf '\n~> guix environment (%s)' "$GUIX_ENVIRONMENT" + fi +} + +PS1='`error_marker`\T \w/ `shell_level``guix_env` +# ' -- cgit v1.2.3 From ca071914122238cece5e365e6363d75aba264b9a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 18:28:43 -0300 Subject: bin/repos: Fix guessing of repository type for Fossil --- bin/repos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/repos b/bin/repos index 27e0879..12fd697 100755 --- a/bin/repos +++ b/bin/repos @@ -144,7 +144,7 @@ is_repository() { elif [ -e "$1"/CVS/ ]; then printf 'cvs:%s\n' "$1" return 0 - elif [ -e "$1"/"$(basename "$1")".fossil ]; then + elif [ -e "$1"/.fslckout ]; then printf 'fossil:%s\n' "$1" return 0 fi -- cgit v1.2.3 From c406b6eb547c41a57e38bd2cdc795a53f044db22 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 18:29:13 -0300 Subject: etc/sh/rc: Use "bc -l" by default with an alias --- etc/sh/rc | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/sh/rc b/etc/sh/rc index efd01e8..3c38de9 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -131,6 +131,7 @@ alias tree='tree -aC' alias make='make -e' alias mv='mv -i' alias vi='echo "Use \"e\" instead."; false' +alias bc='bc -l' alias sqlite='rlwrap sqlite3' alias guile='guile -l "$XDG_CONFIG_HOME"/guile/init.scm' -- cgit v1.2.3 From c886861320082338548a09bed954f706cb1a0d0b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 22:47:58 -0300 Subject: etc/guix/system.scm: Disable unattended-upgrade-service-type This was replaced by the cronjob in Guix Home. --- etc/guix/system.scm | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index b625d7f..ddd961a 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -69,7 +69,6 @@ (service pcscd-service-type) (service libvirt-service-type) (service virtlog-service-type) - (service unattended-upgrade-service-type) (service nix-service-type) (service qemu-binfmt-service-type (qemu-binfmt-configuration -- cgit v1.2.3 From 3dfc6e121147e36eb37181c7bcc9d256533e61f5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 22:49:25 -0300 Subject: etc/guix/system.scm: Disable nix-service-type This was replaced by vm(1), and the soon to exist NixOS VM, instead of trying to do thins in Nix-on-top-of-Guix. --- etc/guix/system.scm | 2 -- 1 file changed, 2 deletions(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index ddd961a..9b733ad 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -9,7 +9,6 @@ (gnu services base) (gnu services cups) (gnu services desktop) - (gnu services nix) (gnu services security-token) (gnu services sound) (gnu services virtualization) @@ -69,7 +68,6 @@ (service pcscd-service-type) (service libvirt-service-type) (service virtlog-service-type) - (service nix-service-type) (service qemu-binfmt-service-type (qemu-binfmt-configuration (platforms -- cgit v1.2.3 From fe60755c7d599310c3177643037f61fda9851337 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 22:50:59 -0300 Subject: etc/guix/system.scm: Include driver for EPSON L365 in CUPS service --- etc/guix/system.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 9b733ad..aea343a 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -22,7 +22,8 @@ (guix utils) (nongnu packages linux) (nongnu system linux-initrd) - (srfi srfi-1)) + (srfi srfi-1) + (xyz euandreh queue)) (heredoc:enable-syntax) (operating-system @@ -74,7 +75,9 @@ (lookup-qemu-platforms "arm" "aarch64")))) (service cups-service-type (cups-configuration - (web-interface? #t))) + (web-interface? #t) + (extensions + (list epson-L365)))) #; (udev-rules-service 'backlight -- cgit v1.2.3 From bb827c25218e306106cb48596e9eef618fd55d14 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 22:51:15 -0300 Subject: etc/guix/system.scm: Remove unused imports --- etc/guix/system.scm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index aea343a..6758522 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -1,11 +1,8 @@ (use-modules ((xyz euandreh heredoc) #:prefix heredoc:) - (ice-9 rdelim) (gnu bootloader) (gnu bootloader grub) (gnu packages) - (gnu packages wm) - (gnu services admin) (gnu services base) (gnu services cups) (gnu services desktop) @@ -19,7 +16,6 @@ (gnu system mapped-devices) (guix gexp) (guix packages) - (guix utils) (nongnu packages linux) (nongnu system linux-initrd) (srfi srfi-1) -- cgit v1.2.3 From 695c133eadc6dbfa85f43e8a14bbb4dbf6ae2638 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 22:51:48 -0300 Subject: bin/repos: Add documentation for -e option in help string --- bin/repos | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/repos b/bin/repos index 12fd697..2d95410 100755 --- a/bin/repos +++ b/bin/repos @@ -5,7 +5,7 @@ set -eu usage() { cat <<-'EOF' Usage: - repos [-v] [DIRECTORY] + repos [-e DIR...] [-v] [DIRECTORY] repos -h EOF } @@ -15,6 +15,7 @@ help() { Options: + -e DIR exclude the given directory from traversing -v enable verbose mode -h, --help show this message -- cgit v1.2.3 From da5c2c6486850e7319ff2fca0c876ab86e42ed3a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 22:52:29 -0300 Subject: bin/repos: Add explicit note on intentionally commented code --- bin/repos | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/repos b/bin/repos index 2d95410..1e764ca 100755 --- a/bin/repos +++ b/bin/repos @@ -67,6 +67,7 @@ array_decode() { # +# CAVEAT: # To avoid needing to keep decoding the array elements on every call to # `arr_includes`, assume directory names don't contain newlines. This makes the # current code scanning ~/dev/ from 8 seconds go to 1 second. @@ -78,14 +79,14 @@ arr_push() { if [ -n "$ARR" ]; then echo "$ARR" fi - echo "$ELT" # | array_encode + echo "$ELT" # | array_encode (see CAVEAT) } arr_includes() { ARR="$1" ELT="$2" echo "$ARR" | while read -r el; do - # if [ "$(printf '%s\n' "$el" | array_decode)" = "$ELT" ]; then + # if [ "$(printf '%s\n' "$el" | array_decode)" = "$ELT" ]; then (see CAVEAT) if [ "$el" = "$ELT" ]; then return 2 fi -- cgit v1.2.3 From be97a9ef4d4205bed7b9687129d32f1009a6da6c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 22:54:01 -0300 Subject: bin/vcs: Do not require TYPE, and guess it instead --- bin/vcs | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 188 insertions(+), 37 deletions(-) diff --git a/bin/vcs b/bin/vcs index 800574d..405100a 100755 --- a/bin/vcs +++ b/bin/vcs @@ -2,10 +2,162 @@ set -eu +TYPES=' +git +mercurial +bitkeeper +darcs +cvs +fossil +' + + +guess_type() { + if [ -e "$1"/.git ]; then + echo git + elif [ -e "$1"/.hg ]; then + echo mercurial + elif [ -e "$1"/.bk ]; then + echo bitkeeper + elif [ -e "$1"/_darcs ]; then + echo darcs + elif [ -e "$1"/CVS/ ]; then + echo cvs + elif [ -e "$1"/.fslckout ]; then + echo fossil + else + return 1 + fi +} + + + + +git_fetch() { + git fetch "$@" +} + +darcs_fetch() { + darcs fetch "$@" +} + +mercurial_fetch() { + hg pull "$@" +} + +fossil_fetch() { + fossil pull "$@" +} + +cvs_fetch() { + timeout 300 cvs update "$@" +} + +git_status() { + git status "$@" +} + +git_diff() { + git diff "$@" +} + +git_ps1() { + BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" + OUT="$(git status --short --branch --porcelain)" + BRANCH_LINE="$(echo "$OUT" | head -n 1)" + DIFF_LINES="$(echo "$OUT" | tail -n +2)" + + IS_AHEAD=false + IS_BEHIND=false + if echo "$BRANCH_LINE" | grep -q 'ahead'; then + IS_AHEAD=true + fi + if echo "$BRANCH_LINE" | grep -q 'behind'; then + IS_BEHIND=true + fi + + LINE='' + + if [ "$IS_AHEAD" = true ] && [ "$IS_BEHIND" = true ]; then + LINE="^^^ $BRANCH_NAME vvv" + elif [ "$IS_AHEAD" = true ]; then + LINE="^ $BRANCH_NAME ^" + elif [ "$IS_BEHIND" = true ]; then + LINE="v $BRANCH_NAME v" + else + LINE="$BRANCH_NAME" + fi + + HAS_DIFF=false + HAS_UNTRACKED=false + if echo "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then + HAS_DIFF=true + fi + if echo "$DIFF_LINES" | grep -q '^[?][?]'; then + HAS_UNTRACKED=true + fi + + if [ "$HAS_DIFF" = true ]; then + COLOR_FN=redb + LINE="{$LINE}" + elif [ "$IS_AHEAD" = true ] || [ "$IS_BEHIND" = true ]; then + COLOR_FN=bluei + LINE="[$LINE]" + elif [ "$HAS_UNTRACKED" = true ]; then + COLOR_FN=lightblue + LINE="{$LINE}" + else + COLOR_FN=green + LINE="($LINE)" + fi + + color -c "$COLOR_FN" "$LINE" + + BRANCH_COUNT="$(git branch --list | wc -l)" + if [ "$BRANCH_COUNT" -gt 1 ]; then + color -c lightblue "<$BRANCH_COUNT>" + fi + + STASH_COUNT="$(git stash list | wc -l)" + if [ "$STASH_COUNT" != 0 ]; then + color -c red "*$STASH_COUNT" + fi + + color -c blacki " - git/$(git rev-parse HEAD)" +} + +fossil_ps1() { + BRANCH_NAME="$(fossil branch current)" + + if [ -n "$(fossil extras)" ]; then + HAS_UNTRACKED=1 + fi + + BRANCH_MARKER="$BRANCH_NAME" + + if [ -n "${HAS_UNTRACKED:-}" ]; then + COLOR_FN=lightblue + LINE="($BRANCH_MARKER)" + else + COLOR_FN=green + LINE="($BRANCH_MARKER)" + fi + + color -c "$COLOR_FN" "$LINE" + + color -c blacki " - fossil/$(fossil info | awk '/^checkout:/ { print $2 }')" +} + +mercurial_ps1() { + BRANCH_NAME="$(hg branch)" +} + + usage() { cat <<-'EOF' Usage: - vcs TYPE ACTION + vcs [-C DIR] ACTION + vcs [-C DIR] -l|-t vcs -h EOF } @@ -15,16 +167,14 @@ help() { Options: + -C DIR change to DIR instead of PWD + -l list the supported VCS types + -t show the guesses VCS type -h, --help show this message - TYPE the type of the underlying VCS: - - git - - darcs - - mercurial - - fossil - - cvs ACTION the action to be performed on the repository: - fetch + - ps1 EOF } @@ -44,8 +194,23 @@ for flag in "$@"; do esac done -while getopts 'h' flag; do +while getopts 'C:lth' flag; do case "$flag" in + C) + cd "$OPTARG" + ;; + l) + + echo $TYPES | tr ' ' '\n' + exit + ;; + t) + guess_type "$PWD" || { + printf 'Could not guess the type of the repository.\n' >&2 + exit 2 + } + exit + ;; h) usage help @@ -58,39 +223,25 @@ while getopts 'h' flag; do done shift $((OPTIND - 1)) - -git_fetch() { - git fetch -} - -darcs_fetch() { - darcs fetch -} - -mercurial_fetch() { - hg pull -} - -fossil_fetch() { - fossil pull -} - -cvs_fetch() { - timeout 300 cvs update -} - - -VCS="${1:-}" -ACTION="${2:-}" - -eval "$(assert-arg "$VCS" 'VCS')" +ACTION="${1:-}" eval "$(assert-arg "$ACTION" 'ACTION')" +shift +if [ "${1:-}" = '--' ]; then + shift +fi + +TYPE="$(guess_type "$PWD")" +if [ -z "$TYPE" ]; then + printf 'Could not guess the type of the repository.\n' >&2 + exit 2 +fi -CMD="$VCS"_"$ACTION" +CMD="$TYPE"_"$ACTION" if ! command -v "$CMD" >/dev/null; then - printf 'Invalid VCS/action combination: %s %s.\n' "$VCS" "$ACTION" >&2 + printf 'Invalid ACTION: "%s".\n\n' "$ACTION" >&2 + usage >&2 exit 2 fi -"$CMD" +"$CMD" "$@" -- cgit v1.2.3 From 8af3b16bb72b192b5a5bb2138447ec8893d1ff53 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 22:54:34 -0300 Subject: bin/repos: Simplify, using the new vcs(1) --- bin/repos | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/bin/repos b/bin/repos index 1e764ca..32fe1cd 100755 --- a/bin/repos +++ b/bin/repos @@ -131,26 +131,13 @@ shift $((OPTIND - 1)) is_repository() { - if [ -e "$1"/.git ]; then - printf 'git:%s\n' "$1" - return 0 - elif [ -e "$1"/.hg ]; then - printf 'mercurial:%s\n' "$1" - return 0 - elif [ -e "$1"/.bk ]; then - printf 'bitkeeper:%s\n' "$1" - return 0 - elif [ -e "$1"/_darcs ]; then - printf 'darcs:%s\n' "$1" - return 0 - elif [ -e "$1"/CVS/ ]; then - printf 'cvs:%s\n' "$1" - return 0 - elif [ -e "$1"/.fslckout ]; then - printf 'fossil:%s\n' "$1" + TYPE="$(vcs -C "$1" -t)" + if [ -n "$TYPE" ]; then + printf '%s:%s\n' "$TYPE" "$1" return 0 + else + return 1 fi - return 1 } -- cgit v1.2.3 From ee4f968985fbd80597cebdb5036cc1176a17383a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 22:55:20 -0300 Subject: etc/sh/rc: Refactor "s", "d" and "ds" aliases using the new vcs(1) --- etc/sh/rc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/sh/rc b/etc/sh/rc index 3c38de9..abb3994 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -116,9 +116,9 @@ alias p='ping euandre.org -c 3' alias c='tmux send-keys -R \; clear-history' alias o='open' alias mm='msmtp-queue -r' -alias s='vcs_status' -alias d='vcs_diff' -alias ds='vcs_diff_staged' +alias s='vcs status' +alias d='vcs diff' +alias ds='vcs diff -- --staged' alias tpd='cd "$(mkdtemp)"' alias l='ls -lahF --color' -- cgit v1.2.3 From 19b4f463e1c2cfbc328f0029432751a1804466b5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 22:56:23 -0300 Subject: etc/sh/vcs-ps1.sh: Simplify, using vcs(1) --- etc/sh/vcs-ps1.sh | 100 +----------------------------------------------------- 1 file changed, 1 insertion(+), 99 deletions(-) diff --git a/etc/sh/vcs-ps1.sh b/etc/sh/vcs-ps1.sh index 72df2c4..e12c042 100644 --- a/etc/sh/vcs-ps1.sh +++ b/etc/sh/vcs-ps1.sh @@ -1,105 +1,7 @@ #!/bin/sh -repo_status_git() { - BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" - OUT="$(git status --short --branch --porcelain)" - BRANCH_LINE="$(echo "$OUT" | head -n 1)" - DIFF_LINES="$(echo "$OUT" | tail -n +2)" - - IS_AHEAD=false - IS_BEHIND=false - if echo "$BRANCH_LINE" | grep -q 'ahead'; then - IS_AHEAD=true - fi - if echo "$BRANCH_LINE" | grep -q 'behind'; then - IS_BEHIND=true - fi - - LINE='' - - if [ "$IS_AHEAD" = true ] && [ "$IS_BEHIND" = true ]; then - LINE="^^^ $BRANCH_NAME vvv" - elif [ "$IS_AHEAD" = true ]; then - LINE="^ $BRANCH_NAME ^" - elif [ "$IS_BEHIND" = true ]; then - LINE="v $BRANCH_NAME v" - else - LINE="$BRANCH_NAME" - fi - - HAS_DIFF=false - HAS_UNTRACKED=false - if echo "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then - HAS_DIFF=true - fi - if echo "$DIFF_LINES" | grep -q '^[?][?]'; then - HAS_UNTRACKED=true - fi - - if [ "$HAS_DIFF" = true ]; then - COLOR_FN=redb - LINE="{$LINE}" - elif [ "$IS_AHEAD" = true ] || [ "$IS_BEHIND" = true ]; then - COLOR_FN=bluei - LINE="[$LINE]" - elif [ "$HAS_UNTRACKED" = true ]; then - COLOR_FN=lightblue - LINE="{$LINE}" - else - COLOR_FN=green - LINE="($LINE)" - fi - - color -c "$COLOR_FN" "$LINE" - - BRANCH_COUNT="$(git branch --list | wc -l)" - if [ "$BRANCH_COUNT" -gt 1 ]; then - color -c lightblue "<$BRANCH_COUNT>" - fi - - STASH_COUNT="$(git stash list | wc -l)" - if [ "$STASH_COUNT" != 0 ]; then - color -c red "*$STASH_COUNT" - fi - - color -c blacki " - git/$(git rev-parse HEAD)" -} - -repo_status_fossil() { - BRANCH_NAME="$(fossil branch current)" - - if [ -n "$(fossil extras)" ]; then - HAS_UNTRACKED=1 - fi - - BRANCH_MARKER="$BRANCH_NAME" - - if [ -n "${HAS_UNTRACKED:-}" ]; then - COLOR_FN=lightblue - LINE="($BRANCH_MARKER)" - else - COLOR_FN=green - LINE="($BRANCH_MARKER)" - fi - - color -c "$COLOR_FN" "$LINE" - - color -c blacki " - fossil/$(fossil info | awk '/^checkout:/ { print $2 }')" -} - -repo_status_mercurial() { - BRANCH_NAME="$(hg branch)" -} - repo_status() { - dir="$(basename "$PWD")" - if [ -d .git ]; then - repo_status_git - elif [ -f "$dir.fossil" ]; then - repo_status_fossil - elif [ -d .hg ]; then - repo_status_mercurial - fi + vcs ps1 } -- cgit v1.2.3 From ba88987f4debb5dc9259b45557a2f324b9452001 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 22:58:15 -0300 Subject: etc/sh/vcs-ps1.sh: Inline $PS1 in etc/sh/rc --- etc/sh/rc | 87 +++++++++++++++++++++++++++++++++++++++++++++- etc/sh/vcs-ps1.sh | 102 ------------------------------------------------------ 2 files changed, 86 insertions(+), 103 deletions(-) delete mode 100644 etc/sh/vcs-ps1.sh diff --git a/etc/sh/rc b/etc/sh/rc index abb3994..7bde008 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -144,7 +144,92 @@ alias flush='sync && echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null' # PS1 # -. "$XDG_CONFIG_HOME"/sh/vcs-ps1.sh +repo_status() { + vcs ps1 +} + +error_marker() { + STATUS=$? + if [ "$STATUS" != 0 ]; then + color -c redb " (!! $STATUS !!) " + fi +} + +shell_status_level() { + if [ -n "${SHLVL:-}" ]; then + if [ -n "${TMUX:-}" ]; then + LVL=$((SHLVL - 1)) + else + LVL="$SHLVL" + fi + if [ "$LVL" != 1 ]; then + color -c white "$LVL" + if [ -n "${RANGER_LEVEL:-}" ]; then + color -c white '|' + color -c bluei 'r' + fi + fi + fi +} + +shell_status_jobs() { + JOBS="$(jobs | grep -cv autojump)" + if [ "$JOBS" != 0 ]; then + color -c red "$JOBS" + fi +} + +shell_status() { + LEVEL="$(shell_status_level)" + JOBS="$(shell_status_jobs)" + + if [ -z "$LEVEL" ] && [ -z "$JOBS" ]; then + return + fi + + color -c white '[' + printf '%s' "$LEVEL" + if [ -n "$LEVEL" ] && [ -n "$JOBS" ]; then + color -c white '|' + fi + printf '%s' "$JOBS" + color -c white ']' + printf ' ' +} + +timestamp() { + color -c blacki '\T' +} + +path() { + color -c yellowb '\w/' +} + +guix_env() { + if [ -n "${GUIX_ENVIRONMENT:-}" ]; then + printf '\n' + color -c blacki '~> ' + color -c purple 'guix environment ' + printf '(' + color -c blueb "$GUIX_ENVIRONMENT" + printf ')' + fi +} + +in_nix_shell() { + if [ -n "${IN_NIX_SHELL:-}" ]; then + printf '\n' + color -c blacki '~> ' + color -c purpleb "$IN_NIX_SHELL " + color -c purple 'nix-shell ' + printf '(' + color -c blueb "${name:-}" + printf ')' + fi +} + +PS1='`error_marker`'$(timestamp)' '$(path)' `shell_status``repo_status``guix_env``in_nix_shell` +$ ' diff --git a/etc/sh/vcs-ps1.sh b/etc/sh/vcs-ps1.sh deleted file mode 100644 index e12c042..0000000 --- a/etc/sh/vcs-ps1.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh - -repo_status() { - vcs ps1 -} - - -error_marker() { - STATUS=$? - if [ "$STATUS" != 0 ]; then - color -c redb " (!! $STATUS !!) " - fi -} - -shell_status_level() { - if [ -n "${SHLVL:-}" ]; then - if [ -n "${TMUX:-}" ]; then - LVL=$((SHLVL - 1)) - else - LVL="$SHLVL" - fi - if [ "$LVL" != 1 ]; then - color -c white "$LVL" - if [ -n "${RANGER_LEVEL:-}" ]; then - color -c white '|' - color -c bluei 'r' - fi - fi - fi -} - -shell_status_jobs() { - JOBS="$(jobs | grep -cv autojump)" - if [ "$JOBS" != 0 ]; then - color -c red "$JOBS" - fi -} - -shell_status() { - LEVEL="$(shell_status_level)" - JOBS="$(shell_status_jobs)" - - if [ -z "$LEVEL" ] && [ -z "$JOBS" ]; then - return - fi - - color -c white '[' - printf '%s' "$LEVEL" - if [ -n "$LEVEL" ] && [ -n "$JOBS" ]; then - color -c white '|' - fi - printf '%s' "$JOBS" - color -c white ']' - printf ' ' -} - -timestamp() { - color -c blacki '\T' -} - -path() { - color -c yellowb '\w/' -} - -guix_env() { - if [ -n "${GUIX_ENVIRONMENT:-}" ]; then - printf '\n' - color -c blacki '~> ' - color -c purple 'guix environment ' - printf '(' - color -c blueb "$GUIX_ENVIRONMENT" - printf ')' - fi -} - -in_nix_shell() { - if [ -n "${IN_NIX_SHELL:-}" ]; then - printf '\n' - color -c blacki '~> ' - color -c purpleb "$IN_NIX_SHELL " - color -c purple 'nix-shell ' - printf '(' - color -c blueb "${name:-}" - printf ')' - fi -} - -PS1='`error_marker`'$(timestamp)' '$(path)' `shell_status``repo_status``guix_env``in_nix_shell` -$ ' - - -vcs_status() { - git status "$@" -} - -vcs_diff() { - git diff "$@" -} - -vcs_diff_staged() { - git diff --staged "$@" -} -- cgit v1.2.3 From 18571a50b7a3eebb1f40fa226e16d40f3a7823c8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 23:01:06 -0300 Subject: bin/vcs: Explicitly disable ShellCheck 2086 --- bin/vcs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/vcs b/bin/vcs index 405100a..8691575 100755 --- a/bin/vcs +++ b/bin/vcs @@ -200,7 +200,7 @@ while getopts 'C:lth' flag; do cd "$OPTARG" ;; l) - + # shellcheck disable=2086 echo $TYPES | tr ' ' '\n' exit ;; -- cgit v1.2.3 From ef3f1f6c46a13ae650ae9265055a0e63ed9c408a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 27 Oct 2022 23:01:58 -0300 Subject: etc/mailcfg: Remove the committed symlink The folder existing the real life is enough, no need to commit the symlink for any reason. --- etc/mailcfg | 1 - 1 file changed, 1 deletion(-) delete mode 120000 etc/mailcfg diff --git a/etc/mailcfg b/etc/mailcfg deleted file mode 120000 index fe1b0d6..0000000 --- a/etc/mailcfg +++ /dev/null @@ -1 +0,0 @@ -/home/andreh/.usr/var/lib/private/tilde/mailcfg \ No newline at end of file -- cgit v1.2.3 From 383021cf31f61220f758d1d628945d549e471c92 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 09:21:51 -0300 Subject: bin/vcs: Add fossil_status() --- bin/vcs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/vcs b/bin/vcs index 8691575..90a24c3 100755 --- a/bin/vcs +++ b/bin/vcs @@ -57,6 +57,10 @@ git_status() { git status "$@" } +fossil_status() { + fossil status "$@" +} + git_diff() { git diff "$@" } -- cgit v1.2.3 From e23b70f1bad64720cc6905bc8358b18b6c09712d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 11:08:28 -0300 Subject: bin/repos: Omit warning on not guessing the type of repository --- bin/repos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/repos b/bin/repos index 32fe1cd..bf5c8c7 100755 --- a/bin/repos +++ b/bin/repos @@ -131,7 +131,7 @@ shift $((OPTIND - 1)) is_repository() { - TYPE="$(vcs -C "$1" -t)" + TYPE="$(vcs -C "$1" -t 2>/dev/null)" if [ -n "$TYPE" ]; then printf '%s:%s\n' "$TYPE" "$1" return 0 -- cgit v1.2.3 From a260727ed61f9d000e290573eb3d2e6a23ae8190 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 11:08:51 -0300 Subject: bin/repos: Only print the repository name, not its type --- bin/repos | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/repos b/bin/repos index bf5c8c7..e45f4c8 100755 --- a/bin/repos +++ b/bin/repos @@ -133,8 +133,7 @@ shift $((OPTIND - 1)) is_repository() { TYPE="$(vcs -C "$1" -t 2>/dev/null)" if [ -n "$TYPE" ]; then - printf '%s:%s\n' "$TYPE" "$1" - return 0 + echo "$1" else return 1 fi -- cgit v1.2.3 From 802cbbd057d2f0ee03aa3332f130208fcb8a20ce Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 11:09:11 -0300 Subject: bin/update: Replace while block with xargs --- bin/update | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bin/update b/bin/update index 2c7bba8..97bf50b 100755 --- a/bin/update +++ b/bin/update @@ -77,9 +77,4 @@ rfc -u newsboat -x reload repos -e ~/dev/go/ -e ~/dev/quicklisp/ -e ~/dev/archive/ ~/dev/ | - while read -r line; do - TYPE="$(echo "$line" | cut -d: -f1)" - DIR="$( echo "$line" | cut -d: -f2-)" - cd "$DIR" - vcs "$TYPE" fetch || printf 'WARNING: Failed to fetch repository: %s.\n' "$DIR" >&2 - done + xargs -I% x vcs -C% fetch OR echo 'WARNING: Failed to fetch repository: %.' >&2 -- cgit v1.2.3 From 9a791ec26ba920965502372308fed166227802f3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 11:16:05 -0300 Subject: bin/update: Run vcs fetch in parallel (4) --- bin/update | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/update b/bin/update index 97bf50b..0d095c1 100755 --- a/bin/update +++ b/bin/update @@ -77,4 +77,5 @@ rfc -u newsboat -x reload repos -e ~/dev/go/ -e ~/dev/quicklisp/ -e ~/dev/archive/ ~/dev/ | - xargs -I% x vcs -C% fetch OR echo 'WARNING: Failed to fetch repository: %.' >&2 + xargs -I% -P4 x \ + vcs -C% fetch OR echo 'WARNING: Failed to fetch repository: %.' >&2 -- cgit v1.2.3 From c0046808aca89e6237fee7768413abaf519a00f3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 11:17:57 -0300 Subject: bin/update: Try to make the execution line of the vcs fetch more readable --- bin/update | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/update b/bin/update index 0d095c1..87b1089 100755 --- a/bin/update +++ b/bin/update @@ -76,6 +76,9 @@ wait rfc -u newsboat -x reload +warn() { + echo "WARNING: Failed to fetch repository: $1." >&2 +} + repos -e ~/dev/go/ -e ~/dev/quicklisp/ -e ~/dev/archive/ ~/dev/ | - xargs -I% -P4 x \ - vcs -C% fetch OR echo 'WARNING: Failed to fetch repository: %.' >&2 + xargs -I% -P4 x vcs -C% fetch OR warn % -- cgit v1.2.3 From 44aaa035beccaebdfe8c16005c63abece2ce7fb1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 15:04:12 -0300 Subject: etc/guix/home.scm: Add "vdirsyncer" package --- etc/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index ae5d147..e2d143b 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -366,6 +366,7 @@ borg khal khard + vdirsyncer libfaketime qrencode feh -- cgit v1.2.3 From f9997545f9aca13dad128eb5506dd19e020f934d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 15:06:43 -0300 Subject: Revert "bin/update: Try to make the execution line of the vcs fetch more readable" This reverts commit c0046808aca89e6237fee7768413abaf519a00f3. The x(1) command doesn't find the warn() function: Can't exec "warn": Aucun fichier ou dossier de ce type at /home/andreh/.usr/bin/x line 107. --- bin/update | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bin/update b/bin/update index 87b1089..0d095c1 100755 --- a/bin/update +++ b/bin/update @@ -76,9 +76,6 @@ wait rfc -u newsboat -x reload -warn() { - echo "WARNING: Failed to fetch repository: $1." >&2 -} - repos -e ~/dev/go/ -e ~/dev/quicklisp/ -e ~/dev/archive/ ~/dev/ | - xargs -I% -P4 x vcs -C% fetch OR warn % + xargs -I% -P4 x \ + vcs -C% fetch OR echo 'WARNING: Failed to fetch repository: %.' >&2 -- cgit v1.2.3 From 893986594ecba72c23339a13106e740566335144 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 16:58:58 -0300 Subject: Inline now working configs for khard and khal --- etc/khal/config | 17 ++++++++++++++++- etc/khard/khard.conf | 14 +++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) mode change 120000 => 100644 etc/khal/config mode change 120000 => 100644 etc/khard/khard.conf diff --git a/etc/khal/config b/etc/khal/config deleted file mode 120000 index f0e4012..0000000 --- a/etc/khal/config +++ /dev/null @@ -1 +0,0 @@ -../../var/lib/private/tilde/khal/config \ No newline at end of file diff --git a/etc/khal/config b/etc/khal/config new file mode 100644 index 0000000..f42a87b --- /dev/null +++ b/etc/khal/config @@ -0,0 +1,16 @@ +[calendars] + +[[private]] +path = $XDG_DATA_HOME/khal/calendars/private/ +type = calendar + +[locale] +timeformat = %H:%M +dateformat = %d/%m/%Y +longdateformat = %d/%m/%Y +datetimeformat = %d/%m/%Y %H:%M +longdatetimeformat = %d/%m/%Y %H:%M +default_timezone = America/Sao_Paulo + +[default] +default_calendar = private diff --git a/etc/khard/khard.conf b/etc/khard/khard.conf deleted file mode 120000 index 56c4c53..0000000 --- a/etc/khard/khard.conf +++ /dev/null @@ -1 +0,0 @@ -../../var/lib/private/tilde/khard/khard.conf \ No newline at end of file diff --git a/etc/khard/khard.conf b/etc/khard/khard.conf new file mode 100644 index 0000000..e6ef986 --- /dev/null +++ b/etc/khard/khard.conf @@ -0,0 +1,13 @@ +[addressbooks] + +[[private]] +path = $XDG_DATA_HOME/khard/contacts/private/ + +[general] +default_action = list + +[contact table] +show_nicknames = yes + +[vcard] +preferred_version = 4.0 -- cgit v1.2.3 From 5c1e2ad18723265c3afbaf9514eea2990d26602c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 17:18:22 -0300 Subject: etc/sh/rc: Add alias for khal --- etc/sh/rc | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/sh/rc b/etc/sh/rc index 7bde008..8afd8df 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -137,6 +137,7 @@ alias sqlite='rlwrap sqlite3' alias guile='guile -l "$XDG_CONFIG_HOME"/guile/init.scm' alias flush='sync && echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null' +alias kal='khal calendar today `LANG=en.UTF-8 date +%A`' -- cgit v1.2.3 From 7af09826ab44f3ad32663526e0b1e88582fb006c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 17:22:11 -0300 Subject: Revert "etc/guix/home.scm: Add "vdirsyncer" package" This reverts commit 44aaa035beccaebdfe8c16005c63abece2ce7fb1. I won't be using vdirsyncer. Google is hostile enough to exposing data via CardDAV and CalDAV that I couldn't make it work, and I don't think I will. --- etc/guix/home.scm | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index e2d143b..ae5d147 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -366,7 +366,6 @@ borg khal khard - vdirsyncer libfaketime qrencode feh -- cgit v1.2.3 From 25e766c6f761df2606672381c618c330f73a1677 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 17:53:51 -0300 Subject: bin/update: Log individual repositories being fetched To make it easier to differentiate no updates existing from being stuck. --- bin/update | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/update b/bin/update index 0d095c1..11ac73d 100755 --- a/bin/update +++ b/bin/update @@ -78,4 +78,6 @@ newsboat -x reload repos -e ~/dev/go/ -e ~/dev/quicklisp/ -e ~/dev/archive/ ~/dev/ | xargs -I% -P4 x \ - vcs -C% fetch OR echo 'WARNING: Failed to fetch repository: %.' >&2 + echo 'Fetching on %.' AND \ + vcs -C% fetch OR \ + echo 'WARNING: Failed to fetch repository: %.' >&2 -- cgit v1.2.3 From 985c0a1c81447f42a75b629109e0fa27a66291e3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 19:29:42 -0300 Subject: bin/vcs: Add initial git_gc() implementation Effect: prune remote branches. --- bin/vcs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/vcs b/bin/vcs index 90a24c3..33bae3c 100755 --- a/bin/vcs +++ b/bin/vcs @@ -156,6 +156,10 @@ mercurial_ps1() { BRANCH_NAME="$(hg branch)" } +git_gc() { + git remote prune origin "$@" +} + usage() { cat <<-'EOF' -- cgit v1.2.3 From 6f35eb1d26922dff508fe07103b7c0cd90e80a83 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 20:05:24 -0300 Subject: bin/gc: Add gc_vcs() step --- bin/gc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/gc b/bin/gc index 1570f84..e09ef13 100755 --- a/bin/gc +++ b/bin/gc @@ -100,6 +100,11 @@ gc_email() { xargs -I{} rm -vf "{}" } +gc_vcs() { + repos -e ~/dev/go/ -e ~/dev/quicklisp/ -e ~/dev/archive/ ~/dev/ | + xargs -I% -P4 x vcs -C% gc OR true +} + BEFORE="$(disk)" set -x @@ -109,6 +114,7 @@ gc_trash gc_tmpdir gc_docker gc_email +gc_vcs wait set +x AFTER="$(disk)" -- cgit v1.2.3 From 491fe0987f73149236d50e64a4ee8a6f1ec2b5ed Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Oct 2022 20:46:20 -0300 Subject: bin/gc: Support TYPE argument --- bin/gc | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/bin/gc b/bin/gc index e09ef13..7502e76 100755 --- a/bin/gc +++ b/bin/gc @@ -4,7 +4,7 @@ set -eu usage() { cat <<-'EOF' Usage: - gc + gc [TYPE] gc -h EOF } @@ -15,15 +15,29 @@ help() { Options: -h, --help show this message + TYPE what to do GC on (default: all): + - guix + - nohup + - trash + - tmpdir + - docker + - email + - vcs + Free disk space system-wide. Examples: - Just run it: + Just run it, for all: $ gc + + + Cleanup tmpdir: + + $ gc tmpdir EOF } @@ -106,17 +120,29 @@ gc_vcs() { } +gc_all() { + set -x + gc_guix + gc_nohup + gc_trash + gc_tmpdir + gc_docker + gc_email + gc_vcs + set +x +} + +TYPE="${1:-all}" +CMD=gc_"$TYPE" +if ! command -v "$CMD" >/dev/null; then + printf 'Invalid TYPE: "%s".\n\n' "$TYPE" >&2 + usage >&2 + exit 2 +fi + + BEFORE="$(disk)" -set -x -gc_guix -gc_nohup -gc_trash -gc_tmpdir -gc_docker -gc_email -gc_vcs -wait -set +x +"$CMD" AFTER="$(disk)" printf 'Disk space:\n' -- cgit v1.2.3 From d6e6c96df182bf0142bee4080ac0dc9750c2d68b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 29 Oct 2022 14:55:04 -0300 Subject: etc/guix/system.scm: Add docker service --- etc/guix/system.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 6758522..bed3da1 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -6,6 +6,7 @@ (gnu services base) (gnu services cups) (gnu services desktop) + (gnu services docker) (gnu services security-token) (gnu services sound) (gnu services virtualization) @@ -63,6 +64,7 @@ (list (service bluetooth-service-type) (service pcscd-service-type) + (service docker-service-type) (service libvirt-service-type) (service virtlog-service-type) (service qemu-binfmt-service-type -- cgit v1.2.3 From 828b7ae06edccbda411e8df08184623fa80ce34f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 29 Oct 2022 14:55:56 -0300 Subject: etc/guix/system.scm: Add tlp and thermald services --- etc/guix/system.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index bed3da1..aaf0ff3 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -7,6 +7,7 @@ (gnu services cups) (gnu services desktop) (gnu services docker) + (gnu services pm) (gnu services security-token) (gnu services sound) (gnu services virtualization) @@ -63,6 +64,8 @@ (append (list (service bluetooth-service-type) + (service tlp-service-type) + (service thermald-service-type) (service pcscd-service-type) (service docker-service-type) (service libvirt-service-type) -- cgit v1.2.3 From 33b2675849c167910c38ce44865f1677337d3cf4 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 29 Oct 2022 15:45:44 -0300 Subject: etc/guix/home.scm: Setup poweralertd-service-type --- etc/guix/home.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index ae5d147..0458c1f 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -10,6 +10,7 @@ (gnu home services shepherd) (gnu packages) (gnu packages base) + (gnu packages freedesktop) (gnu packages gnupg) (gnu packages libreoffice) (gnu packages mail) @@ -247,7 +248,6 @@ (documentation #"- Shepherd service that manages poweralertd."#) - (modules `((gnu packages freedesktop))) (start #~(make-forkexec-constructor (list #$(file-append poweralertd "/bin/poweralertd")))) @@ -571,7 +571,7 @@ "/sh/cronjob.sh")))))) (services (list - ;; (service poweralertd-service-type) + (service poweralertd-service-type) (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" ". ~/.usr/etc/sh/rc"))) (simple-service 'config-files home-files-service-type dot-config) -- cgit v1.2.3 From b8ed775bcdec7d8766ae000534ccda867601e8c3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 29 Oct 2022 16:25:04 -0300 Subject: bin/mailcfg: Use PascalCase label over lowercase normalized one --- bin/email | 2 +- bin/mailcfg | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/email b/bin/email index deaf0f0..87d1cec 100755 --- a/bin/email +++ b/bin/email @@ -70,4 +70,4 @@ eval "$(assert-arg "${1:-}" 'ADDRESS')" printf 'Content-Type: text/plain; charset=UTF-8\nSubject: %s\n\n%s' \ "$(echo "$SUBJECT" | tr -d '\n')" \ "$(cat)" | - msmtpq -a euandreh "$@" + msmtpq -a EuAndreh "$@" diff --git a/bin/mailcfg b/bin/mailcfg index ea53a31..86aab17 100755 --- a/bin/mailcfg +++ b/bin/mailcfg @@ -37,6 +37,7 @@ help() { One of the files also needs to define: - $DEFAULT_NAME - $DEFAULT_ADDR + - $DEFAULT_LABEL An example of such file could be "30-andre@work.com.env": @@ -161,7 +162,7 @@ msmtp() { cat <<-EOF - account default : $DEFAULT_LABEL_LC + account default : $DEFAULT_LABEL EOF } @@ -209,7 +210,10 @@ notmuchhook() { LABELS="$LABELS $LABEL" fi done - sed "s|@DIRS@|$LABELS|g" "$CFGDIR"/post-new + sed \ + -e "s|@DIRS@|$LABELS|g" \ + -e "s|@DEFAULT_LABEL@|$DEFAULT_LABEL|g" \ + "$CFGDIR"/post-new } alot() { @@ -256,10 +260,10 @@ alot() { for env in "$CFGDIR"/*.env; do . "$env" cat <<-EOF - [[$LABEL_LC]] + [[$LABEL]] realname = $NAME address = $ADDR - sendmail_command = msmtpq --account=$LABEL_LC -t + sendmail_command = msmtpq --account=$LABEL -t sent_box = maildir://~/Maildir/$LABEL/Sent draft_box = maildir://~/Maildir/$LABEL/Drafts gpg_key = 5BDAE9B8B2F6C6BCBB0D6CE581F90EC3CD356060 -- cgit v1.2.3 From 12e6c01811550e3d764df52f814a4e9c39b13ba8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 29 Oct 2022 16:25:25 -0300 Subject: bin/mailcfg: Expand $XDG_LOG_HOME at file generation time --- bin/mailcfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mailcfg b/bin/mailcfg index 86aab17..e31ab67 100755 --- a/bin/mailcfg +++ b/bin/mailcfg @@ -139,13 +139,13 @@ mbsync() { } msmtp() { - cat <<-'EOF' + cat <<-EOF defaults auth on tls on port 587 syslog on - logfile ~/.local/var/log/msmtp + logfile $XDG_LOG_HOME/msmtp.log EOF for env in "$CFGDIR"/*.env; do -- cgit v1.2.3 From 6894268bcfc024011091c8a177744657294275de Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 29 Oct 2022 17:02:07 -0300 Subject: Generate etc/git/config-extra from Makefile instead of Guix Home --- Makefile | 5 +++++ etc/guix/home.scm | 8 +------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b94b8bf..2c43852 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ lisp-images = \ derived-assets = \ $(pod2man) \ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ + $(XDG_CONFIG_HOME)/git/config-extra \ $(XDG_CONFIG_HOME)/alot/config \ $(XDG_CONFIG_HOME)/mbsync/config \ $(XDG_CONFIG_HOME)/msmtp/config \ @@ -56,6 +57,10 @@ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub: gpg --export-ssh-key eu@euandre.org > $@ chmod 600 $@ +$(XDG_CONFIG_HOME)/git/config-extra: + printf '[sendemail]\n smtpserver = ' > $@ + command -v msmtpq >> $@ + $(XDG_DATA_HOME)/euandreh/e.list.txt: ~/Documents/txt/ opt/aux/gen-e-list.sh sh opt/aux/gen-e-list.sh > $@ diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 0458c1f..05e9d86 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -172,11 +172,6 @@ (define (xdg-config-home s) (string-append (getenv "XDG_CONFIG_HOME") "/" s)) -(define gitconfig-extra - (mixed-text-file - "gitconfig-extra" - "[sendemail]\n smtpserver = " msmtp-non-hardcoded "/bin/msmtpq\n")) - ;; 2592000 = 60 * 60 * 24 * 30 (define gpg-agent.conf (mixed-text-file "gpg-agent.conf" #"- @@ -188,8 +183,7 @@ pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) (define config-files - `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) - ("git/config-extra" ,gitconfig-extra))) + `(("gnupg/gpg-agent.conf" ,gpg-agent.conf))) (define dot-config (let ((prefix-with-config -- cgit v1.2.3 From 9d29a579a99fe07666c70ff02b71fc21469d450b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 29 Oct 2022 17:09:08 -0300 Subject: Generate etc/gnupg/gpg-agent.conf from Makefile instead of Guix Home --- Makefile | 6 ++++++ etc/gnupg/gpg-agent.conf.tmpl | 6 ++++++ etc/guix/home.scm | 27 --------------------------- 3 files changed, 12 insertions(+), 27 deletions(-) create mode 100644 etc/gnupg/gpg-agent.conf.tmpl diff --git a/Makefile b/Makefile index 2c43852..848a3f3 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ derived-assets = \ $(pod2man) \ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ $(XDG_CONFIG_HOME)/git/config-extra \ + $(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf \ $(XDG_CONFIG_HOME)/alot/config \ $(XDG_CONFIG_HOME)/mbsync/config \ $(XDG_CONFIG_HOME)/msmtp/config \ @@ -61,6 +62,11 @@ $(XDG_CONFIG_HOME)/git/config-extra: printf '[sendemail]\n smtpserver = ' > $@ command -v msmtpq >> $@ +$(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf: $(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf.tmpl + cp $(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf.tmpl $@ + printf 'pinentry-program ' >> $@ + command -v pinentry-gtk-2 >> $@ + $(XDG_DATA_HOME)/euandreh/e.list.txt: ~/Documents/txt/ opt/aux/gen-e-list.sh sh opt/aux/gen-e-list.sh > $@ diff --git a/etc/gnupg/gpg-agent.conf.tmpl b/etc/gnupg/gpg-agent.conf.tmpl new file mode 100644 index 0000000..e772820 --- /dev/null +++ b/etc/gnupg/gpg-agent.conf.tmpl @@ -0,0 +1,6 @@ +# 2592000 = 60 * 60 * 24 * 30 +default-cache-ttl 172800 +default-cache-ttl-ssh 172800 +max-cache-ttl 2592000 +max-cache-ttl-ssh 2592000 +enable-ssh-support diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 05e9d86..53937d0 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -1,7 +1,6 @@ (use-modules ((ice-9 textual-ports) #:prefix textual-ports:) ((guix licenses) #:prefix licenses:) - ((srfi srfi-1) #:prefix s1:) ((xyz euandreh heredoc) #:prefix heredoc:) (gnu home) (gnu home services) @@ -172,31 +171,6 @@ (define (xdg-config-home s) (string-append (getenv "XDG_CONFIG_HOME") "/" s)) -;; 2592000 = 60 * 60 * 24 * 30 -(define gpg-agent.conf - (mixed-text-file "gpg-agent.conf" #"- - default-cache-ttl 172800 - default-cache-ttl-ssh 172800 - max-cache-ttl 2592000 - max-cache-ttl-ssh 2592000 - enable-ssh-support - pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) - -(define config-files - `(("gnupg/gpg-agent.conf" ,gpg-agent.conf))) - -(define dot-config - (let ((prefix-with-config - (lambda (s) - (string-append (substring (getenv "XDG_CONFIG_HOME") - (+ 1 (string-length (getenv "HOME")))) - "/" - s)))) - (map (lambda (t) - (list (prefix-with-config (s1:first t)) - (s1:second t))) - config-files))) - (define (slurp name) (string-trim-both @@ -568,7 +542,6 @@ (service poweralertd-service-type) (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" ". ~/.usr/etc/sh/rc"))) - (simple-service 'config-files home-files-service-type dot-config) (service home-mcron-service-type (home-mcron-configuration (jobs cronjobs)))))) -- cgit v1.2.3 From cf820b59f40e1f052172a8c0e9a8f7b8961bc2f6 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 29 Oct 2022 23:28:52 -0300 Subject: etc/i3/config: Do not start poweralertd Done in Guix home in 33b2675849c167910c38ce44865f1677337d3cf4. --- etc/i3/config | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/i3/config b/etc/i3/config index 83e9b50..c906a1e 100644 --- a/etc/i3/config +++ b/etc/i3/config @@ -22,7 +22,6 @@ exec xss-lock --transfer-sleep-lock -- i3lock --nofork # and nm-applet is a desktop environment-independent system tray GUI for it. exec nm-applet exec blueman-applet -exec poweralertd exec dunst exec greenclip daemon -- cgit v1.2.3 From 3b698e5a7c704da331a0737537a34a8fdce80a3c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Oct 2022 00:12:11 -0300 Subject: etc/guix/home.scm: Add tmux-plugin-{resurrect,continuum} packages --- etc/guix/home.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 53937d0..821e56e 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -494,6 +494,8 @@ nano patch youtube-dl + tmux-plugin-resurrect + tmux-plugin-continuum poezio freetalk -- cgit v1.2.3 From 30b8e1545a5a8e596e858be9b51ef9f37f225a34 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Oct 2022 00:17:16 -0300 Subject: opt/aux/gen-e-list.sh: Include ~/Desktop/FIXME file --- opt/aux/gen-e-list.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/opt/aux/gen-e-list.sh b/opt/aux/gen-e-list.sh index aa0951a..60fb6a0 100755 --- a/opt/aux/gen-e-list.sh +++ b/opt/aux/gen-e-list.sh @@ -5,6 +5,7 @@ set -eu cat <<-EOF ~/Documents/txt/TODOs.md ~/Documents/txt/scratch.txt + ~/Desktop/FIXME $XDG_CONFIG_HOME/sh/rc $XDG_CONFIG_HOME/guix/home.scm $XDG_CONFIG_HOME/guix/system.scm -- cgit v1.2.3 From 22addb1af05c2c1dc65c0d52e61e0fd922f08191 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Oct 2022 00:20:42 -0300 Subject: Makefile: Exclude gen-e-list.sh from check-fixme --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 848a3f3..26958ad 100644 --- a/Makefile +++ b/Makefile @@ -86,8 +86,12 @@ check-perlcritic: xargs awk '/^#!\/usr\/bin\/env perl$$/ { print FILENAME } { nextfile }' | \ xargs perlcritic --exclude=subroutine +FIXME-excludes = \ + ':(exclude)Makefile' \ + ':(exclude)etc/git/ignore' \ + ':(exclude)opt/aux/gen-e-list.sh' check-fixme: - if git grep FIXME -- ':(exclude)Makefile' ':(exclude)etc/git/ignore'; then \ + if git grep FIXME -- $(FIXME-excludes); then \ printf 'Leftover FIXME markers.\n' >&2; \ exit 1; \ fi -- cgit v1.2.3 From cae8fa432571811f712d8c068c8586ad95a87a07 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Oct 2022 00:46:06 -0300 Subject: bin/bins: Allow multiple instances to be ran concurrently Use a unique temporary file for each instance, so that when more than one is active at the same time, they don't try to "mv" the "bins-tmp" file more than once. --- bin/bins | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/bins b/bin/bins index 710cf8a..1b28089 100755 --- a/bin/bins +++ b/bin/bins @@ -67,9 +67,10 @@ IFS=: # Word-splitting is the goal: # shellcheck disable=2086 if stest -rdq -n "$F" $PATH; then - trap 'rm -f $F-tmp' EXIT - stest -lxf $PATH | sort -u > "$F"-tmp - mv "$F"-tmp "$F" + T="$(mkstemp)" + trap 'rm -f $T' EXIT + stest -lxf $PATH | sort -u > "$T" + mv "$T" "$F" fi cat "$F" -- cgit v1.2.3 From 4fb5522217c4d7e2452f8341e2750b80543945b8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Oct 2022 02:07:12 -0300 Subject: etc/tmux/tmux.conf: Use plugins from Guix home profile --- etc/tmux/tmux.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/tmux/tmux.conf b/etc/tmux/tmux.conf index 4f4bd34..93efdf9 100644 --- a/etc/tmux/tmux.conf +++ b/etc/tmux/tmux.conf @@ -92,5 +92,5 @@ set -g @continuum-restore 'on' set -g @continuum-save-interval '60' set -g @resurrect-capture-pane-contents 'on' set -g @resurrect-processes '~make ~ssh ~e "~alot->alot" "~ranger->ranger" "~newsboat->newsboat" "~entr->entr" "~git->git" "~info->info"' -run-shell ~/dev/tmux/tmux-resurrect/resurrect.tmux -run-shell ~/dev/tmux/tmux-continuum/continuum.tmux +run-shell ~/.guix-home/profile/share/tmux-plugins/resurrect/resurrect.tmux +run-shell ~/.guix-home/profile/share/tmux-plugins/continuum/continuum.tmux -- cgit v1.2.3 From c986b1a0676a06a1a6826b446314ba460eac706f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Oct 2022 15:24:25 -0300 Subject: Revert "opt/aux/gen-e-list.sh: Include ~/Desktop/FIXME file" This reverts commit 30b8e1545a5a8e596e858be9b51ef9f37f225a34. --- opt/aux/gen-e-list.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/opt/aux/gen-e-list.sh b/opt/aux/gen-e-list.sh index 60fb6a0..aa0951a 100755 --- a/opt/aux/gen-e-list.sh +++ b/opt/aux/gen-e-list.sh @@ -5,7 +5,6 @@ set -eu cat <<-EOF ~/Documents/txt/TODOs.md ~/Documents/txt/scratch.txt - ~/Desktop/FIXME $XDG_CONFIG_HOME/sh/rc $XDG_CONFIG_HOME/guix/home.scm $XDG_CONFIG_HOME/guix/system.scm -- cgit v1.2.3 From 397af42f45b28489b8c904a88f6eafaf35664389 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Oct 2022 18:36:19 -0300 Subject: etc/guix/home.scm: Remove "poweralertd" package from profile --- etc/guix/home.scm | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 821e56e..d66804e 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -505,7 +505,6 @@ mpv-mpris vlc - poweralertd keepassxc xbacklight -- cgit v1.2.3 From 69697ca024f3bd13e1b3425b22a4db88ac6e2bfe Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Oct 2022 18:37:16 -0300 Subject: Replace greenclip with clipmenu --- bin/menu | 4 +++- etc/guix/home.scm | 32 ++++++++++++++++++++++++++++++-- etc/i3/config | 1 - 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/bin/menu b/bin/menu index c389a2f..73091bd 100755 --- a/bin/menu +++ b/bin/menu @@ -122,7 +122,9 @@ case "$ACTION" in fi ;; clipboard) - greenclip print | show 'clipboard' | copy + # For a potential improved version, see: + # https://github.com/cdown/clipmenu/pull/162 + clipmenu -i -l 20 -fn Monospace-18 -p "$1:" ;; yubikey) CHOICE="$(ykman oath accounts list | show 'OTP')" diff --git a/etc/guix/home.scm b/etc/guix/home.scm index d66804e..102ad5a 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -21,6 +21,7 @@ (gnu packages tmux) (gnu packages version-control) (gnu packages video) + (gnu packages xdisorg) (gnu services) (guix build-system trivial) (guix download) @@ -209,6 +210,34 @@ #~(job "30 0 * * *" "cronjob x update AND upgrade") #~(job "30 0 * * *" "cronjob backup -q cron"))) +(define (clipmenu-shepherd-services _config) + (list + (shepherd-service + (provision '(clipmenu)) + (documentation + #"- + Shepherd service that manages clipmenu."#) + (start + #~(make-forkexec-constructor + (list #$(file-append clipmenu "/bin/clipmenud")))) + (stop #~(make-kill-destructor))))) + +(define clipmenu-service-type + (service-type + (name 'clipmenu) + (extensions + (list + (service-extension home-shepherd-service-type + clipmenu-shepherd-services) + (service-extension home-profile-service-type + (lambda _ (list clipmenu))))) + (default-value '()) + (description + #"- + Service that runs clipmenu as a daemon under Shepherd. + + It has no configuration."#))) + (define (poweralertd-shepherd-services _config) (list (shepherd-service @@ -454,8 +483,6 @@ i3status xmessage dmenu - clipmenu - greenclip httpd ;; for htpasswd weechat @@ -540,6 +567,7 @@ "/sh/cronjob.sh")))))) (services (list + (service clipmenu-service-type) (service poweralertd-service-type) (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" ". ~/.usr/etc/sh/rc"))) diff --git a/etc/i3/config b/etc/i3/config index c906a1e..3c0b800 100644 --- a/etc/i3/config +++ b/etc/i3/config @@ -23,7 +23,6 @@ exec xss-lock --transfer-sleep-lock -- i3lock --nofork exec nm-applet exec blueman-applet exec dunst -exec greenclip daemon # Use pactl to adjust volume in PulseAudio. set $refresh_i3status killall -SIGUSR1 i3status -- cgit v1.2.3 From 6c422221a8ec6dda63eea47e142da707dbc1f157 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Oct 2022 18:52:39 -0300 Subject: etc/guix/home.scm: Include poweralertd in profile To make the manpage available, mostly. --- etc/guix/home.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 102ad5a..b59aa9b 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -256,7 +256,9 @@ (extensions (list (service-extension home-shepherd-service-type - poweralertd-shepherd-services))) + poweralertd-shepherd-services) + (service-extension home-profile-service-type + (lambda _ (list poweralertd))))) (default-value '()) (description #"- -- cgit v1.2.3 From f0eaa6b68ce6de8eefae095cc867b6bdc97dd453 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Oct 2022 18:55:28 -0300 Subject: Move dunst to Guix Home from i3 exec on init --- etc/guix/home.scm | 32 ++++++++++++++++++++++++++++++-- etc/i3/config | 1 - 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index b59aa9b..05dd465 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -9,6 +9,7 @@ (gnu home services shepherd) (gnu packages) (gnu packages base) + (gnu packages dunst) (gnu packages freedesktop) (gnu packages gnupg) (gnu packages libreoffice) @@ -238,6 +239,34 @@ It has no configuration."#))) +(define (dunst-shepherd-services _config) + (list + (shepherd-service + (provision '(dunst)) + (documentation + #"- + Shepherd service that manages dunst."#) + (start + #~(make-forkexec-constructor + (list #$(file-append dunst "/bin/dunst")))) + (stop #~(make-kill-destructor))))) + +(define dunst-service-type + (service-type + (name 'dunst) + (extensions + (list + (service-extension home-shepherd-service-type + dunst-shepherd-services) + (service-extension home-profile-service-type + (lambda _ (list dunst))))) + (default-value '()) + (description + #"- + Service that runs dunst as a daemon under Shepherd. + + It has no configuration."#))) + (define (poweralertd-shepherd-services _config) (list (shepherd-service @@ -416,8 +445,6 @@ flatpak - dunst - sqlite clojure clojure-tools @@ -570,6 +597,7 @@ (services (list (service clipmenu-service-type) + (service dunst-service-type) (service poweralertd-service-type) (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" ". ~/.usr/etc/sh/rc"))) diff --git a/etc/i3/config b/etc/i3/config index 3c0b800..94648b2 100644 --- a/etc/i3/config +++ b/etc/i3/config @@ -22,7 +22,6 @@ exec xss-lock --transfer-sleep-lock -- i3lock --nofork # and nm-applet is a desktop environment-independent system tray GUI for it. exec nm-applet exec blueman-applet -exec dunst # Use pactl to adjust volume in PulseAudio. set $refresh_i3status killall -SIGUSR1 i3status -- cgit v1.2.3 From fd3641e591a5ed98cd0f9e02cb4dc930541dce0f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Oct 2022 19:11:19 -0300 Subject: etc/guix/home.scm: Create (home-service ...) to remove duplication --- etc/guix/home.scm | 97 ++++++++++++------------------------------------------- 1 file changed, 20 insertions(+), 77 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 05dd465..258ffb3 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -211,89 +211,32 @@ #~(job "30 0 * * *" "cronjob x update AND upgrade") #~(job "30 0 * * *" "cronjob backup -q cron"))) -(define (clipmenu-shepherd-services _config) - (list - (shepherd-service - (provision '(clipmenu)) - (documentation - #"- - Shepherd service that manages clipmenu."#) - (start - #~(make-forkexec-constructor - (list #$(file-append clipmenu "/bin/clipmenud")))) - (stop #~(make-kill-destructor))))) - -(define clipmenu-service-type +(define (home-service name package bin) (service-type - (name 'clipmenu) - (extensions - (list - (service-extension home-shepherd-service-type - clipmenu-shepherd-services) - (service-extension home-profile-service-type - (lambda _ (list clipmenu))))) - (default-value '()) - (description - #"- - Service that runs clipmenu as a daemon under Shepherd. - - It has no configuration."#))) - -(define (dunst-shepherd-services _config) - (list - (shepherd-service - (provision '(dunst)) - (documentation - #"- - Shepherd service that manages dunst."#) - (start - #~(make-forkexec-constructor - (list #$(file-append dunst "/bin/dunst")))) - (stop #~(make-kill-destructor))))) - -(define dunst-service-type - (service-type - (name 'dunst) + (name name) (extensions (list (service-extension home-shepherd-service-type - dunst-shepherd-services) + (lambda _ + (list + (shepherd-service + (provision (list name)) + (documentation + (format #f "Shepherd service that manages ~a." name)) + (start + #~(make-forkexec-constructor + (list #$(file-append package bin)))) + (stop #~(make-kill-destructor)))))) (service-extension home-profile-service-type - (lambda _ (list dunst))))) + (lambda _ (list package))))) (default-value '()) (description - #"- - Service that runs dunst as a daemon under Shepherd. - - It has no configuration."#))) - -(define (poweralertd-shepherd-services _config) - (list - (shepherd-service - (provision '(poweralertd)) - (documentation + (format #f #"- - Shepherd service that manages poweralertd."#) - (start - #~(make-forkexec-constructor - (list #$(file-append poweralertd "/bin/poweralertd")))) - (stop #~(make-kill-destructor))))) - -(define poweralertd-service-type - (service-type - (name 'poweralertd) - (extensions - (list - (service-extension home-shepherd-service-type - poweralertd-shepherd-services) - (service-extension home-profile-service-type - (lambda _ (list poweralertd))))) - (default-value '()) - (description - #"- - Service that runs poweralertd as a daemon under Shepherd. + Service that runs ~a as a daemon under Shepherd. - It has no configuration."#))) + It has no configuration."# + name)))) (home-environment (packages @@ -596,9 +539,9 @@ "/sh/cronjob.sh")))))) (services (list - (service clipmenu-service-type) - (service dunst-service-type) - (service poweralertd-service-type) + (service (home-service 'clipmenu clipmenu "/bin/clipmenud")) + (service (home-service 'dunst dunst "/bin/dunst")) + (service (home-service 'poweralertd poweralertd "/bin/poweralertd")) (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" ". ~/.usr/etc/sh/rc"))) (service home-mcron-service-type -- cgit v1.2.3 From 01a4ab36f60d812aa1b35dcd574f1a3ea21caa14 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 31 Oct 2022 17:08:55 -0300 Subject: etc/git/config: Update msmtpq account --- etc/git/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/git/config b/etc/git/config index ade021a..0ff1257 100644 --- a/etc/git/config +++ b/etc/git/config @@ -14,7 +14,7 @@ [sendemail] assume8bitEncoding = UTF-8 smtpserveroption = -a - smtpserveroption = euandreh + smtpserveroption = EuAndreh annotate = yes confirm = never [remote "origin"] -- cgit v1.2.3 From 1d9494c74ce12921512d99c665b167b2d2aa2ff7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 31 Oct 2022 20:10:00 -0300 Subject: bin/li: Remove hard-coded path to cl(1) --- bin/li | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/li b/bin/li index 8636a07..7292db0 100755 --- a/bin/li +++ b/bin/li @@ -79,7 +79,7 @@ fi IMAGE="${XDG_DATA_HOME:-$HOME/.local/share}/lisp-cli/$IMPL.image" -BIN=~/.usr/bin/cl +BIN="$(command -v cl)" INIT="${XDG_CONFIG_HOME:-$HOME/.config}/lisp-cli/init.lisp" if [ ! -e "$IMAGE" ]; then printf 'Bootstrapping a new "%s" image...\n' "$IMPL" >&2 -- cgit v1.2.3 From d883f19bc8e199ccce0787dcecce30adac1efec0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 31 Oct 2022 20:15:00 -0300 Subject: bin/upgrade: Use $XDG_CONFIG_DIR over hard-coding ~/.usr/etc --- bin/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/upgrade b/bin/upgrade index 12f319c..52c019e 100755 --- a/bin/upgrade +++ b/bin/upgrade @@ -63,4 +63,4 @@ shift $((OPTIND - 1)) pass show velhinho/0-andreh-password | head -n1 | sudo -iS guix system -v3 reconfigure /etc/guix/configuration.scm -guix home -v3 reconfigure ~/.usr/etc/guix/home.scm +guix home -v3 reconfigure "$XDG_CONFIG_HOME"/guix/home.scm -- cgit v1.2.3 From 58a29daabcb933233b56f0e268d55bbdeee9fa8a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 31 Oct 2022 20:15:59 -0300 Subject: bin/check: Use $XDG_PREFIX over hard-coding ~/.usr/ --- bin/check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/check b/bin/check index 5919482..8348041 100755 --- a/bin/check +++ b/bin/check @@ -54,5 +54,5 @@ done shift $((OPTIND - 1)) -cd ~/.usr/ +cd "$XDG_PREFIX" make check -- cgit v1.2.3 From 251a766b0f81c1569873ec4cb536428e08b16ed7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 31 Oct 2022 20:22:43 -0300 Subject: etc/ssh/config: Generate with envsubst So that the `Include` can also point to a variable. --- Makefile | 4 ++++ etc/ssh/config | 6 ------ etc/ssh/config.tmpl | 6 ++++++ 3 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 etc/ssh/config create mode 100644 etc/ssh/config.tmpl diff --git a/Makefile b/Makefile index 26958ad..9ab6cb1 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ derived-assets = \ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ $(XDG_CONFIG_HOME)/git/config-extra \ $(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf \ + $(XDG_CONFIG_HOME)/ssh/config \ $(XDG_CONFIG_HOME)/alot/config \ $(XDG_CONFIG_HOME)/mbsync/config \ $(XDG_CONFIG_HOME)/msmtp/config \ @@ -58,6 +59,9 @@ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub: gpg --export-ssh-key eu@euandre.org > $@ chmod 600 $@ +$(XDG_CONFIG_HOME)/ssh/config: $(XDG_CONFIG_HOME)/ssh/config.tmpl + envsubst < $(XDG_CONFIG_HOME)/ssh/config.tmpl > $@ + $(XDG_CONFIG_HOME)/git/config-extra: printf '[sendemail]\n smtpserver = ' > $@ command -v msmtpq >> $@ diff --git a/etc/ssh/config b/etc/ssh/config deleted file mode 100644 index e548fe2..0000000 --- a/etc/ssh/config +++ /dev/null @@ -1,6 +0,0 @@ -Host * - UserKnownHostsFile ${XDG_CONFIG_HOME}/ssh/known_hosts - -Include ~/dev/libre/servers/src/infrastructure/ssh.conf -Include ~/dev/others/lawtech/src/infrastructure/ssh.conf -Include ~/.usr/share/euandreh/vm-ssh.conf diff --git a/etc/ssh/config.tmpl b/etc/ssh/config.tmpl new file mode 100644 index 0000000..fd4b8a3 --- /dev/null +++ b/etc/ssh/config.tmpl @@ -0,0 +1,6 @@ +Host * + UserKnownHostsFile ${XDG_CONFIG_HOME}/ssh/known_hosts + +Include ~/dev/libre/servers/src/infrastructure/ssh.conf +Include ~/dev/others/lawtech/src/infrastructure/ssh.conf +Include ${XDG_DATA_HOME}/euandreh/vm-ssh.conf -- cgit v1.2.3 From ac0f8ca1bc53abe9b123270bde734ec3cc59f0c3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 31 Oct 2022 20:30:43 -0300 Subject: bin/wms: Fix indentation in help string --- bin/wms | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/wms b/bin/wms index 6fe895e..d0a4d7c 100755 --- a/bin/wms +++ b/bin/wms @@ -16,9 +16,9 @@ help() { -h, --help show this message ACTION one of: - - uuid - - date - - clear-notification + - uuid + - date + - clear-notification Helper script to launch CLI commands, without having complex -- cgit v1.2.3 From de2c3a77588e45a3596a26e37e6a35a268ba50d1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 31 Oct 2022 22:12:49 -0300 Subject: etc/guix/home.scm: Add archivebox package --- etc/guix/home.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 258ffb3..a61547a 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -424,7 +424,7 @@ clang tcc fuse - node + ; node ; broken: conflicts with archivebox quickjs m4 go @@ -496,6 +496,10 @@ tmux-plugin-resurrect tmux-plugin-continuum + ;; ArchiveBox and some of its optional dependencies + archivebox + ripgrep + poezio freetalk mcabber -- cgit v1.2.3 From dcef68452df23f4d63eb53a216cd080ac5803a90 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 31 Oct 2022 22:20:29 -0300 Subject: bin/archiveit: Add new binary, still being validated --- bin/archiveit | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100755 bin/archiveit diff --git a/bin/archiveit b/bin/archiveit new file mode 100755 index 0000000..da132d7 --- /dev/null +++ b/bin/archiveit @@ -0,0 +1,98 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + archiveit + archiveit -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -h, --help show this message + + + Grab all bookmarks from Firefox that contains tags and archive + them with ArchiveBox. + + + Examples: + + Just run it: + + $ archiveit + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +# Derived from ArchiveBox: +# https://github.com/pirate/ArchiveBox/blob/db1f6efc934bbcdf53377bf51a064c6fd0fc5b1d/bin/archivebox-export-browser-history#L23-L37 +QUERY="$( + cat <<-'EOF' + SELECT json_object('timestamp', dateAdded, 'description', title, 'href', url) + FROM ( + SELECT b.dateAdded, b.title, p.url + FROM moz_bookmarks AS b + JOIN moz_places AS p + ON b.fk = p.id + WHERE b.fk IN ( + SELECT DISTINCT(fk) FROM moz_bookmarks + WHERE parent IN ( + -- get all tags + SELECT id FROM moz_bookmarks + WHERE parent = 4 + ) + ) + AND b.title IS NOT NULL + ORDER BY + b.dateAdded ASC, + b.title ASC, + p.url + ) + EOF +)" + +# Copy the database because it is locked. +DB="$(mkstemp)" +cp ~/.mozilla/firefox/*.default/places.sqlite "$DB" + +cd ~/Documents/Archive/ + +sqlite3 "$DB" "$QUERY" | archivebox add +archivebox update -- cgit v1.2.3 From d412db9a1d958dc07a4f9324ec980db78dc42a49 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 2 Nov 2022 18:32:31 -0300 Subject: bin/cl: Add support for -E option --- bin/cl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/cl b/bin/cl index 48cc8af..87d7c92 100755 --- a/bin/cl +++ b/bin/cl @@ -53,6 +53,7 @@ help() { Options: -e EXP an sexp to be evaluated (can be given more than once) + -E EXP an sexp to be executed as a script -f FILE a file to be evaluated (can be given more than once) -p print the value of the last given expression -M IMAGE load the given Lisp image @@ -139,11 +140,16 @@ LISP_CLI_RC="${XDG_CONFIG_HOME:-$HOME/.config}/lisp-cli/init.lisp" VERBOSE=false IMAGE='' IMPL="${LISP_CLI_IMPL:-}" -while getopts 'e:f:pM:I:nvlh' flag; do +INTERACTIVE=true +while getopts 'e:E:f:pM:I:nvlh' flag; do case "$flag" in e) printf '%s\n' "$OPTARG" >> "$SCRIPT" ;; + E) + printf '%s\n' "$OPTARG" >> "$SCRIPT" + INTERACTIVE=false + ;; f) escape_name "$OPTARG" >> "$SCRIPT" ;; @@ -183,7 +189,6 @@ if [ "$1" != '--' ]; then fi PRESERVE_ARGS=false -INTERACTIVE=true for f in "$@"; do if [ "$f" = '--' ]; then PRESERVE_ARGS=true -- cgit v1.2.3 From 4652d61ea15ecbb2b09b87c5a95a0f1cc9ff731a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 2 Nov 2022 22:15:47 -0300 Subject: bin/gc: Use "--optimize" for guix gc --- bin/gc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/gc b/bin/gc index 7502e76..60a6376 100755 --- a/bin/gc +++ b/bin/gc @@ -80,9 +80,9 @@ disk() { gc_guix() { pass show velhinho/0-andreh-password | head -n1 | sudo -iS guix system delete-generations - pass show velhinho/0-andreh-password | head -n1 | sudo -iS guix gc -d + pass show velhinho/0-andreh-password | head -n1 | sudo -iS guix gc --optimize -d guix home delete-generations - guix gc -d + guix gc --optimize -d } gc_nohup() { -- cgit v1.2.3 From bcbb8b7026028d16ec6d975280ea7fe227dee5cd Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 2 Nov 2022 22:19:26 -0300 Subject: etc/guix/system.scm: Add group "docker" to allow non-sudo usage of it --- etc/guix/system.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index aaf0ff3..6f784b5 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -47,7 +47,7 @@ (name "andreh") (comment "EuAndreh") (group "users") - (supplementary-groups '("netdev" "audio" "video" "wheel" "kvm")))) + (supplementary-groups '("netdev" "audio" "video" "wheel" "kvm" "docker")))) %base-user-accounts)) (packages (append -- cgit v1.2.3 From b6406b4396a6aedff4e66e5a3663b6013550fdcc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 2 Nov 2022 22:45:40 -0300 Subject: bin/li: Use -E and remove extra -e "(uiop:quit)" --- bin/li | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/bin/li b/bin/li index 7292db0..f92f487 100755 --- a/bin/li +++ b/bin/li @@ -84,20 +84,18 @@ INIT="${XDG_CONFIG_HOME:-$HOME/.config}/lisp-cli/init.lisp" if [ ! -e "$IMAGE" ]; then printf 'Bootstrapping a new "%s" image...\n' "$IMPL" >&2 cl \ - -I "$IMPL" \ - -v \ - -e '(ql:quickload :trivial-dump-core)' \ - -e "(trivial-dump-core:dump-image \"$IMAGE\")" \ - -e '(uiop:quit)' + -I "$IMPL" \ + -v \ + -e '(ql:quickload :trivial-dump-core)' \ + -E "(trivial-dump-core:dump-image \"$IMAGE\")" elif [ -n "$(find "$0" "$BIN" "$INIT" -newer "$IMAGE")" ]; then printf 'Refresh existing "%s" image...\n' "$IMPL" >&2 cl \ - -M "$IMAGE" \ - -I "$IMPL" \ - -v \ - -e '(ql:quickload :trivial-dump-core)' \ - -e "(trivial-dump-core:dump-image \"$IMAGE\")" \ - -e '(uiop:quit)' + -M "$IMAGE" \ + -I "$IMPL" \ + -v \ + -e '(ql:quickload :trivial-dump-core)' \ + -E "(trivial-dump-core:dump-image \"$IMAGE\")" fi if [ "$VERBOSE" = true ]; then -- cgit v1.2.3 From faa6b28ee684d08b4429011373eb64f490e287bc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 2 Nov 2022 22:49:23 -0300 Subject: Makefile: Notify Lisp image created to STDOUT instead of silent work --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9ab6cb1..d400ce1 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ $(XDG_DATA_HOME)/euandreh/e.list.txt: ~/Documents/txt/ opt/aux/gen-e-list.sh $(lisp-images): $(XDG_CONFIG_HOME)/lisp-cli/init.lisp bin/cl bin/li I=`echo $@ | awk -F/ '$$0=$$(NF)' | cut -d. -f1` && \ - li -vI $$I -e '(uiop:quit)' + li -vI $$I -E "(format t \"Image for \\\"$$I\\\" created.~%\")" -- cgit v1.2.3 From 27063b6b6faf6b0cf49b8620f55e761089a4ca01 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 4 Nov 2022 17:07:26 -0300 Subject: etc/guix/home.scm: Add "remhind" package --- etc/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index a61547a..c85342c 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -335,6 +335,7 @@ rlwrap direnv borg + remhind khal khard libfaketime -- cgit v1.2.3 From ac975ca530d6be42148264501dd7a40ebfd97a81 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 4 Nov 2022 17:12:03 -0300 Subject: etc/remhind/config.tmpl: Add remhind config template, and generate it in Makefile --- Makefile | 4 ++++ etc/remhind/config.tmpl | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 etc/remhind/config.tmpl diff --git a/Makefile b/Makefile index d400ce1..33e1cac 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ derived-assets = \ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ $(XDG_CONFIG_HOME)/git/config-extra \ $(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf \ + $(XDG_CONFIG_HOME)/remhind/config \ $(XDG_CONFIG_HOME)/ssh/config \ $(XDG_CONFIG_HOME)/alot/config \ $(XDG_CONFIG_HOME)/mbsync/config \ @@ -59,6 +60,9 @@ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub: gpg --export-ssh-key eu@euandre.org > $@ chmod 600 $@ +$(XDG_CONFIG_HOME)/remhind/config: $(XDG_CONFIG_HOME)/remhind/config.tmpl + envsubst < $(XDG_CONFIG_HOME)/remhind/config.tmpl > $@ + $(XDG_CONFIG_HOME)/ssh/config: $(XDG_CONFIG_HOME)/ssh/config.tmpl envsubst < $(XDG_CONFIG_HOME)/ssh/config.tmpl > $@ diff --git a/etc/remhind/config.tmpl b/etc/remhind/config.tmpl new file mode 100644 index 0000000..4d74b20 --- /dev/null +++ b/etc/remhind/config.tmpl @@ -0,0 +1,4 @@ +[calendars] + [calendars.private_cal] + name = "private_cal" + path = "${XDG_DATA_HOME}/khal/calendars/private/" -- cgit v1.2.3 From e5bc7cfa0ec21f2420af711990bd14a11a1e72a7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 4 Nov 2022 18:01:03 -0300 Subject: etc/guix/home.scm: Align columns of (home-service ...) entries --- etc/guix/home.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index c85342c..28e0c6d 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -544,8 +544,8 @@ "/sh/cronjob.sh")))))) (services (list - (service (home-service 'clipmenu clipmenu "/bin/clipmenud")) - (service (home-service 'dunst dunst "/bin/dunst")) + (service (home-service 'clipmenu clipmenu "/bin/clipmenud")) + (service (home-service 'dunst dunst "/bin/dunst")) (service (home-service 'poweralertd poweralertd "/bin/poweralertd")) (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" ". ~/.usr/etc/sh/rc"))) -- cgit v1.2.3 From 1fcc6d84829d100f29c718af205f8413bf833707 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 4 Nov 2022 18:01:41 -0300 Subject: etc/guix/home.scm: Add remhind (home-service ...) --- etc/guix/home.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 28e0c6d..c62c0fe 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -30,7 +30,8 @@ (guix git-download) (guix modules) (guix packages) - (guix utils)) + (guix utils) + (xyz euandreh queue)) (heredoc:enable-syntax) (define-public hunspell-iconv @@ -335,7 +336,6 @@ rlwrap direnv borg - remhind khal khard libfaketime @@ -547,6 +547,7 @@ (service (home-service 'clipmenu clipmenu "/bin/clipmenud")) (service (home-service 'dunst dunst "/bin/dunst")) (service (home-service 'poweralertd poweralertd "/bin/poweralertd")) + (service (home-service 'remhind remhind "/bin/remhind")) (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" ". ~/.usr/etc/sh/rc"))) (service home-mcron-service-type -- cgit v1.2.3 From 6e32004bc32e4a3787e8a4ef9a5d44659aa3dfe6 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 4 Nov 2022 18:46:21 -0300 Subject: etc/guix/home.scm: Adapt to newest msmtp bad default values --- etc/guix/home.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index c62c0fe..116b8b4 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -123,8 +123,9 @@ (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out"))) (substitute* (string-append out "/bin/msmtpq") - (("^LOG=.*$") "LOG=$XDG_LOG_HOME/msmtpq.log\n") - (("^Q=.*$") "Q=$XDG_DATA_HOME/msmtp/queue\n") + (("LOG=.*$") "LOG=\"$XDG_LOG_HOME\"/msmtpq.log\n") + (("^Q=.*$") "Q=\"$XDG_DATA_HOME\"/msmtp/queue\n") + (("^MSMTPQ_Q=.*$") "MSMTPQ_Q=\"$Q\"\n") (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) (define (with-options pkg bin opts) -- cgit v1.2.3 From 498f8137bcbaaf92f46ce2fa9616267818f12bb0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 5 Nov 2022 05:09:08 -0300 Subject: etc/guix/home.scm: Add "gpodder" package --- etc/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 116b8b4..214ee4d 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -526,6 +526,7 @@ inkscape libreoffice quodlibet + gpodder ungoogled-chromium firefox)) (list msmtp-non-hardcoded -- cgit v1.2.3 From 208bc22a0d6e4e6893168643d69afa18d85294b8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 5 Nov 2022 05:11:23 -0300 Subject: etc/sh/rc: Include $DICPATH in `add_prefix()` --- etc/sh/rc | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/sh/rc b/etc/sh/rc index 8afd8df..3af52c9 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -96,6 +96,7 @@ add_prefix() { export LIBRARY_PATH="$1/lib${LIBRARY_PATH:+:}${LIBRARY_PATH:-}" export INFOPATH="$1/share/info${INFOPATH:+:}${INFOPATH:-}" export MANPATH="$1/share/man${MANPATH:+:}${MANPATH:-}" + export DICPATH="$1/share/hunspell${DICPATH:+:}${DICPATH:-}" export PATH="$1/bin${PATH:+:}${PATH:-}" } export PREFIX="$XDG_PREFIX/var/mkg" -- cgit v1.2.3 From 607570f739d44676d10d15ed4d2f7aabe7e6bbcc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 5 Nov 2022 08:21:47 -0300 Subject: etc/sh/cronjob.sh: Load ~/.profile over ad-hoc ~/.usr/etc/sh/rc file --- etc/sh/cronjob.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/etc/sh/cronjob.sh b/etc/sh/cronjob.sh index 05022e0..0569b44 100755 --- a/etc/sh/cronjob.sh +++ b/etc/sh/cronjob.sh @@ -65,7 +65,10 @@ done shift $((OPTIND - 1)) +set +e # shellcheck disable=1090 -. ~/.usr/etc/sh/rc +. ~/.profile +set -e + CMD="$*" with-email -s "$CMD" -- "$@" 1>>"$XDG_LOG_HOME"/euandreh/mcron.log 2>&1 -- cgit v1.2.3 From 75a2f8d196346505cdb246d4550a1a35922d98f0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 5 Nov 2022 09:07:55 -0300 Subject: Move XDG_* variables from etc/sh/rc to Guix Home --- etc/guix/home.scm | 20 +++++++++++++++++++- etc/sh/rc | 6 ------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 214ee4d..891142a 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -7,6 +7,7 @@ (gnu home services mcron) (gnu home services shells) (gnu home services shepherd) + (gnu home services xdg) (gnu packages) (gnu packages base) (gnu packages dunst) @@ -240,6 +241,10 @@ It has no configuration."# name)))) +(define xdg-prefix "$HOME/.usr") +(define (xdg path) + (string-append xdg-prefix "/" path)) + (home-environment (packages (append @@ -550,8 +555,21 @@ (service (home-service 'dunst dunst "/bin/dunst")) (service (home-service 'poweralertd poweralertd "/bin/poweralertd")) (service (home-service 'remhind remhind "/bin/remhind")) + (service home-xdg-base-directories-service-type + (home-xdg-base-directories-configuration + (cache-home (xdg "var/cache")) + (config-home (xdg "etc")) + (data-home (xdg "share")) + (log-home (xdg "var/log")) + (state-home (xdg "state")))) (simple-service 'my-shell-profile home-shell-profile-service-type - (list (plain-file "my-profile" ". ~/.usr/etc/sh/rc"))) + (list (plain-file + "my-profile" + (format #f + #"- + export XDG_PREFIX="~a" + . "$XDG_CONFIG_HOME"/sh/rc"# + xdg-prefix)))) (service home-mcron-service-type (home-mcron-configuration (jobs cronjobs)))))) diff --git a/etc/sh/rc b/etc/sh/rc index 3af52c9..7ea9593 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -3,12 +3,6 @@ export ENV=~/.profile -export XDG_PREFIX=~/.usr -export XDG_CACHE_HOME="$XDG_PREFIX/var/cache" -export XDG_CONFIG_HOME="$XDG_PREFIX/etc" -export XDG_DATA_HOME="$XDG_PREFIX/share" -export XDG_STATE_HOME="$XDG_PREFIX/state" -export XDG_LOG_HOME="$XDG_PREFIX/var/log" export XDG_DATA_DIRS="$XDG_DATA_HOME/flatpak/exports/share:/var/lib/flatpak/exports/share${XDG_DATA_DIRS:+:}${XDG_DATA_DIRS:-}" -- cgit v1.2.3 From 80333ea987c38ec217588fe98f590e5c50cf3715 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 5 Nov 2022 11:43:02 -0300 Subject: bin/backup: Exclude ~/gPodder/ while it is not placed properly --- bin/backup | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/backup b/bin/backup index be7d996..d046552 100755 --- a/bin/backup +++ b/bin/backup @@ -100,6 +100,7 @@ run() { --comment "$COMMENT" \ --exclude "$XDG_CACHE_HOME" \ --exclude ~/Downloads/ \ + --exclude ~/gPodder/ \ --stats \ --compression lzma,9 \ "::{hostname}-{now}-$ARCHIVE_TAG" \ -- cgit v1.2.3 From 8112f1be52f61ccee08d70d9928b562a0f2f2e08 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 5 Nov 2022 11:44:25 -0300 Subject: etc/sh/rc: Remove ~/.bashrc symlink Since I'm always in tmux, and tmux loads ~/.profile when launching a new terminal, this file adds little value. --- etc/sh/rc | 2 -- 1 file changed, 2 deletions(-) diff --git a/etc/sh/rc b/etc/sh/rc index 7ea9593..d6a602f 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -325,8 +325,6 @@ if [ -z "$BASH_VERSION" ]; then return fi -ln -fs .profile ~/.bashrc - export INPUTRC="$XDG_CONFIG_HOME/bash/inputrc" export HISTCONTROL=ignorespace:ignoredups -- cgit v1.2.3 From 8d6aa327ba01b8551c4d23fb600bc578d6da2175 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 6 Nov 2022 10:15:30 -0300 Subject: etc/sh/rc (PS1): Inline call to "vcs ps1" --- etc/sh/rc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/etc/sh/rc b/etc/sh/rc index d6a602f..95b0e2d 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -140,10 +140,6 @@ alias kal='khal calendar today `LANG=en.UTF-8 date +%A`' # PS1 # -repo_status() { - vcs ps1 -} - error_marker() { STATUS=$? if [ "$STATUS" != 0 ]; then @@ -224,7 +220,7 @@ in_nix_shell() { fi } -PS1='`error_marker`'$(timestamp)' '$(path)' `shell_status``repo_status``guix_env``in_nix_shell` +PS1='`error_marker`'$(timestamp)' '$(path)' `shell_status``vcs ps1``guix_env``in_nix_shell` $ ' -- cgit v1.2.3 From ec942a79ae8ae40a2dd28927febcafcb2e01e2f1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 6 Nov 2022 10:20:18 -0300 Subject: etc/sh/rc (PS1): Use early returns on the helper functions --- etc/sh/rc | 65 ++++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/etc/sh/rc b/etc/sh/rc index 95b0e2d..469addd 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -148,19 +148,24 @@ error_marker() { } shell_status_level() { - if [ -n "${SHLVL:-}" ]; then - if [ -n "${TMUX:-}" ]; then - LVL=$((SHLVL - 1)) - else - LVL="$SHLVL" - fi - if [ "$LVL" != 1 ]; then - color -c white "$LVL" - if [ -n "${RANGER_LEVEL:-}" ]; then - color -c white '|' - color -c bluei 'r' - fi - fi + if [ -z "${SHLVL:-}" ]; then + return + fi + + if [ -n "${TMUX:-}" ]; then + LVL=$((SHLVL - 1)) + else + LVL="$SHLVL" + fi + + if [ "$LVL" = 1 ]; then + return + fi + + color -c white "$LVL" + if [ -n "${RANGER_LEVEL:-}" ]; then + color -c white '|' + color -c bluei 'r' fi } @@ -198,26 +203,30 @@ path() { } guix_env() { - if [ -n "${GUIX_ENVIRONMENT:-}" ]; then - printf '\n' - color -c blacki '~> ' - color -c purple 'guix environment ' - printf '(' - color -c blueb "$GUIX_ENVIRONMENT" - printf ')' + if [ -z "${GUIX_ENVIRONMENT:-}" ]; then + return fi + + printf '\n' + color -c blacki '~> ' + color -c purple 'guix environment ' + printf '(' + color -c blueb "$GUIX_ENVIRONMENT" + printf ')' } in_nix_shell() { - if [ -n "${IN_NIX_SHELL:-}" ]; then - printf '\n' - color -c blacki '~> ' - color -c purpleb "$IN_NIX_SHELL " - color -c purple 'nix-shell ' - printf '(' - color -c blueb "${name:-}" - printf ')' + if [ -z "${IN_NIX_SHELL:-}" ]; then + return fi + + printf '\n' + color -c blacki '~> ' + color -c purpleb "$IN_NIX_SHELL " + color -c purple 'nix-shell ' + printf '(' + color -c blueb "${name:-}" + printf ')' } PS1='`error_marker`'$(timestamp)' '$(path)' `shell_status``vcs ps1``guix_env``in_nix_shell` -- cgit v1.2.3 From 43d7e5e9250e06c441e456f90e50f394fa97874d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 6 Nov 2022 10:26:38 -0300 Subject: etc/sh/rc: Rename reload() to r(); remove alias for "r" --- etc/sh/rc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/etc/sh/rc b/etc/sh/rc index 469addd..742975c 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -105,8 +105,6 @@ add_prefix "$XDG_PREFIX" unalias -a -alias r='reload' - alias p='ping euandre.org -c 3' alias c='tmux send-keys -R \; clear-history' alias o='open' @@ -275,7 +273,7 @@ f() { -reload() { +r() { . ~/.profile xset r rate 225 100 } -- cgit v1.2.3 From ad08a10c8d9eded7a654172649cb23167dd9c6bc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 6 Nov 2022 10:47:12 -0300 Subject: etc/guix/home.scm: Include many alternative shells --- etc/guix/home.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 891142a..d9e76ae 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -458,6 +458,19 @@ gambit-c gauche + dash + fish + rc + es + tcsh + zsh + oksh + loksh + mksh + oil + gash + nushell + st i3status xmessage -- cgit v1.2.3 From 185517bc659e671d32b22ae5afe678594c84c692 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 6 Nov 2022 20:36:00 -0300 Subject: bin/m: Run mbsync in parallel, with one process per account Get the accounts from the list generated by `mailcfg list`. --- Makefile | 4 ++++ bin/m | 4 +++- bin/mailcfg | 15 ++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 33e1cac..a9df1f2 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ derived-assets = \ $(XDG_CONFIG_HOME)/msmtp/config \ $(XDG_CONFIG_HOME)/notmuch/default/config \ $(XDG_CONFIG_HOME)/notmuch/default/hooks/post-new \ + $(XDG_DATA_HOME)/euandreh/mailcfg-accounts.txt \ $(XDG_DATA_HOME)/common-lisp/source \ $(XDG_DATA_HOME)/euandreh/e.list.txt \ $(lisp-images) @@ -56,6 +57,9 @@ $(XDG_CONFIG_HOME)/notmuch/default/hooks/post-new: bin/mailcfg mailcfg notmuchhook > $@ chmod +x $@ +$(XDG_DATA_HOME)/euandreh/mailcfg-accounts.txt: bin/mailcfg + mailcfg list > $@ + $(XDG_CONFIG_HOME)/ssh/id_rsa.pub: gpg --export-ssh-key eu@euandre.org > $@ chmod 600 $@ diff --git a/bin/m b/bin/m index 43b1ad6..6891128 100755 --- a/bin/m +++ b/bin/m @@ -59,6 +59,8 @@ done shift $((OPTIND - 1)) +F="${XDG_DATA_HOME:-$HOME/.local/share}"/euandreh/mailcfg-accounts.txt + notmuch new -mbsync -a +xargs -I% -P "$(wc -l < "$F")" mbsync '%' < "$F" notmuch new diff --git a/bin/mailcfg b/bin/mailcfg index e31ab67..f77355e 100755 --- a/bin/mailcfg +++ b/bin/mailcfg @@ -22,6 +22,7 @@ help() { - notmuchcfg - notmuchhook - alot + - list Emit the generated configuration file for the chosen email @@ -57,6 +58,11 @@ help() { Get the alot configuration file: $ mailcfg alot + + + List the existing account labels: + + $ mailcfg list EOF } @@ -271,9 +277,16 @@ alot() { done } +list() { + for env in "$CFGDIR"/*.env; do + . "$env" + printf '%s\n' "$LABEL" + done +} + case "$ACTION" in - mbsync|msmtp|notmuchcfg|notmuchhook|alot) + mbsync|msmtp|notmuchcfg|notmuchhook|alot|list) "$1" ;; *) -- cgit v1.2.3 From f6f99b0ecb7efcb1a5e1f1644aa9ebe3a7d33358 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 7 Nov 2022 14:44:08 -0300 Subject: bin/li: Tweak help string --- bin/li | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/li b/bin/li index f92f487..1e7917f 100755 --- a/bin/li +++ b/bin/li @@ -18,7 +18,7 @@ help() { -v verbose mode -h, --help show this message - OPTIONS options to be forwarded to cl (lisp-cli) + OPTIONS options to be forwarded to cl(1) (lisp-cli) Run the cl(1) executable with OPTIONS, but make sure an up-to-date -- cgit v1.2.3 From 4a93f14824c5dc90e5ae4193411e501afdef01fe Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 8 Nov 2022 01:40:40 -0300 Subject: etc/guix/home.scm: Add xdg-desktop-portal package, companion to flatpak --- etc/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index d9e76ae..b137744 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -394,6 +394,7 @@ btrfs-progs flatpak + xdg-desktop-portal sqlite clojure -- cgit v1.2.3 From accc67c3cc12f7d37e7e86a16b33a74783e53fb0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 9 Nov 2022 19:20:59 -0300 Subject: etc/guix/home.scm: Fix gPodder data location --- etc/guix/home.scm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index b137744..08f933d 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -13,6 +13,7 @@ (gnu packages dunst) (gnu packages freedesktop) (gnu packages gnupg) + (gnu packages gpodder) (gnu packages libreoffice) (gnu packages mail) (gnu packages music) @@ -129,6 +130,24 @@ (("^MSMTPQ_Q=.*$") "MSMTPQ_Q=\"$Q\"\n") (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) +(define gpodder-xdg + (package + (inherit gpodder) + (name "gpodder-xdg") + (arguments + (substitute-keyword-arguments (package-arguments gpodder) + ((#:phases phases '%standard-phases) + #~(modify-phases #$phases + (add-after 'install 'wrap-with-environment-variables + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (for-each + (lambda (bin) + (wrap-program (string-append out "/bin/" bin) + '("GPODDER_HOME" = ("${XDG_DATA_HOME:-$HOME/.local/share}/gPodder")) + '("GPODDER_DOWNLOAD_DIR" = ("${XDG_DOWNLOAD_DIR:-$HOME/Downloads}/gPodder")))) + '("gpo" "gpodder"))))))))))) + (define (with-options pkg bin opts) (package (inherit pkg) @@ -545,7 +564,6 @@ inkscape libreoffice quodlibet - gpodder ungoogled-chromium firefox)) (list msmtp-non-hardcoded @@ -557,6 +575,7 @@ mpv-with-options openssh-with-options hunspell-iconv + gpodder-xdg (hunspell-dictionary-utf8 "en") (hunspell-dictionary-utf8 "pt") (hunspell-dictionary-utf8 "fr") -- cgit v1.2.3 From 92fac01b20db13cbad4703f6592fb27dab703a3c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 9 Nov 2022 19:21:41 -0300 Subject: Revert "bin/backup: Exclude ~/gPodder/ while it is not placed properly" This reverts commit 80333ea987c38ec217588fe98f590e5c50cf3715. Fixed in accc67c3cc12f7d37e7e86a16b33a74783e53fb0. --- bin/backup | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/backup b/bin/backup index d046552..be7d996 100755 --- a/bin/backup +++ b/bin/backup @@ -100,7 +100,6 @@ run() { --comment "$COMMENT" \ --exclude "$XDG_CACHE_HOME" \ --exclude ~/Downloads/ \ - --exclude ~/gPodder/ \ --stats \ --compression lzma,9 \ "::{hostname}-{now}-$ARCHIVE_TAG" \ -- cgit v1.2.3 From d3bd6872c2100535d31166286ee46373bd81c852 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 10 Nov 2022 06:50:53 -0300 Subject: etc/guix/home.scm: Move $XDG_STATE_HOME to $XDG_PREFIX/var/state --- etc/guix/home.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 08f933d..b597a68 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -594,7 +594,7 @@ (config-home (xdg "etc")) (data-home (xdg "share")) (log-home (xdg "var/log")) - (state-home (xdg "state")))) + (state-home (xdg "var/state")))) (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" -- cgit v1.2.3 From 3151829c10da6f7fb078c4ee24543f62678fb393 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 10 Nov 2022 07:25:07 -0300 Subject: etc/guix/home.scm: Add "hicolor-icon-theme" package --- etc/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index b597a68..c2e7d50 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -547,6 +547,7 @@ newsboat mpv-mpris vlc + hicolor-icon-theme keepassxc -- cgit v1.2.3 From 417235cc21fa4fba64c0719fcf6ac42cf1313f49 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 10 Nov 2022 08:01:45 -0300 Subject: etc/guix/home.scm: Add Vala and GTK packages Required tools to start developing desktop GUI applications. Also enable the GNOME desktop environment, so that I can test the GTK application in its native environment. --- etc/guix/home.scm | 3 +++ etc/guix/system.scm | 2 ++ 2 files changed, 5 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index c2e7d50..d737e3c 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -462,6 +462,7 @@ rust rust:cargo rust:rustfmt + vala sbcl gcl @@ -491,6 +492,8 @@ gash nushell + gtk + st i3status xmessage diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 6f784b5..2a1f77c 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -70,6 +70,8 @@ (service docker-service-type) (service libvirt-service-type) (service virtlog-service-type) + (service gnome-desktop-service-type) + (service gnome-keyring-service-type) (service qemu-binfmt-service-type (qemu-binfmt-configuration (platforms -- cgit v1.2.3 From 72b06591f82efc1f954f7ff964e9ce66890ab77d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 11 Nov 2022 08:26:17 -0300 Subject: opt/aux/gen-e-list.sh: Fix path to dinheiros.ledger --- opt/aux/gen-e-list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opt/aux/gen-e-list.sh b/opt/aux/gen-e-list.sh index aa0951a..3d5ee4b 100755 --- a/opt/aux/gen-e-list.sh +++ b/opt/aux/gen-e-list.sh @@ -16,7 +16,7 @@ set -eu cat <<-EOF ~/dev/libre/package-repository/dependencies.dot - ~/dev/others/dinheiros/dinheiros.ledger + ~/dev/private/armário/src/dinheiros/dinheiros.ledger ~/dev/libre/dotfiles/sh/fake-symlinks.sh $XDG_CONFIG_HOME/guix/channels.scm $XDG_CONFIG_HOME/lisp-cli/init.lisp -- cgit v1.2.3 From 57e882273cbf6105fea19876e19d9bc4cfed0f14 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 11 Nov 2022 08:26:59 -0300 Subject: bin/menu: Notify after copying past clipboard value to clipboard --- bin/menu | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/menu b/bin/menu index 73091bd..90af758 100755 --- a/bin/menu +++ b/bin/menu @@ -125,6 +125,7 @@ case "$ACTION" in # For a potential improved version, see: # https://github.com/cdown/clipmenu/pull/162 clipmenu -i -l 20 -fn Monospace-18 -p "$1:" + notify-send -t 5000 -u low -- 'copied to clipboard' ;; yubikey) CHOICE="$(ykman oath accounts list | show 'OTP')" -- cgit v1.2.3 From e816d8f65397928c64b9aead5bb21c835a18c558 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 11 Nov 2022 08:30:21 -0300 Subject: etc/guix/home.scm: Add "telegram-desktop" package It is being downloaded from a substitute server. --- etc/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index d737e3c..ff43ac2 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -556,6 +556,7 @@ xbacklight + telegram-desktop zathura zathura-djvu zathura-pdf-poppler -- cgit v1.2.3 From aaa2680d5eab586e6c152a6f0b4a8d813574be1a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 11 Nov 2022 08:33:05 -0300 Subject: etc/guix/system.scm: Enable and configure velhinho<->kuvira WireGuard --- etc/guix/system.scm | 24 ++++++++++++++++++++++++ etc/ssh/known_hosts | 3 +++ 2 files changed, 27 insertions(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 2a1f77c..e6dddc2 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -11,6 +11,7 @@ (gnu services security-token) (gnu services sound) (gnu services virtualization) + (gnu services vpn) (gnu services xorg) (gnu system keyboard) (gnu system file-systems) @@ -40,6 +41,18 @@ (keyboard-layout (keyboard-layout "br" #:options '("caps:swapescape" "esperanto:qwerty"))) (host-name "velhinho") + (hosts-file + (plain-file + "hosts" + (format #f + #"- + 127.0.0.1 localhost ~a + ::1 localhost ~a + + 10.0.2.1 kuvira.wg + "# + host-name + host-name))) (users (append (list @@ -72,6 +85,17 @@ (service virtlog-service-type) (service gnome-desktop-service-type) (service gnome-keyring-service-type) + (service wireguard-service-type + (wireguard-configuration + (addresses '("10.0.2.2/24")) + (peers + (list + (wireguard-peer + (name "kuvira") + (endpoint "euandreh.xyz:51820") + (public-key "FwXqY9wXO8jK/D7lyprI+cslVeb9AqOQBAbxKG6S5lE=") + (allowed-ips '("10.0.2.1/32")) + (keep-alive 25)))))) (service qemu-binfmt-service-type (qemu-binfmt-configuration (platforms diff --git a/etc/ssh/known_hosts b/etc/ssh/known_hosts index c2c3d1e..2f63cf7 100644 --- a/etc/ssh/known_hosts +++ b/etc/ssh/known_hosts @@ -77,3 +77,6 @@ git.2f30.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSLZ4G5w4NysBUmAHmr6/V9om42IHS camarada.site ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 [127.0.0.1]:60022 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuoUWqrJ8WLBDWwWG7zCyYVYz1upMlg1mSXMGMHIVzY [localhost]:60022 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuoUWqrJ8WLBDWwWG7zCyYVYz1upMlg1mSXMGMHIVzY +[10.0.2.1]:23841 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +[kuvira.wg]:23841 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +kuvira.wg ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ -- cgit v1.2.3 From efb15af5bfb82e79235d9303b20ee6ee74e64c61 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 11 Nov 2022 08:34:46 -0300 Subject: etc/guix/system.scm: Enable OpenSSH service --- etc/guix/system.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index e6dddc2..5cb8c12 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -10,6 +10,7 @@ (gnu services pm) (gnu services security-token) (gnu services sound) + (gnu services ssh) (gnu services virtualization) (gnu services vpn) (gnu services xorg) @@ -105,6 +106,9 @@ (web-interface? #t) (extensions (list epson-L365)))) + (service openssh-service-type + (openssh-configuration + (password-authentication? #f))) #; (udev-rules-service 'backlight -- cgit v1.2.3 From e2800b2313cfb048a711bdc38fd1e5c05109006d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 11 Nov 2022 08:35:19 -0300 Subject: etc/guix/system.scm: Enable Xfce, MATE, LxQt and Enlightenment DEs --- etc/guix/system.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 5cb8c12..6e9e1b8 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -84,6 +84,10 @@ (service docker-service-type) (service libvirt-service-type) (service virtlog-service-type) + (service xfce-desktop-service-type) + (service mate-desktop-service-type) + (service lxqt-desktop-service-type) + (service enlightenment-desktop-service-type) (service gnome-desktop-service-type) (service gnome-keyring-service-type) (service wireguard-service-type -- cgit v1.2.3 From 65520daae094a4f30bc4fd476b5434cad2a4e6ea Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 11 Nov 2022 08:37:44 -0300 Subject: etc/guix/home.scm: Add GTK, Tk and Qt development packages --- etc/guix/home.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index ff43ac2..212a955 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -463,6 +463,7 @@ rust:cargo rust:rustfmt vala + tcl sbcl gcl @@ -493,6 +494,15 @@ nushell gtk + gtk:bin + gtk:doc + glade + ; libglade ; broken: conflicts with zathura + cambalache + tk + qtbase + qtbase:debug + qtdeclarative st i3status -- cgit v1.2.3 From 688ce869eb9e2efa287022e5de8005eba32a3d73 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 11 Nov 2022 10:56:18 -0300 Subject: etc/guix/home.scm: Add "icedove" package --- etc/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 212a955..3bf9f3e 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -580,6 +580,7 @@ libreoffice quodlibet ungoogled-chromium + icedove firefox)) (list msmtp-non-hardcoded ;; cmucl -- cgit v1.2.3 From 9e65133659eb92c65c730b83d68c81e9d2df4251 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 12 Nov 2022 00:53:21 -0300 Subject: Move email, IRC and Atom into Thunderbird --- Makefile | 38 +------ bin/m | 66 ------------ bin/mailcfg | 297 ---------------------------------------------------- bin/update | 1 - etc/guix/home.scm | 2 - etc/mailcaps/config | 1 - etc/sh/rc | 3 - 7 files changed, 1 insertion(+), 407 deletions(-) delete mode 100755 bin/m delete mode 100755 bin/mailcfg delete mode 100644 etc/mailcaps/config diff --git a/Makefile b/Makefile index a9df1f2..036eda9 100644 --- a/Makefile +++ b/Makefile @@ -16,14 +16,7 @@ derived-assets = \ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ $(XDG_CONFIG_HOME)/git/config-extra \ $(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf \ - $(XDG_CONFIG_HOME)/remhind/config \ $(XDG_CONFIG_HOME)/ssh/config \ - $(XDG_CONFIG_HOME)/alot/config \ - $(XDG_CONFIG_HOME)/mbsync/config \ - $(XDG_CONFIG_HOME)/msmtp/config \ - $(XDG_CONFIG_HOME)/notmuch/default/config \ - $(XDG_CONFIG_HOME)/notmuch/default/hooks/post-new \ - $(XDG_DATA_HOME)/euandreh/mailcfg-accounts.txt \ $(XDG_DATA_HOME)/common-lisp/source \ $(XDG_DATA_HOME)/euandreh/e.list.txt \ $(lisp-images) @@ -41,32 +34,10 @@ share/man/man1/z.1: bin/z $(XDG_DATA_HOME)/common-lisp/source: ln -s $(SRC)/libre $@ -$(XDG_CONFIG_HOME)/alot/config: bin/mailcfg - mailcfg alot > $@ - -$(XDG_CONFIG_HOME)/mbsync/config: bin/mailcfg - mailcfg mbsync > $@ - -$(XDG_CONFIG_HOME)/msmtp/config: bin/mailcfg - mailcfg msmtp > $@ - -$(XDG_CONFIG_HOME)/notmuch/default/config: bin/mailcfg - mailcfg notmuchcfg > $@ - -$(XDG_CONFIG_HOME)/notmuch/default/hooks/post-new: bin/mailcfg - mailcfg notmuchhook > $@ - chmod +x $@ - -$(XDG_DATA_HOME)/euandreh/mailcfg-accounts.txt: bin/mailcfg - mailcfg list > $@ - $(XDG_CONFIG_HOME)/ssh/id_rsa.pub: gpg --export-ssh-key eu@euandre.org > $@ chmod 600 $@ -$(XDG_CONFIG_HOME)/remhind/config: $(XDG_CONFIG_HOME)/remhind/config.tmpl - envsubst < $(XDG_CONFIG_HOME)/remhind/config.tmpl > $@ - $(XDG_CONFIG_HOME)/ssh/config: $(XDG_CONFIG_HOME)/ssh/config.tmpl envsubst < $(XDG_CONFIG_HOME)/ssh/config.tmpl > $@ @@ -114,13 +85,6 @@ check-dirty-public: exit 1; \ fi -check-dirty-private: - if ! git -C $(PRIV_CONFIG) diff --quiet || \ - ! git -C $(PRIV_CONFIG) diff --quiet --staged; then \ - printf 'Dirty private tilde repository.\n' >&2; \ - exit 1; \ - fi - check-opt: find opt/tests/ -name '*.sh' -exec {} + @@ -134,7 +98,7 @@ check-sync: fi check: check-shellcheck check-perlcritic check-fixme check-dirty-public \ - check-dirty-private check-opt check-pod check-sync + check-opt check-pod check-sync clean: rm -f $(derived-assets) diff --git a/bin/m b/bin/m deleted file mode 100755 index 6891128..0000000 --- a/bin/m +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - m - m -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - - Fetch email via IMAP and update the notmuch index. - - - Examples: - - Just fetch email - - $ m - EOF -} - - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -F="${XDG_DATA_HOME:-$HOME/.local/share}"/euandreh/mailcfg-accounts.txt - -notmuch new -xargs -I% -P "$(wc -l < "$F")" mbsync '%' < "$F" -notmuch new diff --git a/bin/mailcfg b/bin/mailcfg deleted file mode 100755 index f77355e..0000000 --- a/bin/mailcfg +++ /dev/null @@ -1,297 +0,0 @@ -#!/bin/sh -# shellcheck disable=1090,2153 -set -eu - -usage() { - cat <<-'EOF' - Usage: - mailcfg ACTION - mailcfg -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - ACTION one of: - - mbsync - - msmtp - - notmuchcfg - - notmuchhook - - alot - - list - - - Emit the generated configuration file for the chosen email - program. Get the configuration files from - $XDG_CONFIG_HOME/mailcfg/*.env, where every *.env file is a - shell script that defines the variables used in this program: - - $NAME - - $LABEL - - $IMAP - - $SMTP - - $ADDR - - One of the files also needs to define: - - $DEFAULT_NAME - - $DEFAULT_ADDR - - $DEFAULT_LABEL - - An example of such file could be "30-andre@work.com.env": - - #!/bin/sh - set -eu - - - NAME='André!' - LABEL='Work' - IMAP='imap.work.com' - SMTP='smtp.work.com' - ADDR='andre@work.com' - - - Examples: - - Get the alot configuration file: - - $ mailcfg alot - - - List the existing account labels: - - $ mailcfg list - EOF -} - - -for flag; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -ACTION="${1:-}" -eval "$(assert-arg "$ACTION" 'ACTION')" - -CFGDIR="${XDG_CONFIG_HOME:-$HOME/.config}/mailcfg" - - -mbsync() { - cat <<-'EOF' - SyncState * - Create Both - Expunge Both - Remove Both - Sync All - EOF - - for env in "$CFGDIR"/*.env; do - . "$env" - cat <<-EOF - - - ## $LABEL - - IMAPAccount $LABEL - Host $IMAP - User $ADDR - PassCmd "pass show $ADDR" - SSLType IMAPS - - IMAPStore ${LABEL}Remote - Account $LABEL - - MaildirStore ${LABEL}Local - Path ~/Maildir/$LABEL/ - Inbox ~/Maildir/$LABEL/INBOX - SubFolders Verbatim - - Channel ${LABEL}Folders - Far :${LABEL}Remote: - Near :${LABEL}Local: - Patterns * - - Group $LABEL - Channel ${LABEL}Folders - EOF - done -} - -msmtp() { - cat <<-EOF - defaults - auth on - tls on - port 587 - syslog on - logfile $XDG_LOG_HOME/msmtp.log - EOF - - for env in "$CFGDIR"/*.env; do - . "$env" - cat <<-EOF - - account $LABEL - host $SMTP - from $ADDR - user $ADDR - passwordeval pass show $ADDR - EOF - done - - cat <<-EOF - - account default : $DEFAULT_LABEL - EOF -} - -notmuchcfg() { - for env in "$CFGDIR"/*.env; do - . "$env" - done - - cat <<-EOF - [user] - name = $DEFAULT_NAME - primary_email = $DEFAULT_ADDR - EOF - - printf 'other_email = ' - for env in "$CFGDIR"/*.env; do - . "$env" - if [ "$ADDR" = "$DEFAULT_ADDR" ]; then - continue - fi - echo "$ADDR" - done | paste -sd';' - - cat <<-'EOF' - - [new] - tags = new; - ignore = .mbsyncstate;.uidvalidity - - [search] - exclude_tags = deleted;spam - - [maildir] - synchronize_flags = true - EOF -} - -notmuchhook() { - LABELS='' - for env in "$CFGDIR"/*.env; do - . "$env" - if [ -z "$LABELS" ]; then - LABELS="$LABEL" - else - LABELS="$LABELS $LABEL" - fi - done - sed \ - -e "s|@DIRS@|$LABELS|g" \ - -e "s|@DEFAULT_LABEL@|$DEFAULT_LABEL|g" \ - "$CFGDIR"/post-new -} - -alot() { - cat <<-'EOF' - attachment_prefix = "~/Downloads/" - - [bindings] - i = toggletags inbox - I = search folder:/INBOX/ AND NOT tag:killed AND NOT tag:archive - EOF - echo " - z archive - s spam - u unread - r keep - t track - " | while read -r l; do - if [ -z "$l" ]; then - continue - fi - LC="$( echo "$l" | cut -d' ' -f1)" - TAG="$(echo "$l" | cut -d' ' -f2)" - UC="$(echo "$LC" | tr '[:lower:]' '[:upper:]')" - cat <<-EOF - $LC = toggletags $TAG - $UC = search tag:$TAG AND NOT tag:killed - EOF - done - - cat <<-'EOF' - M = search folder:/lists/ AND NOT tag:killed - m = compose --tags inbox - [[thread]] - v = pipeto urlscan 2>/dev/null - V = pipeto 'gpg -d | less' - r = reply --all - R = reply - ' ' = fold; untag unread; move next unfolded - P = pipeto 'git am' - - [accounts] - EOF - - for env in "$CFGDIR"/*.env; do - . "$env" - cat <<-EOF - [[$LABEL]] - realname = $NAME - address = $ADDR - sendmail_command = msmtpq --account=$LABEL -t - sent_box = maildir://~/Maildir/$LABEL/Sent - draft_box = maildir://~/Maildir/$LABEL/Drafts - gpg_key = 5BDAE9B8B2F6C6BCBB0D6CE581F90EC3CD356060 - EOF - done -} - -list() { - for env in "$CFGDIR"/*.env; do - . "$env" - printf '%s\n' "$LABEL" - done -} - - -case "$ACTION" in - mbsync|msmtp|notmuchcfg|notmuchhook|alot|list) - "$1" - ;; - *) - printf 'Unsupported ACTION: "%s".\n\n' "$ACTION" >&2 - usage >&2 - exit 2 - ;; -esac diff --git a/bin/update b/bin/update index 11ac73d..26bd5c7 100755 --- a/bin/update +++ b/bin/update @@ -74,7 +74,6 @@ guix pull & wait rfc -u -newsboat -x reload repos -e ~/dev/go/ -e ~/dev/quicklisp/ -e ~/dev/archive/ ~/dev/ | xargs -I% -P4 x \ diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 3bf9f3e..79bb1c1 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -227,9 +227,7 @@ (define cronjobs (list - #~(job "0 0 * * *" "cronjob msmtp-queue -r") #~(job "0 0 * * *" "cronjob check") - #~(job "5 */6 * * *" "cronjob m") #~(job "30 0 * * *" "cronjob x update AND upgrade") #~(job "30 0 * * *" "cronjob backup -q cron"))) diff --git a/etc/mailcaps/config b/etc/mailcaps/config deleted file mode 100644 index 60f7286..0000000 --- a/etc/mailcaps/config +++ /dev/null @@ -1 +0,0 @@ -text/html; env HOME=$XDG_DATA_HOME/w3m w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput diff --git a/etc/sh/rc b/etc/sh/rc index 742975c..44e8efb 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -53,9 +53,7 @@ export GUILE_HISTORY="$XDG_STATE_HOME/guile-history" export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" export RLWRAP_HOME="$XDG_CACHE_HOME/rlwrap" export LESSHISTFILE="$XDG_STATE_HOME/lesshst" -export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/default/config" export PASSWORD_STORE_DIR="$SRC/private/password-store" -export MAILCAPS="$XDG_CONFIG_HOME/mailcaps/config" export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc.py" export EXINIT=' " set number @@ -108,7 +106,6 @@ unalias -a alias p='ping euandre.org -c 3' alias c='tmux send-keys -R \; clear-history' alias o='open' -alias mm='msmtp-queue -r' alias s='vcs status' alias d='vcs diff' alias ds='vcs diff -- --staged' -- cgit v1.2.3 From 908ab441cc95d7ac657bf285dbe63a4c270ec841 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 12 Nov 2022 07:33:36 -0300 Subject: bin/bins: Add -F option --- bin/bins | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/bins b/bin/bins index 1b28089..9f869de 100755 --- a/bin/bins +++ b/bin/bins @@ -4,7 +4,7 @@ set -eu usage() { cat <<-'EOF' Usage: - bins + bins [-F] bins -h EOF } @@ -13,6 +13,7 @@ help() { cat <<-'EOF' Options: + -F force remove the cache file -h, --help show this message @@ -45,8 +46,12 @@ for flag in "$@"; do esac done -while getopts 'h' flag; do +FORCE=false +while getopts 'Fh' flag; do case "$flag" in + F) + FORCE=true + ;; h) usage help @@ -62,6 +67,9 @@ shift $((OPTIND- 1)) F="$XDG_CACHE_HOME/euandreh/bins" +if [ "$FORCE" = true ]; then + rm -f "$F" +fi IFS=: # Word-splitting is the goal: -- cgit v1.2.3 From 3dcbe37baab74e089dee6f93d74a8824f5591478 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 12 Nov 2022 16:05:32 -0300 Subject: Revert "Move email, IRC and Atom into Thunderbird" This reverts commit 9e65133659eb92c65c730b83d68c81e9d2df4251. I'm still using msmtpq for git-send-email. So I'll have to work that out before removing *all* email configuration. --- Makefile | 38 ++++++- bin/m | 66 ++++++++++++ bin/mailcfg | 297 ++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/update | 1 + etc/guix/home.scm | 2 + etc/mailcaps/config | 1 + etc/sh/rc | 3 + 7 files changed, 407 insertions(+), 1 deletion(-) create mode 100755 bin/m create mode 100755 bin/mailcfg create mode 100644 etc/mailcaps/config diff --git a/Makefile b/Makefile index 036eda9..a9df1f2 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,14 @@ derived-assets = \ $(XDG_CONFIG_HOME)/ssh/id_rsa.pub \ $(XDG_CONFIG_HOME)/git/config-extra \ $(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf \ + $(XDG_CONFIG_HOME)/remhind/config \ $(XDG_CONFIG_HOME)/ssh/config \ + $(XDG_CONFIG_HOME)/alot/config \ + $(XDG_CONFIG_HOME)/mbsync/config \ + $(XDG_CONFIG_HOME)/msmtp/config \ + $(XDG_CONFIG_HOME)/notmuch/default/config \ + $(XDG_CONFIG_HOME)/notmuch/default/hooks/post-new \ + $(XDG_DATA_HOME)/euandreh/mailcfg-accounts.txt \ $(XDG_DATA_HOME)/common-lisp/source \ $(XDG_DATA_HOME)/euandreh/e.list.txt \ $(lisp-images) @@ -34,10 +41,32 @@ share/man/man1/z.1: bin/z $(XDG_DATA_HOME)/common-lisp/source: ln -s $(SRC)/libre $@ +$(XDG_CONFIG_HOME)/alot/config: bin/mailcfg + mailcfg alot > $@ + +$(XDG_CONFIG_HOME)/mbsync/config: bin/mailcfg + mailcfg mbsync > $@ + +$(XDG_CONFIG_HOME)/msmtp/config: bin/mailcfg + mailcfg msmtp > $@ + +$(XDG_CONFIG_HOME)/notmuch/default/config: bin/mailcfg + mailcfg notmuchcfg > $@ + +$(XDG_CONFIG_HOME)/notmuch/default/hooks/post-new: bin/mailcfg + mailcfg notmuchhook > $@ + chmod +x $@ + +$(XDG_DATA_HOME)/euandreh/mailcfg-accounts.txt: bin/mailcfg + mailcfg list > $@ + $(XDG_CONFIG_HOME)/ssh/id_rsa.pub: gpg --export-ssh-key eu@euandre.org > $@ chmod 600 $@ +$(XDG_CONFIG_HOME)/remhind/config: $(XDG_CONFIG_HOME)/remhind/config.tmpl + envsubst < $(XDG_CONFIG_HOME)/remhind/config.tmpl > $@ + $(XDG_CONFIG_HOME)/ssh/config: $(XDG_CONFIG_HOME)/ssh/config.tmpl envsubst < $(XDG_CONFIG_HOME)/ssh/config.tmpl > $@ @@ -85,6 +114,13 @@ check-dirty-public: exit 1; \ fi +check-dirty-private: + if ! git -C $(PRIV_CONFIG) diff --quiet || \ + ! git -C $(PRIV_CONFIG) diff --quiet --staged; then \ + printf 'Dirty private tilde repository.\n' >&2; \ + exit 1; \ + fi + check-opt: find opt/tests/ -name '*.sh' -exec {} + @@ -98,7 +134,7 @@ check-sync: fi check: check-shellcheck check-perlcritic check-fixme check-dirty-public \ - check-opt check-pod check-sync + check-dirty-private check-opt check-pod check-sync clean: rm -f $(derived-assets) diff --git a/bin/m b/bin/m new file mode 100755 index 0000000..6891128 --- /dev/null +++ b/bin/m @@ -0,0 +1,66 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + m + m -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + Fetch email via IMAP and update the notmuch index. + + + Examples: + + Just fetch email + + $ m + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +F="${XDG_DATA_HOME:-$HOME/.local/share}"/euandreh/mailcfg-accounts.txt + +notmuch new +xargs -I% -P "$(wc -l < "$F")" mbsync '%' < "$F" +notmuch new diff --git a/bin/mailcfg b/bin/mailcfg new file mode 100755 index 0000000..f77355e --- /dev/null +++ b/bin/mailcfg @@ -0,0 +1,297 @@ +#!/bin/sh +# shellcheck disable=1090,2153 +set -eu + +usage() { + cat <<-'EOF' + Usage: + mailcfg ACTION + mailcfg -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + ACTION one of: + - mbsync + - msmtp + - notmuchcfg + - notmuchhook + - alot + - list + + + Emit the generated configuration file for the chosen email + program. Get the configuration files from + $XDG_CONFIG_HOME/mailcfg/*.env, where every *.env file is a + shell script that defines the variables used in this program: + - $NAME + - $LABEL + - $IMAP + - $SMTP + - $ADDR + + One of the files also needs to define: + - $DEFAULT_NAME + - $DEFAULT_ADDR + - $DEFAULT_LABEL + + An example of such file could be "30-andre@work.com.env": + + #!/bin/sh + set -eu + + + NAME='André!' + LABEL='Work' + IMAP='imap.work.com' + SMTP='smtp.work.com' + ADDR='andre@work.com' + + + Examples: + + Get the alot configuration file: + + $ mailcfg alot + + + List the existing account labels: + + $ mailcfg list + EOF +} + + +for flag; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +ACTION="${1:-}" +eval "$(assert-arg "$ACTION" 'ACTION')" + +CFGDIR="${XDG_CONFIG_HOME:-$HOME/.config}/mailcfg" + + +mbsync() { + cat <<-'EOF' + SyncState * + Create Both + Expunge Both + Remove Both + Sync All + EOF + + for env in "$CFGDIR"/*.env; do + . "$env" + cat <<-EOF + + + ## $LABEL + + IMAPAccount $LABEL + Host $IMAP + User $ADDR + PassCmd "pass show $ADDR" + SSLType IMAPS + + IMAPStore ${LABEL}Remote + Account $LABEL + + MaildirStore ${LABEL}Local + Path ~/Maildir/$LABEL/ + Inbox ~/Maildir/$LABEL/INBOX + SubFolders Verbatim + + Channel ${LABEL}Folders + Far :${LABEL}Remote: + Near :${LABEL}Local: + Patterns * + + Group $LABEL + Channel ${LABEL}Folders + EOF + done +} + +msmtp() { + cat <<-EOF + defaults + auth on + tls on + port 587 + syslog on + logfile $XDG_LOG_HOME/msmtp.log + EOF + + for env in "$CFGDIR"/*.env; do + . "$env" + cat <<-EOF + + account $LABEL + host $SMTP + from $ADDR + user $ADDR + passwordeval pass show $ADDR + EOF + done + + cat <<-EOF + + account default : $DEFAULT_LABEL + EOF +} + +notmuchcfg() { + for env in "$CFGDIR"/*.env; do + . "$env" + done + + cat <<-EOF + [user] + name = $DEFAULT_NAME + primary_email = $DEFAULT_ADDR + EOF + + printf 'other_email = ' + for env in "$CFGDIR"/*.env; do + . "$env" + if [ "$ADDR" = "$DEFAULT_ADDR" ]; then + continue + fi + echo "$ADDR" + done | paste -sd';' + + cat <<-'EOF' + + [new] + tags = new; + ignore = .mbsyncstate;.uidvalidity + + [search] + exclude_tags = deleted;spam + + [maildir] + synchronize_flags = true + EOF +} + +notmuchhook() { + LABELS='' + for env in "$CFGDIR"/*.env; do + . "$env" + if [ -z "$LABELS" ]; then + LABELS="$LABEL" + else + LABELS="$LABELS $LABEL" + fi + done + sed \ + -e "s|@DIRS@|$LABELS|g" \ + -e "s|@DEFAULT_LABEL@|$DEFAULT_LABEL|g" \ + "$CFGDIR"/post-new +} + +alot() { + cat <<-'EOF' + attachment_prefix = "~/Downloads/" + + [bindings] + i = toggletags inbox + I = search folder:/INBOX/ AND NOT tag:killed AND NOT tag:archive + EOF + echo " + z archive + s spam + u unread + r keep + t track + " | while read -r l; do + if [ -z "$l" ]; then + continue + fi + LC="$( echo "$l" | cut -d' ' -f1)" + TAG="$(echo "$l" | cut -d' ' -f2)" + UC="$(echo "$LC" | tr '[:lower:]' '[:upper:]')" + cat <<-EOF + $LC = toggletags $TAG + $UC = search tag:$TAG AND NOT tag:killed + EOF + done + + cat <<-'EOF' + M = search folder:/lists/ AND NOT tag:killed + m = compose --tags inbox + [[thread]] + v = pipeto urlscan 2>/dev/null + V = pipeto 'gpg -d | less' + r = reply --all + R = reply + ' ' = fold; untag unread; move next unfolded + P = pipeto 'git am' + + [accounts] + EOF + + for env in "$CFGDIR"/*.env; do + . "$env" + cat <<-EOF + [[$LABEL]] + realname = $NAME + address = $ADDR + sendmail_command = msmtpq --account=$LABEL -t + sent_box = maildir://~/Maildir/$LABEL/Sent + draft_box = maildir://~/Maildir/$LABEL/Drafts + gpg_key = 5BDAE9B8B2F6C6BCBB0D6CE581F90EC3CD356060 + EOF + done +} + +list() { + for env in "$CFGDIR"/*.env; do + . "$env" + printf '%s\n' "$LABEL" + done +} + + +case "$ACTION" in + mbsync|msmtp|notmuchcfg|notmuchhook|alot|list) + "$1" + ;; + *) + printf 'Unsupported ACTION: "%s".\n\n' "$ACTION" >&2 + usage >&2 + exit 2 + ;; +esac diff --git a/bin/update b/bin/update index 26bd5c7..11ac73d 100755 --- a/bin/update +++ b/bin/update @@ -74,6 +74,7 @@ guix pull & wait rfc -u +newsboat -x reload repos -e ~/dev/go/ -e ~/dev/quicklisp/ -e ~/dev/archive/ ~/dev/ | xargs -I% -P4 x \ diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 79bb1c1..3bf9f3e 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -227,7 +227,9 @@ (define cronjobs (list + #~(job "0 0 * * *" "cronjob msmtp-queue -r") #~(job "0 0 * * *" "cronjob check") + #~(job "5 */6 * * *" "cronjob m") #~(job "30 0 * * *" "cronjob x update AND upgrade") #~(job "30 0 * * *" "cronjob backup -q cron"))) diff --git a/etc/mailcaps/config b/etc/mailcaps/config new file mode 100644 index 0000000..60f7286 --- /dev/null +++ b/etc/mailcaps/config @@ -0,0 +1 @@ +text/html; env HOME=$XDG_DATA_HOME/w3m w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput diff --git a/etc/sh/rc b/etc/sh/rc index 44e8efb..742975c 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -53,7 +53,9 @@ export GUILE_HISTORY="$XDG_STATE_HOME/guile-history" export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" export RLWRAP_HOME="$XDG_CACHE_HOME/rlwrap" export LESSHISTFILE="$XDG_STATE_HOME/lesshst" +export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/default/config" export PASSWORD_STORE_DIR="$SRC/private/password-store" +export MAILCAPS="$XDG_CONFIG_HOME/mailcaps/config" export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc.py" export EXINIT=' " set number @@ -106,6 +108,7 @@ unalias -a alias p='ping euandre.org -c 3' alias c='tmux send-keys -R \; clear-history' alias o='open' +alias mm='msmtp-queue -r' alias s='vcs status' alias d='vcs diff' alias ds='vcs diff -- --staged' -- cgit v1.2.3 From 498178c29c1f721c6e151b89005e3a30e8520f08 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 13 Nov 2022 15:02:48 -0300 Subject: bin/rfc: Fix usage of assert-arg(1) --- bin/rfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/rfc b/bin/rfc index bd8fb67..9c71ebc 100755 --- a/bin/rfc +++ b/bin/rfc @@ -133,7 +133,7 @@ if [ "${UPDATE:-}" = true ]; then exit fi -eval "$(assert-arg "$RFC_NUMBER")" +eval "$(assert-arg "$RFC_NUMBER" 'RFC_NUMBER')" if [ ! -e "$F" ]; then printf 'Given RFC_NUMBER "%s" does not exist at:\n%s\n' \ -- cgit v1.2.3 From 1517a45c05a30c2cde405dc0232554791b162ccb Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 13 Nov 2022 16:23:09 -0300 Subject: etc/guix/home.scm: Add "gnote" package --- etc/guix/home.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 3bf9f3e..a0773c1 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -566,6 +566,7 @@ xbacklight + gnote telegram-desktop zathura zathura-djvu -- cgit v1.2.3 From 58a29c5742e7d056316833ba9dd56544bf1ffb3b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 13 Nov 2022 22:01:01 -0300 Subject: etc/guix/system.scm: Use list literal over using (list ...) --- etc/guix/system.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index 6e9e1b8..f2d389f 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -175,7 +175,7 @@ (bootloader (bootloader-configuration (bootloader grub-efi-bootloader) - (targets (list "/boot/efi")) + (targets '("/boot/efi")) (keyboard-layout keyboard-layout))) (mapped-devices (list -- cgit v1.2.3 From 4c125cc227f954e61d0c41e8cd166e64fbb5afc3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 15 Nov 2022 08:05:18 -0300 Subject: Revert "etc/sh/rc: Remove ~/.bashrc symlink" This reverts commit 8112f1be52f61ccee08d70d9928b562a0f2f2e08. Launching a new "guix shell" or a new st instance doesn't load .profile, but .bashrc instead. --- etc/sh/rc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/sh/rc b/etc/sh/rc index 742975c..03b7637 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -328,6 +328,8 @@ if [ -z "$BASH_VERSION" ]; then return fi +ln -fs .profile ~/.bashrc + export INPUTRC="$XDG_CONFIG_HOME/bash/inputrc" export HISTCONTROL=ignorespace:ignoredups -- cgit v1.2.3 From 1d4a56ae4ffde87c5396171708722a3f7689c4a2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 15 Nov 2022 09:22:45 -0300 Subject: Revert "etc/guix/home.scm: Add remhind (home-service ...)" This reverts commit 1fcc6d84829d100f29c718af205f8413bf833707. --- etc/guix/home.scm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index a0773c1..a6c222c 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -32,8 +32,7 @@ (guix git-download) (guix modules) (guix packages) - (guix utils) - (xyz euandreh queue)) + (guix utils)) (heredoc:enable-syntax) (define-public hunspell-iconv @@ -604,7 +603,6 @@ (service (home-service 'clipmenu clipmenu "/bin/clipmenud")) (service (home-service 'dunst dunst "/bin/dunst")) (service (home-service 'poweralertd poweralertd "/bin/poweralertd")) - (service (home-service 'remhind remhind "/bin/remhind")) (service home-xdg-base-directories-service-type (home-xdg-base-directories-configuration (cache-home (xdg "var/cache")) -- cgit v1.2.3 From 282d517b4777899a99ab4ce41e36ef12237a9e6c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 16 Nov 2022 17:20:53 -0300 Subject: etc/ssh/known_hosts: Change remote key for arrobaponto.org --- etc/ssh/known_hosts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/etc/ssh/known_hosts b/etc/ssh/known_hosts index 2f63cf7..823aad7 100644 --- a/etc/ssh/known_hosts +++ b/etc/ssh/known_hosts @@ -55,19 +55,15 @@ git.euandreh.xyz ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHA 95.179.253.243 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ 95.179.163.103 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ 217.69.2.177 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -arrobaponto.org,104.238.167.189 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= 104.238.176.81 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= -git.arrobaponto.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= 173.199.70.52 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhpYZqFXy4CkOrSg5naR5Any47jqgZUIwbiTvsl2Yhm5EiUtCZTIVHui7q262M5qlDY6syQ5lVMtSsLJuTce+I= [remembering.euandreh.xyz]:23841 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ 167.71.86.194 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCXg/l/grol/OAY95VphKbVn4yXUStSWpxQjnka7PWXzWyForfX+fpmY+p72r1Uimx5oXIFISt8uSZW/tvD61iQ= [localhost]:10022 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLHACdQJXUj5e4Znyh7KdTjB1RLznSfStRw6cuHZlu8rhANVfkjt300Fum9Jv6yLra6W4v2FLALWfcYpOlUzt9c= 107.191.63.70 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMONpsqwH79f/MsjtsOPitT5C+3hPPJqVh42oHMKOen6 217.69.11.49 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr -[arrobaponto.org]:23213 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKbzWSlFwmlrC+k6XU9eUJaejREGxTF03OX/mT7KhSr anoncvs.netbsd.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA3QiBl8leG9fqIJpKeNov0PKq5YryFFiroMWOPUv4hDFn8R0jC07YVaR/OSBrr37CTmGX5AFceXPzoFnLlwCqWR7rXg4NR75FTlTp9CG9EBAEtU8mee27KDrUFBTZdfVl2+aRYoAI5fTXA+0vpIO68Cq843vRWUZCcwinS4cNLUU= git.2f30.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSLZ4G5w4NysBUmAHmr6/V9om42IHSUCtqrNdhWoYQ0 -[arrobaponto.org]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 [199.247.13.53]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 [2001:19f0:6801:988:5400:3ff:fea1:b566]:38123 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3TdYy2ccEDpS7Z4 [gerrit.wikimedia.org]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCF8pwFLehzCXhbF1jfHWtd9d1LFq2NirplEBQYs7AOrGwQ/6ZZI0gvZFYiEiaw1o+F1CMfoHdny1VfWOJF3mJ1y9QMKAacc8/Z3tG39jBKRQCuxmYLO1SWymv7/Uvx9WQlkNRoTdTTa9OJFy6UqvLQEXKYaokfMIUHZ+oVFf1CgQ== @@ -80,3 +76,5 @@ camarada.site ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3 [10.0.2.1]:23841 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ [kuvira.wg]:23841 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ kuvira.wg ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ +216.238.68.100 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKF5klRzMiaDhfFv7vj6nIT2BdjbcgpsmnNT3y/X9oUu +arrobaponto.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKF5klRzMiaDhfFv7vj6nIT2BdjbcgpsmnNT3y/X9oUu -- cgit v1.2.3 From 9c8f9bbcaa958dee90f078053b3ca794f1a46f5e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 16 Nov 2022 17:21:21 -0300 Subject: etc/guix/home.scm: Disable broken "rust" package --- etc/guix/home.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index a6c222c..31b3cd2 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -458,9 +458,9 @@ arandr openssl fswatch - rust - rust:cargo - rust:rustfmt + ;; rust ; broken + ;; rust:cargo ; broken + ;; rust:rustfmt ; broken vala tcl -- cgit v1.2.3 From bfa17bd836264bd9b573ea96afc854e72a2f137a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 16 Nov 2022 17:21:45 -0300 Subject: etc/guix/home.scm: Add "rpm" and "cpio" packages Those were useful when iterating on the epson-L365 package, that was built from source from an RPM file. --- etc/guix/home.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 31b3cd2..fc9f2b5 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -399,6 +399,8 @@ xpdf perf-tools scdoc + rpm + cpio ;; for compiling ECL libatomic-ops -- cgit v1.2.3 From ad3009dd76de7e297cf8124650d27a51aa843dec Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 16 Nov 2022 17:37:34 -0300 Subject: etc/ssh/known_hosts: Add velhinho's localhost keys --- etc/ssh/known_hosts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/ssh/known_hosts b/etc/ssh/known_hosts index 823aad7..fa1b43a 100644 --- a/etc/ssh/known_hosts +++ b/etc/ssh/known_hosts @@ -78,3 +78,7 @@ camarada.site ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoz1gFl6chY91vQ5SrZXSP5yHqRI3 kuvira.wg ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvhhXQBEY9GhWOtBoLpDJRjqHAu7ci2A9l1xoet1Cz/ 216.238.68.100 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKF5klRzMiaDhfFv7vj6nIT2BdjbcgpsmnNT3y/X9oUu arrobaponto.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKF5klRzMiaDhfFv7vj6nIT2BdjbcgpsmnNT3y/X9oUu +10.0.2.2 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII9jxIXM2FSYeZmY2uLWkQUJQLNIQQJyJdc7P4eEPhEU +velhinho ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII9jxIXM2FSYeZmY2uLWkQUJQLNIQQJyJdc7P4eEPhEU +velhinho.wg ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII9jxIXM2FSYeZmY2uLWkQUJQLNIQQJyJdc7P4eEPhEU +localhost ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII9jxIXM2FSYeZmY2uLWkQUJQLNIQQJyJdc7P4eEPhEU -- cgit v1.2.3 From cac1db89d774686d79873926687aa24065552d68 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 16 Nov 2022 17:47:42 -0300 Subject: Manage the Guix System without using root login --- bin/update | 12 +----------- bin/upgrade | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/bin/update b/bin/update index 11ac73d..cc2412e 100755 --- a/bin/update +++ b/bin/update @@ -63,18 +63,8 @@ done shift $((OPTIND - 1)) -guix pull & - -{ - pass show velhinho/0-andreh-password | - head -n1 | - sudo -iS guix pull -} & - -wait - +guix pull rfc -u -newsboat -x reload repos -e ~/dev/go/ -e ~/dev/quicklisp/ -e ~/dev/archive/ ~/dev/ | xargs -I% -P4 x \ diff --git a/bin/upgrade b/bin/upgrade index 52c019e..4447a3d 100755 --- a/bin/upgrade +++ b/bin/upgrade @@ -62,5 +62,5 @@ shift $((OPTIND - 1)) pass show velhinho/0-andreh-password | head -n1 | - sudo -iS guix system -v3 reconfigure /etc/guix/configuration.scm + sudo -ES guix system -v3 reconfigure /etc/guix/configuration.scm guix home -v3 reconfigure "$XDG_CONFIG_HOME"/guix/home.scm -- cgit v1.2.3 From d4177f0c52023731ef3d5bc23c0c7a120c1cf569 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 16 Nov 2022 17:48:17 -0300 Subject: etc/guix/system.scm: Add id_rsa.pub as authorized key --- etc/guix/system.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index f2d389f..fba8be0 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -112,7 +112,12 @@ (list epson-L365)))) (service openssh-service-type (openssh-configuration - (password-authentication? #f))) + (password-authentication? #f) + (authorized-keys + `(("andreh" ,(local-file + (string-append (or (getenv "XDG_CONFIG_HOME") + (string-append (getenv "HOME") "/.ssh")) + "/ssh/id_rsa.pub"))))))) #; (udev-rules-service 'backlight -- cgit v1.2.3 From 8594f13a321fb85834c7f3669d15a6892e9ebc3d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 16 Nov 2022 17:51:48 -0300 Subject: etc/guix/system.scm: Add velhinho.wg entry to /etc/hosts --- etc/guix/system.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index fba8be0..e3bdc5a 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -51,6 +51,7 @@ ::1 localhost ~a 10.0.2.1 kuvira.wg + 10.0.2.2 velhinho.wg "# host-name host-name))) -- cgit v1.2.3 From 35a2169a3b6cd80a974daf5d92072a214d93d106 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 16 Nov 2022 18:03:18 -0300 Subject: etc/guix/system.scm: Add network instability tolerance to OpenSSH daemon --- etc/guix/system.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/etc/guix/system.scm b/etc/guix/system.scm index e3bdc5a..fddadca 100644 --- a/etc/guix/system.scm +++ b/etc/guix/system.scm @@ -118,7 +118,12 @@ `(("andreh" ,(local-file (string-append (or (getenv "XDG_CONFIG_HOME") (string-append (getenv "HOME") "/.ssh")) - "/ssh/id_rsa.pub"))))))) + "/ssh/id_rsa.pub"))))) + (extra-content #"- + ClientAliveInterval 30 + ClientAliveCountMax 20 + MaxSessions 20 + "#))) #; (udev-rules-service 'backlight -- cgit v1.2.3 From a317496a280d37bdc59270b6b84ede73835c3d79 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 16 Nov 2022 21:29:25 -0300 Subject: etc/sh/root-rc: Fix ShellCheck warnings --- etc/sh/root-rc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/sh/root-rc b/etc/sh/root-rc index a803b11..f78f293 100644 --- a/etc/sh/root-rc +++ b/etc/sh/root-rc @@ -1,3 +1,5 @@ +#!/bin/sh +# shellcheck disable=1090,1091 export ENV=~/.profile XDG_PREFIX=~/.usr @@ -63,10 +65,12 @@ error_marker() { } shell_level() { + # shellcheck disable=3028 + L="${SHLVL:-1}" if [ -n "${TMUX:-}" ]; then - LVL=$((SHLVL - 1)) + LVL=$((L - 1)) else - LVL="$SHLVL" + LVL="$L" fi if [ "$LVL" != 1 ]; then printf '[%s] ' "$LVL" -- cgit v1.2.3 From 4bca0936e8f0145d80801159d6d09d2059a6a4f8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 17 Nov 2022 11:30:37 -0300 Subject: Use opt/bin-dirs/ as a registry of extra manual bin directories --- etc/sh/rc | 4 ++++ opt/bin-dirs/euandre.org | 1 + 2 files changed, 5 insertions(+) create mode 120000 opt/bin-dirs/euandre.org diff --git a/etc/sh/rc b/etc/sh/rc index 03b7637..ae552a6 100644 --- a/etc/sh/rc +++ b/etc/sh/rc @@ -97,6 +97,10 @@ export PREFIX="$XDG_PREFIX/var/mkg" add_prefix "$PREFIX" add_prefix "$XDG_PREFIX" +for d in "$XDG_PREFIX"/opt/bin-dirs/*; do + PATH="$d:$PATH" +done + # diff --git a/opt/bin-dirs/euandre.org b/opt/bin-dirs/euandre.org new file mode 120000 index 0000000..db5a280 --- /dev/null +++ b/opt/bin-dirs/euandre.org @@ -0,0 +1 @@ +/home/andreh/dev/published/euandre.org/src/bin \ No newline at end of file -- cgit v1.2.3 From 3637e8adc4f96dc6971475c4715ff898ed34cc52 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 17 Nov 2022 11:51:37 -0300 Subject: Makefile: Exclude symlinks from "git ls-files" listing --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index a9df1f2..9907b46 100644 --- a/Makefile +++ b/Makefile @@ -90,11 +90,13 @@ $(lisp-images): $(XDG_CONFIG_HOME)/lisp-cli/init.lisp bin/cl bin/li check-shellcheck: git ls-files | \ + sor 'test -f' | \ xargs awk '/^#!\/bin\/sh$$/ { print FILENAME } { nextfile }' | \ xargs shellcheck -x check-perlcritic: git ls-files | \ + sor 'test -f' | \ xargs awk '/^#!\/usr\/bin\/env perl$$/ { print FILENAME } { nextfile }' | \ xargs perlcritic --exclude=subroutine -- cgit v1.2.3 From a27320f0e57aa246bdf4bbfdefb997d0d97102ae Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 17 Nov 2022 14:46:35 -0300 Subject: etc/lisp-cli/init.lisp: Load enable verbose quicklisp mode --- etc/lisp-cli/init.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/lisp-cli/init.lisp b/etc/lisp-cli/init.lisp index 062446e..75f5540 100644 --- a/etc/lisp-cli/init.lisp +++ b/etc/lisp-cli/init.lisp @@ -11,7 +11,7 @@ (string p)) "KEYWORD"))) (unless (member k *features*) - (ql:quickload p) + (ql:quickload p :verbose t) (pushnew k *features*)) k)) -- cgit v1.2.3 From 57ea12b9c55b495893d3a7e5d15b87fa5bebef40 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 17 Nov 2022 15:40:58 -0300 Subject: etc/lisp-cli/init.lisp: Enable verbose QuickLisp mode by default --- etc/lisp-cli/init.lisp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/lisp-cli/init.lisp b/etc/lisp-cli/init.lisp index 75f5540..69cb054 100644 --- a/etc/lisp-cli/init.lisp +++ b/etc/lisp-cli/init.lisp @@ -4,6 +4,8 @@ (when (probe-file quicklisp-init) (load quicklisp-init))) +(setf ql:*quickload-verbose* t) + (defun load-once (p) (let ((k (intern (concatenate 'string -- cgit v1.2.3 From 7eb9385dda5c5bcffd9ad7423fb56b3aac2dc572 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 17 Nov 2022 15:55:22 -0300 Subject: opt/bin-dirs/clisp: Include custom build of CLISP Specifically, a build that supports package-local nicknames. --- opt/bin-dirs/clisp | 1 + 1 file changed, 1 insertion(+) create mode 120000 opt/bin-dirs/clisp diff --git a/opt/bin-dirs/clisp b/opt/bin-dirs/clisp new file mode 120000 index 0000000..56fe4cc --- /dev/null +++ b/opt/bin-dirs/clisp @@ -0,0 +1 @@ +/home/andreh/dev/misc/common-lisp/clisp/src \ No newline at end of file -- cgit v1.2.3