From bfacb51e73feda2a98169d3a5ba6db1daa3d96cb Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Sat, 13 Apr 2024 01:55:48 -0400 Subject: [PATCH 01/32] docs(README): update some links and add an example nektos/act command --- README.md | 8 ++++++-- README.md.tpl | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 84ba28a5..36409359 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,10 @@ To run a specific job: gh act --rm -j lint -W .github/workflows/pre-commit.yml +To run jobs that use `actions/upload-artifact` and `actions/download-artifact`: + + gh act --artifact-server-path /tmp/artifacts -W .github/workflows/pre-commit.yml + ### Local `pre-commit` linting If `pip` is installed, `make pre-commit` will run all `pre-commit` hooks on all changed files. Note, however, that the `pre-commit` linting is a @@ -116,6 +120,6 @@ done ``` -[install `gh`]: https://github.com/cli/cli#installation -[install `nektos/act`]: https://github.com/nektos/act#installation +[install `gh`]: https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt +[install `nektos/act`]: https://nektosact.com/installation/gh.html [install docker]: https://docs.docker.com/get-docker/ diff --git a/README.md.tpl b/README.md.tpl index 7589d7f6..f87e1167 100644 --- a/README.md.tpl +++ b/README.md.tpl @@ -61,6 +61,10 @@ To run a specific job: gh act --rm -j lint -W .github/workflows/pre-commit.yml +To run jobs that use `actions/upload-artifact` and `actions/download-artifact`: + + gh act --artifact-server-path /tmp/artifacts -W .github/workflows/pre-commit.yml + ### Local `pre-commit` linting If `pip` is installed, `make pre-commit` will run all `pre-commit` hooks on all changed files. Note, however, that the `pre-commit` linting is a @@ -89,6 +93,6 @@ done ``` -[install `gh`]: https://github.com/cli/cli#installation -[install `nektos/act`]: https://github.com/nektos/act#installation +[install `gh`]: https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt +[install `nektos/act`]: https://nektosact.com/installation/gh.html [install docker]: https://docs.docker.com/get-docker/ From d651425cc086a597ab9adb5d8a7a721ac17b296c Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Sat, 13 Apr 2024 02:03:09 -0400 Subject: [PATCH 02/32] chore: update actions/setup-python to v5.1.0 --- .github/workflows/pre-commit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 2cae6250..b2b19028 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -152,7 +152,7 @@ jobs: check-latest: true - name: Install python - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: '3.11' @@ -174,7 +174,7 @@ jobs: fetch-depth: $CHECKOUT_DEPTH - name: Install python - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: '3.11' From 5dc7651b205a48e982d02ce24d9f9fc5aeea31bc Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Sat, 13 Apr 2024 02:38:36 -0400 Subject: [PATCH 03/32] feat: remove paths requirements for Actions triggers --- .github/workflows/pre-commit.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index b2b19028..5e43ffd6 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -22,13 +22,7 @@ on: branches: - $GITHUB_BASE_REF #if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) - paths: - - '.github/workflows/pre-commit.yml' - - '.pre-commit-config.yaml' pull_request: - paths: - - '.github/workflows/pre-commit.yml' - - '.pre-commit-config.yaml' # from the example here: # https://docs.github.com/en/actions/examples/using-scripts-to-test-your-code-on-a-runner#example-workflow From f770798765897a1f4f6d44b1691fb727e166c677 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Sat, 13 Apr 2024 02:39:04 -0400 Subject: [PATCH 04/32] feat: update pre-commit action version --- .github/workflows/pre-commit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 5e43ffd6..56d0cc15 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -151,7 +151,7 @@ jobs: python-version: '3.11' - name: Run pre-commit on all files - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0 + uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 with: # this should run the pre-commit hooks only on the files changed between the default branch and the one in the PR extra_args: --verbose -a @@ -173,7 +173,7 @@ jobs: python-version: '3.11' - name: Run pre-commit - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0 + uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 with: # this should run the pre-commit hooks only on the files changed between the default branch and the one in the PR extra_args: --verbose --from-ref ${{ needs.get-changed-files.outputs.BASE_REF }} --to-ref HEAD From 039459d1c4c429abac4793a85832fb78ac63a08c Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Sat, 13 Apr 2024 02:48:02 -0400 Subject: [PATCH 05/32] feat: grant MegaLinter permission to write to PRs --- .github/workflows/pre-commit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 56d0cc15..9acf2a00 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -95,6 +95,8 @@ jobs: lint: runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 env: From 26266d35548bce2406a8317997e93e78aec1199f Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Fri, 19 Apr 2024 23:03:39 -0400 Subject: [PATCH 06/32] feat: add alternative theme changer script --- etc/pm/sleep.d/10_change_theme | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 etc/pm/sleep.d/10_change_theme diff --git a/etc/pm/sleep.d/10_change_theme b/etc/pm/sleep.d/10_change_theme new file mode 100755 index 00000000..53d688d0 --- /dev/null +++ b/etc/pm/sleep.d/10_change_theme @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# this must be copied to /etc/pm/sleep.d/ + +PM_ACTION="${1}" +DARK_THEME='Yaru-viridian-dark' +LIGHT_THEME='Yaru-viridian' +DARK_START=18 +DARK_STOP=7 +export DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/1000/bus' + +echo "running $0" >>/tmp/theme.log +# set the dark theme if run during the dark theme hours + +# normally, cron should run this file +# if this file is in /etc/pm/sleep.d/, this will also trigger when waking from sleep/hibernation +if [[ + "${PM_ACTION}" =~ ^(thaw|resume)$ || + -z "${PM_ACTION}" + ]]; then + if [[ + "$(date +%H)" -ge "${DARK_START}" || + "$(date +%H)" -lt "${DARK_STOP}" + ]]; then + echo gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' >>/tmp/theme.log + echo gsettings set org.gnome.desktop.interface gtk-theme "${DARK_THEME}" >>/tmp/theme.log + echo gsettings set org.gnome.gedit.preferences.editor scheme "${DARK_THEME}" >>/tmp/theme.log + gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' + gsettings set org.gnome.desktop.interface gtk-theme "${DARK_THEME}" + gsettings set org.gnome.gedit.preferences.editor scheme "${DARK_THEME}" + else + echo gsettings set org.gnome.desktop.interface color-scheme 'prefer-light' >>/tmp/theme.log + echo gsettings set org.gnome.desktop.interface gtk-theme "${LIGHT_THEME}" >>/tmp/theme.log + echo gsettings set org.gnome.gedit.preferences.editor scheme "${LIGHT_THEME}" >>/tmp/theme.log + gsettings set org.gnome.desktop.interface color-scheme 'prefer-light' + gsettings set org.gnome.desktop.interface gtk-theme "${LIGHT_THEME}" + gsettings set org.gnome.gedit.preferences.editor scheme "${LIGHT_THEME}" + fi +fi From b6e40a7babdbcb08238a938c54468793fbfd493f Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Fri, 19 Apr 2024 23:04:52 -0400 Subject: [PATCH 07/32] refactor: update theme changer script for efficiency and accuracy --- etc/pm/sleep.d/10_change_theme | 73 ++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 17 deletions(-) diff --git a/etc/pm/sleep.d/10_change_theme b/etc/pm/sleep.d/10_change_theme index 53d688d0..459fd31b 100755 --- a/etc/pm/sleep.d/10_change_theme +++ b/etc/pm/sleep.d/10_change_theme @@ -9,7 +9,38 @@ DARK_START=18 DARK_STOP=7 export DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/1000/bus' -echo "running $0" >>/tmp/theme.log +log() { + echo "$(date '+%F %T %Z') ${*}" +} + +set_theme() { + theme_type="${1:-dark}" + color_scheme="prefer-${theme_type}" + + if [[ "${theme_type}" =~ ^dark$ ]]; then + theme="${DARK_THEME}" + elif [[ "${theme_type}" =~ ^light$ ]]; then + theme="${LIGHT_THEME}" + else + echo "error: theme-type must be 'light' or 'dark'" + return 1 + fi + + { + log "gsettings set org.gnome.desktop.interface color-scheme '${color_scheme}'" + log "gsettings set org.gnome.desktop.interface gtk-theme ${theme}" + log "gsettings set org.gnome.gedit.preferences.editor scheme ${theme}" + } >>/tmp/theme.log + gsettings set org.gnome.desktop.interface color-scheme "${color_scheme}" + gsettings set org.gnome.desktop.interface gtk-theme "${theme}" + gsettings set org.gnome.gedit.preferences.editor scheme "${theme}" +} + +{ + echo + log "running $0" +} >>/tmp/theme.log + # set the dark theme if run during the dark theme hours # normally, cron should run this file @@ -18,22 +49,30 @@ if [[ "${PM_ACTION}" =~ ^(thaw|resume)$ || -z "${PM_ACTION}" ]]; then - if [[ - "$(date +%H)" -ge "${DARK_START}" || - "$(date +%H)" -lt "${DARK_STOP}" - ]]; then - echo gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' >>/tmp/theme.log - echo gsettings set org.gnome.desktop.interface gtk-theme "${DARK_THEME}" >>/tmp/theme.log - echo gsettings set org.gnome.gedit.preferences.editor scheme "${DARK_THEME}" >>/tmp/theme.log - gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' - gsettings set org.gnome.desktop.interface gtk-theme "${DARK_THEME}" - gsettings set org.gnome.gedit.preferences.editor scheme "${DARK_THEME}" + + if [[ "${DARK_START}" -gt "${DARK_STOP}" ]]; then + if [[ + "$(date +%H)" -ge "${DARK_START}" && + "$(date +%H)" -le 23 + ]] || [[ + "$(date +%H)" -ge 00 && + "$(date +%H)" -lt "${DARK_STOP}" + ]]; then + set_theme dark + else + set_theme light + fi else - echo gsettings set org.gnome.desktop.interface color-scheme 'prefer-light' >>/tmp/theme.log - echo gsettings set org.gnome.desktop.interface gtk-theme "${LIGHT_THEME}" >>/tmp/theme.log - echo gsettings set org.gnome.gedit.preferences.editor scheme "${LIGHT_THEME}" >>/tmp/theme.log - gsettings set org.gnome.desktop.interface color-scheme 'prefer-light' - gsettings set org.gnome.desktop.interface gtk-theme "${LIGHT_THEME}" - gsettings set org.gnome.gedit.preferences.editor scheme "${LIGHT_THEME}" + if [[ + "$(date +%H)" -ge "${DARK_STOP}" && + "$(date +%H)" -le 23 + ]] || [[ + "$(date +%H)" -ge 00 && + "$(date +%H)" -lt "${DARK_START}" + ]]; then + set_theme light + else + set_theme dark + fi fi fi From 55ea6de16d89c66b1c5b0c670cdfed64d7beedb4 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Tue, 30 Apr 2024 02:44:06 -0400 Subject: [PATCH 08/32] feat: kill act Docker containers with signal 9 during cleanup --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a183ccad..0c8ac212 100644 --- a/Makefile +++ b/Makefile @@ -217,7 +217,7 @@ lint-cleanup: ## Linting: Clean up any leftover docker continers from linting -@echo '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=' -@echo -for container in $$(docker container ls -a --format='{{.Names}}' | grep -E '^act-'); do \ - docker container stop "$${container}"; \ + docker container stop --signal 9 "$${container}"; \ docker container rm "$${container}"; \ done && \ for volume in $$(docker volume ls --format='{{.Name}}' | grep -E '^act-'); do \ From c909d08adbd975ccc19939ced344d6e622324a92 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Wed, 19 Jun 2024 21:18:12 -0400 Subject: [PATCH 09/32] feat: update starship config to always display the current commit hash --- .config/starship.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/starship.toml b/.config/starship.toml index 28f6c144..9c376b53 100644 --- a/.config/starship.toml +++ b/.config/starship.toml @@ -59,6 +59,7 @@ symbol = '🌴 ' format = '\(on [$symbol$branch(:$remote_branch)]($style) ' [git_commit] +only_detached = false tag_disabled = false [git_status] From e3c40c3926beec4d4da88c654a8e890532e1a8f5 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Wed, 19 Jun 2024 22:14:31 -0400 Subject: [PATCH 10/32] feat: add ssh config template --- Makefile | 4 +-- home/.ssh/config.d/dns | 9 +++++ home/.ssh/config.d/general_config | 51 +++++++++++++++++++++++++++ home/.ssh/config.d/hostname_rewrites | 20 +++++++++++ home/.ssh/config.d/proxy_host_configs | 16 +++++++++ home/.ssh/config.template | 7 ++++ 6 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 home/.ssh/config.d/dns create mode 100644 home/.ssh/config.d/general_config create mode 100644 home/.ssh/config.d/hostname_rewrites create mode 100644 home/.ssh/config.d/proxy_host_configs create mode 100644 home/.ssh/config.template diff --git a/Makefile b/Makefile index 0c8ac212..66480b06 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ ifeq ($(notdir $(CURDIR)), .ssh) @if [ -d $(DIR) ]; then \ cp -ai $(TEMPLATE) $(CONFIG_FILE); \ - $(info going through all Include lines and replace them with the file contents) \ + $(info going through all Include lines and replacing them with the file contents) \ for line in $(shell grep -n Include $(TEMPLATE) | sed -re 's;Include ;;' | sort -r); do \ lineno=$${line%%:*}; \ file=$${line##*:}; \ @@ -52,7 +52,7 @@ ifeq ($(notdir $(CURDIR)), .gitconfig.d) @if [ -d $(DIR) ]; then \ cp -ai $(TEMPLATE) $(CONFIG_FILE); \ - $(info going through all 'include' lines and replace them with the file contents) \ + $(info going through all 'include' lines and replacing them with the file contents) \ for line in $(shell grep -n ^include $(TEMPLATE) | sed -re 's;^include ;;' | sort -r); do \ lineno=$${line%%:*}; \ file=$${line##*:}; \ diff --git a/home/.ssh/config.d/dns b/home/.ssh/config.d/dns new file mode 100644 index 00000000..02b9f3f0 --- /dev/null +++ b/home/.ssh/config.d/dns @@ -0,0 +1,9 @@ +#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# +# DNS # +#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# + +# add static host entries to save on DNS resolution, which can shaves off a few seconds every connection +Host jump, jump-alt + Hostname 1.1.1.1 + # Hostname jump.hostname.com + # Hostname jump-alt.hostname.com diff --git a/home/.ssh/config.d/general_config b/home/.ssh/config.d/general_config new file mode 100644 index 00000000..fadc0c88 --- /dev/null +++ b/home/.ssh/config.d/general_config @@ -0,0 +1,51 @@ +#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# +# General config # +#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# + + +# for certain devices +Host *-abc* + User root + +# for other devices +Host us-east-01-prod*a + Ciphers aes256-cbc,aes192-cbc,aes128-cbc,3des-cbc + +# for all devices +Host *-ac* + User admn + HostKeyAlgorithms +ssh-dss + KexAlgorithms +diffie-hellman-group1-sha1 + PreferredAuthentications password,keyboard-interactive + +Host *.internal.hostname.com *.otherhost.com + IdentitiesOnly yes + IdentityFile ~/.ssh/id_rsa + +Host github.com + Hostname github.com + User git + IdentityFile ~/.ssh/github_specific_key + +Host bitbucket.org + Hostname bitbucket.org + User git + IdentityFile ~/.ssh/bitbucket_specific_key + +Host gitlab.com + Hostname gitlab.com + User git + IdentityFile ~/.ssh/gitlab_specific_key + +Host * + ForwardAgent yes + PreferredAuthentications publickey,password,keyboard-interactive + ServerAliveInterval 5 + ServerAliveCountMax 9 + GSSAPIAuthentication no + StrictHostKeyChecking accept-new + UserKnownHostsFile=/dev/null + LogLevel error +# ControlMaster auto +# ControlPath ~/.ssh/%r@%h:%p +# ControlPersist 120 diff --git a/home/.ssh/config.d/hostname_rewrites b/home/.ssh/config.d/hostname_rewrites new file mode 100644 index 00000000..b839da82 --- /dev/null +++ b/home/.ssh/config.d/hostname_rewrites @@ -0,0 +1,20 @@ +#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# +# Hostname rewrites # +#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# + +# these shortened Hostname values work only since jump, which is always used as the proxy, searches the "internal.hostname.com" domain +# otherwise, we'd have to specify the full "%h.$region.internal.hostname.com" for each stanza +Host us-east-1* + Hostname %h.us-east-1 + +Host eu-west-3* + Hostname %h.eu-west-3 + +# for switches +Host *-switch* sa-east-1-dev* !*.somehost.com + Hostname %h.somehost.com +# ProxyCommand ssh -t %r@jump -W %h:%p + +# complete hostnames +Host *us-east-1* *eu-west-3* !*.internal.hostname.com !github.com !*.somehost.com + Hostname %h.internal.hostname.com diff --git a/home/.ssh/config.d/proxy_host_configs b/home/.ssh/config.d/proxy_host_configs new file mode 100644 index 00000000..4dab24b3 --- /dev/null +++ b/home/.ssh/config.d/proxy_host_configs @@ -0,0 +1,16 @@ +#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# +# Proxy host configs # +#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# + +# Match host works in more cases than Host for re-parsed hostnames +Match host *labcomp*,!*jump*,!1.2.*.* + ProxyCommand ssh jump.us-east-1 -W %h:%p +# # ProxyJump passes along ssh flags, like `-vvv`, to the jump host, but requires a static username to use with the jump host if different from the +# # final host +# ProxyJump %r@jump.us-east-1 +# ProxyCommand ssh %r@jump.us-east-1 -W %h:%p + +# Match host works in more cases than Host for re-parsed hostnames +Match host *.internal.hostname.com,*.somehost.com,!*jump* + ProxyCommand ssh jump -W %h:%p +# ProxyJump %r@jump diff --git a/home/.ssh/config.template b/home/.ssh/config.template new file mode 100644 index 00000000..672c7559 --- /dev/null +++ b/home/.ssh/config.template @@ -0,0 +1,7 @@ +Include config.d/dns + +Include config.d/hostname_rewrites + +Include config.d/proxy_host_configs + +Include config.d/general_config From f2a289062a956065447a41118157d67f147e4619 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Fri, 1 Nov 2024 03:10:48 -0400 Subject: [PATCH 11/32] feat: correct some conditional logic for installing vim-plugin also alphabetize plugins --- .vimrc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.vimrc b/.vimrc index cc2aad85..3f229c6a 100644 --- a/.vimrc +++ b/.vimrc @@ -332,9 +332,13 @@ nnoremap " " automatically install vim-plug " -let data_dir = has('nvim') ? stdpath('data') . '/site' : s:vim_home_dir -if empty(glob(data_dir . '/autoload/plug.vim')) - exe system('curl -fLo "' . s:vim_home_dir . '/autoload/plug.vim" --create-dirs +let data_dir = has('nvim') ? stdpath('data') . '/site/autoload' : s:vim_home_dir +if empty(data_dir) + exe system('mkdir -p ' . data_dir) +endif + +if empty(glob(data_dir . '/plug.vim')) + exe system('curl -sfLo "' . data_dir . '/plug.vim" --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim') autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif @@ -344,7 +348,7 @@ endif " plugins: " https://vimawesome.com/ -call plug#begin(s:vim_home_dir . '/plugged') +call plug#begin(data_dir . '/plugged') " Plug 'airblade/vim-gitgutter' " " Plug 'AndrewRadev/linediff.vim' " " Plug 'arp242/undofile_warn.vim' " @@ -354,8 +358,10 @@ call plug#begin(s:vim_home_dir . '/plugged') Plug 'ekalinin/Dockerfile.vim' " adds syntax highlighting for Dockerfiles " Plug 'ervandew/supertab' " smart tab completion (old) Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries', 'frozen': 'true' } " go development +" Plug 'glts/vim-textobj-comment' " Plug 'hashivim/vim-terraform' " syntax highlighting for terraform " Plug 'https://github.com/ElmCast/elm-vim' " + Plug 'github/copilot.vim' " Plug 'https://github.com/fevrin/AnsiEsc.vim', { 'frozen': 'true' } " converts ANSI escape codes to colors " Plug 'inkarkat/vim-AdvancedDiffOptions' " " Plug 'inkarkat/vim-ConflictMotions' " older conflict marker jumper @@ -364,7 +370,6 @@ call plug#begin(s:vim_home_dir . '/plugged') " Plug 'junegunn/fzf.vim' " Plug 'junegunn/vim-easy-align' " easily align lines based on a common character expression " Plug 'kana/vim-textobj-user' " -" Plug 'glts/vim-textobj-comment' " " Plug 'Konfekt/FastFold' " fixes slow folding " Plug 'mbbill/undotree' " lets you visualize a file's undo history " Plug 'mhinz/vim-signify' " @@ -395,9 +400,9 @@ call plug#begin(s:vim_home_dir . '/plugged') " Plug 'tpope/vim-surround' " adds commands for surrounding arbitrary text with tags, quotes, etc. Plug 'tpope/vim-unimpaired' " add handy mappings for toggling options, jumping, formatting, etc. " Plug 'vim-airline/vim-airline' " +" Plug 'Vimjas/vim-python-pep8-indent' " make python code comply with PEP8 recommendation " Plug 'vim-scripts/vcscommand.vim' " " Plug 'vim-syntastic/syntastic' " code syntax checker -" Plug 'Vimjas/vim-python-pep8-indent' " make python code comply with PEP8 recommendation Plug 'vito/booklit.vim' " syntax highlighting for Booklit files " Plug 'ycm-core/YouCompleteMe' " speedy code completion, comprehension, and refactoring engine " Plug 'yggdroot/indentline' " From 84eb13341d90a2724af2208c8d56c156709411b1 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Fri, 13 Dec 2024 19:54:25 -0500 Subject: [PATCH 12/32] feat: have 'git st' alias for 'git status' show ignored files --- .gitconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitconfig b/.gitconfig index be933e57..7654fb8c 100644 --- a/.gitconfig +++ b/.gitconfig @@ -335,7 +335,7 @@ '" root-dir = rev-parse --show-toplevel save = !git add -A && git commit -m 'chore: commit save point' # from https://snyk.io/blog/10-git-aliases-for-faster-and-productive-git-workflow/ - st = status + st = status --ignored sync = "!$HOME/.gitconfig.d/git-sync.sh $@" type = cat-file -t undo = reset HEAD~1 --mixed # from https://snyk.io/blog/10-git-aliases-for-faster-and-productive-git-workflow/ From 860d29215ab7c80009f7596a73ec295c61fd229c Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Fri, 27 Dec 2024 01:03:13 -0500 Subject: [PATCH 13/32] fix: update 'bluetoothctl' subcommand --- .shellrc.d/functions/blueconnect | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.shellrc.d/functions/blueconnect b/.shellrc.d/functions/blueconnect index 65356541..66294b07 100644 --- a/.shellrc.d/functions/blueconnect +++ b/.shellrc.d/functions/blueconnect @@ -48,7 +48,7 @@ blueconnect() { #amixer -D pulse sset Master mute bluetoothctl disconnect; } - if bluetoothctl connect $(bluetoothctl paired-devices | awk "tolower(\$0) ~ /${device}/ { print \$2 }"); then + if bluetoothctl connect $(bluetoothctl devices | awk "tolower(\$0) ~ /${device}/ { print \$2 }"); then [[ "${bluetooth_versions[${bluetooth_version}]%%.*}" -lt 5 ]] && { echo "turning volume back up..." #sleep 3 @@ -73,7 +73,7 @@ _blueconnect_completions() { if [[ "${#COMP_WORDS[@]}" -gt 2 ]]; then if [[ "${COMP_WORDS[1]}" =~ ^file$ ]]; then # output into columns all files tracked in the ${HOME_DIR} repo - VALUES="$(bluetoothctl paired-devices | cut -d' ' -f3-)" + VALUES="$(bluetoothctl devices | cut -d' ' -f3-)" fi elif [[ "${#COMP_WORDS[@]}" -eq 2 ]]; then # ${#COMP_WORDS} starts off at 2, so we're at the initial [Tab] From 5696e377a68b44f121b0b42a46b24dec20add717 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Fri, 27 Dec 2024 01:35:05 -0500 Subject: [PATCH 14/32] fix: gate some vimrc options behind vim version --- .vimrc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.vimrc b/.vimrc index 3f229c6a..ca761e3f 100644 --- a/.vimrc +++ b/.vimrc @@ -157,8 +157,11 @@ set history=4000 " hi; allow for ample command history ":so ~/.vim/extenders/.vim.wrap ":so ~/.vim/extenders/.vim.loadtemplate -set term=xterm " needed for the colorscheme to show as more bold and vibrant than 'screen.xterm-256color' -colorscheme ron +if version < 901 + " this block restricts the situations in which the following options are enabled + set term=xterm " needed for the colorscheme to show as more bold and vibrant than 'screen.xterm-256color' + colorscheme ron +endif syntax sync minlines=50 " ensure vim doesn't keep changing syntax highlighting; from From ea79bc5888e490706a238f7fd44846c843fa35b0 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Fri, 27 Dec 2024 02:29:41 -0500 Subject: [PATCH 15/32] feat: add CopyQ autostart file due to special Wayland requirement --- .config/autostart/copyq.desktop | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .config/autostart/copyq.desktop diff --git a/.config/autostart/copyq.desktop b/.config/autostart/copyq.desktop new file mode 100644 index 00000000..e10d514a --- /dev/null +++ b/.config/autostart/copyq.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Exec=env QT_QPA_PLATFORM=xcb /usr/bin/copyq +Hidden=false +NoDisplay=false +X-GNOME-Autostart-enabled=true +Name[en_US]=CopyQ +Name=CopyQ +Comment[en_US]= +Comment= +# https://copyq.readthedocs.io/en/latest/known-issues.html#on-linux-global-shortcuts-pasting-or-clipboard-monitoring-does-not-work From c11d8fce7347093ce426946f98bd66ded642956f Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Sun, 5 Jan 2025 18:31:28 -0500 Subject: [PATCH 16/32] feat: preserve modification times by default --- .shellrc.d/functions/rsync-with-progress | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.shellrc.d/functions/rsync-with-progress b/.shellrc.d/functions/rsync-with-progress index 5a4b614f..80e31b58 100644 --- a/.shellrc.d/functions/rsync-with-progress +++ b/.shellrc.d/functions/rsync-with-progress @@ -74,6 +74,7 @@ rsync-with-progress() { --recursive --links --perms + --times --group --owner --devices @@ -86,8 +87,6 @@ rsync-with-progress() { --hard-links --exclude='.trashed-*' --sparse - --no-times - --size-only ) declare -a RSYNC_FLAGS_NEGATIONS=( ) @@ -271,8 +270,8 @@ rsync-with-progress() { time ${SUDO} rsync "${RSYNC_FLAGS[@]}" "${SRC}" "${DST}" | pv --eta --line-mode --progress --size "${file_count}" } -# echo -n "do you want to skip updating times? [Y/n] "; read -# [[ ${REPLY} =~ ^n$ ]] || rsync_flags+=" --size-only" + echo -n "do you want to skip updating times? [Y/n] "; read + [[ ${REPLY} =~ ^n$ ]] || RSYNC_FLAGS+=(--size-only) if has pv && [[ ${PV_METHOD} -eq 1 && "${file_count}" -le 100 ]]; then From 8af8ec350929d9388405ccba0358ece39ab4e914 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Sun, 5 Jan 2025 18:32:14 -0500 Subject: [PATCH 17/32] feat: add some functions for reusability --- lib/systemd/system-sleep/change_theme | 42 +++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/lib/systemd/system-sleep/change_theme b/lib/systemd/system-sleep/change_theme index 828ab925..bde2d45a 100755 --- a/lib/systemd/system-sleep/change_theme +++ b/lib/systemd/system-sleep/change_theme @@ -1,5 +1,9 @@ #!/usr/bin/env bash +# this must be copied to /lib/systemd/system-sleep/change_theme +# +# ensure it also has 755 perms and is owned by root + # REPLACE "\$(id -u)" WITH YOUR USER ID # REPLACE "\$(id -un)" WITH YOUR USERNAME @@ -10,6 +14,36 @@ DARK_START=18 DARK_STOP=7 export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/\$(id -u)/bus" # may be needed for cron to run when logged out +log() { + echo "$(date '+%F %T %Z') ${*}" +} + +set_theme() { + theme_type="${1:-dark}" + color_scheme="prefer-${theme_type}" + + if [[ "${theme_type}" =~ ^dark$ ]]; then + theme="${DARK_THEME}" + elif [[ "${theme_type}" =~ ^light$ ]]; then + theme="${LIGHT_THEME}" + else + echo "error: theme-type must be 'light' or 'dark'" + return 1 + fi + + { + log "gsettings set org.gnome.desktop.interface color-scheme '${color_scheme}'" + log "gsettings set org.gnome.desktop.interface gtk-theme ${theme}" + } >>/tmp/theme.log + /bin/su "\$(id -un)" -c "gsettings set org.gnome.desktop.interface color-scheme '${color_scheme}'" + /bin/su "\$(id -un)" -c "gsettings set org.gnome.desktop.interface gtk-theme '${theme}'" +} + +{ + echo + log "running $0" +} >>/tmp/theme.log + # set the dark theme if run during the dark theme hours # normally, cron should run this file @@ -23,12 +57,8 @@ if [[ "$(date +%H)" -lt "${DARK_STOP}" ]]; then # the full command paths may not be necessary - /bin/su "\$(id -un)" -c "/usr/bin/gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'" - /bin/su "\$(id -un)" -c "/usr/bin/gsettings set org.gnome.desktop.interface gtk-theme ${DARK_THEME}" - /bin/su "\$(id -un)" -c "/usr/bin/gsettings set org.gnome.gedit.preferences.editor scheme ${DARK_THEME}" + set_theme dark else - /bin/su "\$(id -un)" -c "/usr/bin/gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'" - /bin/su "\$(id -un)" -c "/usr/bin/gsettings set org.gnome.desktop.interface gtk-theme ${LIGHT_THEME}" - /bin/su "\$(id -un)" -c "/usr/bin/gsettings set org.gnome.gedit.preferences.editor scheme ${LIGHT_THEME}" + set_theme light fi fi From 44b73743b5794129b6a9cef0e684152408d42df0 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Sun, 5 Jan 2025 18:33:42 -0500 Subject: [PATCH 18/32] style; rearrange some comments --- lib/systemd/system-sleep/change_theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/systemd/system-sleep/change_theme b/lib/systemd/system-sleep/change_theme index bde2d45a..19f83fe9 100755 --- a/lib/systemd/system-sleep/change_theme +++ b/lib/systemd/system-sleep/change_theme @@ -1,11 +1,11 @@ #!/usr/bin/env bash -# this must be copied to /lib/systemd/system-sleep/change_theme -# -# ensure it also has 755 perms and is owned by root - # REPLACE "\$(id -u)" WITH YOUR USER ID # REPLACE "\$(id -un)" WITH YOUR USERNAME +# +# afterward, copy this to /lib/systemd/system-sleep/change_theme +# +# ensure it also has 755 perms and is owned by root PM_ACTION="${1}" DARK_THEME='Yaru-viridian-dark' From d02525f4305d0eeb42f368805f1637e552626aae Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Tue, 7 Jan 2025 01:12:54 -0500 Subject: [PATCH 19/32] feat(change_theme): add logging, strict executing, and update comments --- etc/pm/sleep.d/10_change_theme | 3 +++ lib/systemd/system-sleep/change_theme | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/etc/pm/sleep.d/10_change_theme b/etc/pm/sleep.d/10_change_theme index 459fd31b..d5c6add7 100755 --- a/etc/pm/sleep.d/10_change_theme +++ b/etc/pm/sleep.d/10_change_theme @@ -1,6 +1,9 @@ #!/usr/bin/env bash # this must be copied to /etc/pm/sleep.d/ +# that should automatically copy it to /lib/systemd/system-sleep/change_theme +# +# ensure both files also have 755 perms PM_ACTION="${1}" DARK_THEME='Yaru-viridian-dark' diff --git a/lib/systemd/system-sleep/change_theme b/lib/systemd/system-sleep/change_theme index 19f83fe9..5866571a 100755 --- a/lib/systemd/system-sleep/change_theme +++ b/lib/systemd/system-sleep/change_theme @@ -7,7 +7,9 @@ # # ensure it also has 755 perms and is owned by root -PM_ACTION="${1}" +set -euo pipefail + +PM_ACTION="${1:-}" DARK_THEME='Yaru-viridian-dark' LIGHT_THEME='Yaru-viridian' DARK_START=18 @@ -16,6 +18,7 @@ export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/\$(id -u)/bus" # may be nee log() { echo "$(date '+%F %T %Z') ${*}" + logger -t change_theme "${*}" } set_theme() { @@ -56,7 +59,6 @@ if [[ "$(date +%H)" -ge "${DARK_START}" || "$(date +%H)" -lt "${DARK_STOP}" ]]; then - # the full command paths may not be necessary set_theme dark else set_theme light From 90fe82c9f92b1de37b3aa976974b90104b1ee365 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Tue, 14 Jan 2025 23:31:48 -0500 Subject: [PATCH 20/32] feat(change_theme): remove old logging and make script verbose --- lib/systemd/system-sleep/change_theme | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/systemd/system-sleep/change_theme b/lib/systemd/system-sleep/change_theme index 5866571a..b3fe7494 100755 --- a/lib/systemd/system-sleep/change_theme +++ b/lib/systemd/system-sleep/change_theme @@ -7,6 +7,7 @@ # # ensure it also has 755 perms and is owned by root +set -x set -euo pipefail PM_ACTION="${1:-}" @@ -30,14 +31,14 @@ set_theme() { elif [[ "${theme_type}" =~ ^light$ ]]; then theme="${LIGHT_THEME}" else - echo "error: theme-type must be 'light' or 'dark'" + log "error: theme-type must be 'light' or 'dark'" return 1 fi { log "gsettings set org.gnome.desktop.interface color-scheme '${color_scheme}'" log "gsettings set org.gnome.desktop.interface gtk-theme ${theme}" - } >>/tmp/theme.log + } /bin/su "\$(id -un)" -c "gsettings set org.gnome.desktop.interface color-scheme '${color_scheme}'" /bin/su "\$(id -un)" -c "gsettings set org.gnome.desktop.interface gtk-theme '${theme}'" } @@ -45,7 +46,7 @@ set_theme() { { echo log "running $0" -} >>/tmp/theme.log +} # set the dark theme if run during the dark theme hours From 2c3bd1bd73a8e4f889db1f261b21ced7824c3675 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Sat, 18 Jan 2025 00:34:39 -0500 Subject: [PATCH 21/32] feat: take additional step to ensure theme is changed --- lib/systemd/system-sleep/change_theme | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/systemd/system-sleep/change_theme b/lib/systemd/system-sleep/change_theme index b3fe7494..5b7cba82 100755 --- a/lib/systemd/system-sleep/change_theme +++ b/lib/systemd/system-sleep/change_theme @@ -28,8 +28,10 @@ set_theme() { if [[ "${theme_type}" =~ ^dark$ ]]; then theme="${DARK_THEME}" + prefer_dark_theme=1 elif [[ "${theme_type}" =~ ^light$ ]]; then theme="${LIGHT_THEME}" + prefer_dark_theme=0 else log "error: theme-type must be 'light' or 'dark'" return 1 @@ -39,8 +41,15 @@ set_theme() { log "gsettings set org.gnome.desktop.interface color-scheme '${color_scheme}'" log "gsettings set org.gnome.desktop.interface gtk-theme ${theme}" } + /bin/su "\$(id -un)" -c "gsettings set org.gnome.desktop.interface color-scheme '${color_scheme}'" /bin/su "\$(id -un)" -c "gsettings set org.gnome.desktop.interface gtk-theme '${theme}'" + + # since the theme didn't always change for system apps, make a change from here: + # https://www.reddit.com/r/Ubuntu/comments/1cfcu62/comment/luzvho0/ + for i in /home/"\$(id -un)"/.config/gtk-*/settings.ini; do + /bin/su "\$(id -un)" -c "sed -i_$(date '+%F_%T_%Z') -Ee 's;^(gtk-application-prefer-dark-theme=)[0-9]$;\1'${prefer_dark_theme}';' $i;" + done } { From e2d26de6e44f09dbc39b7f811ba296918a5e52fc Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Mon, 20 Jan 2025 20:11:04 -0500 Subject: [PATCH 22/32] feat: rework to support both cron and resume from suspend runs --- lib/systemd/system-sleep/change_theme | 39 +++++++++++++++------------ 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/lib/systemd/system-sleep/change_theme b/lib/systemd/system-sleep/change_theme index 5b7cba82..1a4f1137 100755 --- a/lib/systemd/system-sleep/change_theme +++ b/lib/systemd/system-sleep/change_theme @@ -10,6 +10,9 @@ set -x set -euo pipefail +# enable for debugging in journalctl +#exec &> >(logger -t change_theme) + PM_ACTION="${1:-}" DARK_THEME='Yaru-viridian-dark' LIGHT_THEME='Yaru-viridian' @@ -42,14 +45,21 @@ set_theme() { log "gsettings set org.gnome.desktop.interface gtk-theme ${theme}" } - /bin/su "\$(id -un)" -c "gsettings set org.gnome.desktop.interface color-scheme '${color_scheme}'" - /bin/su "\$(id -un)" -c "gsettings set org.gnome.desktop.interface gtk-theme '${theme}'" + if [[ "${PM_ACTION}" =~ ^post$ ]]; then + /bin/su "\$(id -un)" -c "gsettings set org.gnome.desktop.interface color-scheme '${color_scheme}'" + /bin/su "\$(id -un)" -c "gsettings set org.gnome.desktop.interface gtk-theme '${theme}'" + + for i in /home/"\$(id -un)"/.config/gtk-*/settings.ini; do + /bin/su "\$(id -un)" -c "sed -i_$(date '+%F_%T_%Z') -Ee 's;^(gtk-application-prefer-dark-theme=)[0-9]$;\1'${prefer_dark_theme}';' $i;" + done + else + gsettings set org.gnome.desktop.interface color-scheme "${color_scheme}" + gsettings set org.gnome.desktop.interface gtk-theme "${theme}" - # since the theme didn't always change for system apps, make a change from here: - # https://www.reddit.com/r/Ubuntu/comments/1cfcu62/comment/luzvho0/ - for i in /home/"\$(id -un)"/.config/gtk-*/settings.ini; do - /bin/su "\$(id -un)" -c "sed -i_$(date '+%F_%T_%Z') -Ee 's;^(gtk-application-prefer-dark-theme=)[0-9]$;\1'${prefer_dark_theme}';' $i;" - done + for i in /home/"$(id -un)"/.config/gtk-*/settings.ini; do + sed -i_$(date '+%F_%T_%Z') -Ee 's;^(gtk-application-prefer-dark-theme=)[0-9]$;\1'${prefer_dark_theme}';' $i + done + fi } { @@ -62,15 +72,10 @@ set_theme() { # normally, cron should run this file # if this file is in /lib/systemd/system-sleep/ (/etc/pm/sleep.d/ doesn't work), this will also trigger when waking from sleep/hibernation in Ubuntu if [[ - "${PM_ACTION}" =~ ^post$ || - -z "${PM_ACTION}" + "$(date +%H)" -ge "${DARK_START}" || + "$(date +%H)" -lt "${DARK_STOP}" ]]; then - if [[ - "$(date +%H)" -ge "${DARK_START}" || - "$(date +%H)" -lt "${DARK_STOP}" - ]]; then - set_theme dark - else - set_theme light - fi + set_theme dark +else + set_theme light fi From 176b9ff02df32880e99e7887f46200b466186cf9 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Mon, 12 May 2025 01:03:43 -0400 Subject: [PATCH 23/32] feat: update SSH_AUTH_SOCK if a password manager's socket file exists --- .shellrc.d/base | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.shellrc.d/base b/.shellrc.d/base index 8380d72b..80b3804c 100644 --- a/.shellrc.d/base +++ b/.shellrc.d/base @@ -138,3 +138,17 @@ grep -q 10 /proc/sys/vm/swappiness || { vm.swappiness = 10 EOF } + +for ssh_socket_file in \ + "${HOME}/.1password/agent.sock" \ + "${HOME}/.bitwarden-ssh-agent.sock" \ + "${HOME}/snap/bitwarden/current/.bitwarden-ssh-agent.sock" \ + "${HOME}/.keeper-ssh-agent.sock" \ + ; do + if [[ -S "${ssh_socket_file}" ]]; then + # the default is 'export SSH_AUTH_SOCK=/run/user/1000/keyring/ssh' + # but use a password manager's socket file if it exists + export SSH_AUTH_SOCK="${ssh_socket_file}" + break + fi +done From 6f2c3e0b27e7242da9046bf1084eab9c3dc26293 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Wed, 3 Dec 2025 04:10:54 -0500 Subject: [PATCH 24/32] feat(gitconfig): add aliases for review-commits and worktree --- .gitconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitconfig b/.gitconfig index 7654fb8c..5a1d918a 100644 --- a/.gitconfig +++ b/.gitconfig @@ -383,6 +383,10 @@ lg3 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold yellow)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all lg4 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)' ss = stash show + review-commits = "!f() {\n CURRENT=$(git branch --show-current);\n echo \"Current branch: $CURRENT\";\n printf \"Enter base branch (default: main): \";\n read -r BASE < /dev/tty;\n BASE=${BASE:-main};\n echo;\n COMMITS=$(git log --reverse --pretty=format:\"%H\" $BASE..$CURRENT);\n if [ -z \"$COMMITS\" ]; then\n echo \"No commits found in $CURRENT that aren't in $BASE\";\n return 0;\n fi;\n COUNT=$(echo \"$COMMITS\" | wc -l);\n printf \"Found %s commit(s) to review\\n\" \"$COUNT\";\n echo;\n i=1;\n for c in $COMMITS; do\n MSG=$(git log --format=%B -n 1 $c | head -1);\n AUTH=$(git log --format=\"%an\" -n 1 $c);\n DATE=$(git log --format=\"%ar\" -n 1 $c);\n echo \"═══════════════════════════════════════════════════════════════════\";\n echo \"Commit $i of $COUNT\";\n echo \"═══════════════════════════════════════════════════════════════════\";\n echo \"Commit: $c\";\n echo \"Author: $AUTH\";\n echo \"Date: $DATE\";\n echo \"Message: $MSG\";\n echo;\n git diff $c^..$c;\n echo;\n echo \"───────────────────────────────────────────────────────────────────\";\n if [ $i -lt $COUNT ]; then\n printf \"Press Enter to continue to next commit...\";\n read -r dummy < /dev/tty;\n echo;\n else\n echo \"Review complete!\";\n fi;\n i=$((i + 1));\n done;\n}; f" + wl = worktree list + wr = worktree remove + wta = "!f() {\n branch=\"$1\";\n repo=$(basename $(git worktree list --porcelain | grep -m1 \"^worktree\" | cut -d\" \" -f2));\n parent=$(dirname $(git worktree list --porcelain | grep -m1 \"^worktree\" | cut -d\" \" -f2));\n safe=$(echo \"$branch\" | tr \"/\" \"-\");\n worktree_path=\"${parent}/${repo}-${safe}\";\n if git show-ref --verify --quiet refs/heads/\"${branch}\"; then\n git worktree add \"${worktree_path}\" \"${branch}\";\n elif git show-ref --verify --quiet refs/remotes/origin/\"${branch}\"; then\n git worktree add -b \"${branch}\" \"${worktree_path}\" \"origin/${branch}\";\n else\n git worktree add -b \"${branch}\" \"${worktree_path}\" origin/HEAD;\n fi && printf \"Worktree created at: %s\\n\" \"$(echo \"${worktree_path}\" | sed \"s|^$HOME|~|\")\";\n}; f" [checkout] defaultRemote = origin [core] From 373eedab60a444dc5654054f79ad876f22751ecc Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Wed, 3 Dec 2025 04:42:56 -0500 Subject: [PATCH 25/32] chore(cspell): switch to YAML --- ci/.mega-linter.yaml | 2 +- ci/{.cspell.json => cspell.yaml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename ci/{.cspell.json => cspell.yaml} (100%) diff --git a/ci/.mega-linter.yaml b/ci/.mega-linter.yaml index b427891d..7e702743 100644 --- a/ci/.mega-linter.yaml +++ b/ci/.mega-linter.yaml @@ -42,7 +42,7 @@ MARKDOWN_MARKDOWNLINT_CONFIG_FILE: ci/.markdownlint.yaml REPOSITORY_CHECKOV_ARGUMENTS: '--skip-check CKV_GHA_7' REPOSITORY_CHECKOV_CONFIG_FILE: ci/.checkov.yaml -SPELL_CSPELL_CONFIG_FILE: ci/.cspell.json +SPELL_CSPELL_CONFIG_FILE: ci/cspell.yaml SPELL_LYCHEE_CONFIG_FILE: ci/lychee.toml diff --git a/ci/.cspell.json b/ci/cspell.yaml similarity index 100% rename from ci/.cspell.json rename to ci/cspell.yaml From c5dbb0bda89100cec75bbd6e56f1bc0013b06c61 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Wed, 3 Dec 2025 04:46:04 -0500 Subject: [PATCH 26/32] chore(cspell): convert to YAML --- ci/cspell.yaml | 112 ++++++++++++++++++++++++------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/ci/cspell.yaml b/ci/cspell.yaml index 24c63309..c00aa1a9 100644 --- a/ci/cspell.yaml +++ b/ci/cspell.yaml @@ -1,56 +1,56 @@ -{ - "ignorePaths": [ - "**.sw*" - ], - "language": "en-US", - "words": [ - "Aftertabs", - "Architectrure", - "autoload", - "bsdextrautils", - "centralised", - "checkmake", - "CHECKMAKE", - "containerised", - "EDITMSG", - "elif", - "envsubst", - "esac", - "gettext", - "gsub", - "hadolint", - "infosec", - "javac", - "markdownlint", - "MARKDOWNLINT", - "metacharacters", - "minimise", - "minphony", - "mksh", - "mktemp", - "nektos", - "nullary", - "OIFS", - "pipenv", - "pkgs", - "Plzik", - "Proto", - "RACI", - "readarray", - "runbook", - "runbooks", - "sanitised", - "shellcheck", - "SHELLCHECK", - "shellcheckrc", - "shellrc", - "shfmt", - "SHFMT", - "shfmt's", - "sonarqube", - "SPOF", - "statefile", - "toplevel", - "usecases" - ] -} +ignorePaths: + - '**.sw*' +language: en-US +words: + - Aftertabs + - Architectrure + - autoload + - bitwarden + - bsdextrautils + - centralised + - checkmake + - CHECKMAKE + - containerised + - EDITMSG + - elif + - envsubst + - esac + - gettext + - gsub + - hadolint + - infosec + - javac + - markdownlint + - MARKDOWNLINT + - metacharacters + - minimise + - minphony + - mksh + - mktemp + - nektos + - nullary + - OIFS + - pipenv + - pkgs + - Plzik + - Proto + - RACI + - readarray + - runbook + - runbooks + - sanitised + - shellcheck + - SHELLCHECK + - shellcheckrc + - shellrc + - shfmt + - SHFMT + - shfmt's + - sonarqube + - SPOF + - statefile + - toplevel + - unmute + - usecases + - vimdiff + - worktree From 573b1d8353a7d95816d7cd631b6ec7ed3f90d1a6 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Wed, 3 Dec 2025 04:46:24 -0500 Subject: [PATCH 27/32] chore(lychee): add stackoverflow to excluded URLs --- ci/lychee.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/lychee.toml b/ci/lychee.toml index 6110565a..550ddace 100644 --- a/ci/lychee.toml +++ b/ci/lychee.toml @@ -93,6 +93,7 @@ exclude = [ '^https://web\.archive\.org/web/', '[0-9]+\+[^@]+@users.noreply.github.com', 'https://www\.reddit\.com/r/golang/comments/n628db/go_install_fails_with_can_only_use_pathversion', + 'https://www\.stackoverflow\.com', ] # Exclude these filesystem paths from getting checked. From 1a4c5bba83da3a4b511de6165773cbb9b2b78557 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Wed, 3 Dec 2025 04:50:58 -0500 Subject: [PATCH 28/32] chore(megalinter): bump version --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 9acf2a00..afb8b54d 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -105,7 +105,7 @@ jobs: fetch-depth: $CHECKOUT_DEPTH - name: MegaLinter - uses: oxsecurity/megalinter/flavors/cupcake@7e042c726c68415475b05a65a686c612120a1232 # v7.7.0 + uses: oxsecurity/megalinter/flavors/cupcake@55a59b24a441e0e1943080d4a512d827710d4a9d # v9.2.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MEGALINTER_CONFIG: ci/.mega-linter.yaml From 826c44bae20293582d944704917e2d7240004817 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Wed, 3 Dec 2025 05:10:20 -0500 Subject: [PATCH 29/32] chore(cspell): add some official dictionaries --- ci/cspell.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ci/cspell.yaml b/ci/cspell.yaml index c00aa1a9..debcc7ec 100644 --- a/ci/cspell.yaml +++ b/ci/cspell.yaml @@ -1,6 +1,15 @@ ignorePaths: - '**.sw*' + language: en-US + +# Enabled dictionaries +dictionaries: + - technical + - software-terms + - shell + - project + words: - Aftertabs - Architectrure From a2d7ac687247adfda10db79075520f953e521814 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Wed, 3 Dec 2025 05:16:56 -0500 Subject: [PATCH 30/32] chore(lychee): fix regex --- ci/lychee.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/lychee.toml b/ci/lychee.toml index 550ddace..61b60bf9 100644 --- a/ci/lychee.toml +++ b/ci/lychee.toml @@ -93,7 +93,7 @@ exclude = [ '^https://web\.archive\.org/web/', '[0-9]+\+[^@]+@users.noreply.github.com', 'https://www\.reddit\.com/r/golang/comments/n628db/go_install_fails_with_can_only_use_pathversion', - 'https://www\.stackoverflow\.com', + 'https://(www\.)?stackoverflow\.com/.*', ] # Exclude these filesystem paths from getting checked. From 74cea03d21701656942a6e86a2c6f2146a945c90 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Wed, 3 Dec 2025 05:47:22 -0500 Subject: [PATCH 31/32] chore(pre-commit): bump setup-python and python version --- .github/workflows/pre-commit.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index afb8b54d..84b669fa 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -148,9 +148,9 @@ jobs: check-latest: true - name: Install python - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 with: - python-version: '3.11' + python-version: '3.12' - name: Run pre-commit on all files uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 @@ -170,9 +170,9 @@ jobs: fetch-depth: $CHECKOUT_DEPTH - name: Install python - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 with: - python-version: '3.11' + python-version: '3.12' - name: Run pre-commit uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 From 9105e6a5d98eab51887e993da68772b3e31c3c80 Mon Sep 17 00:00:00 2001 From: Fevrin <5051062+fevrin@users.noreply.github.com> Date: Wed, 3 Dec 2025 05:47:45 -0500 Subject: [PATCH 32/32] feat(pre-commit): switch to individual commands for pre-commit --- .github/workflows/pre-commit.yml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 84b669fa..7a32baaa 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -152,11 +152,17 @@ jobs: with: python-version: '3.12' - - name: Run pre-commit on all files - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 + - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: - # this should run the pre-commit hooks only on the files changed between the default branch and the one in the PR - extra_args: --verbose -a + path: ~/.cache/pre-commit + # Key includes python version and config hash to invalidate cache on changes + key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} + + - name: Install pre-commit + run: pip install pre-commit + + - name: Run pre-commit + run: pre-commit run --show-diff-on-failure --color=always --all-files --verbose pre-commit: if: (!github.event.act) @@ -174,11 +180,17 @@ jobs: with: python-version: '3.12' - - name: Run pre-commit - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 + - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: - # this should run the pre-commit hooks only on the files changed between the default branch and the one in the PR - extra_args: --verbose --from-ref ${{ needs.get-changed-files.outputs.BASE_REF }} --to-ref HEAD + path: ~/.cache/pre-commit + # Key includes python version and config hash to invalidate cache on changes + key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} + + - name: Install pre-commit + run: pip install pre-commit + + - name: Run pre-commit + run: pre-commit run --show-diff-on-failure --color=always --all-files --verbose check-zshrc: runs-on: ubuntu-latest