--- # misc matches: - trigger: ";192" replace: 192.168.0. - trigger: ";search" replace: "-site:reddit.com -site:twitter.com -site:pinterest.com" - trigger: ";shebang" replace: "#!/usr/bin/env " - trigger: ";strict" # bash "strict mode" replace: | set -euo pipefail IFS=$'\n\t' - trigger: ";chapply" # apply chezmoi dotfiles as a oneshot operation replace: 'sh -c "$(curl -fsLS get.chezmoi.io)" -- init --one-shot {{GITHUB_USERNAME}}' vars: - name: GITHUB_USERNAME type: shell params: cmd: "git config --global --get user.name" # easily bootstrap rust tools, for when I'm in ephemeral environments, like containers - trigger: ";rustup" replace: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # same idea as rustup, but to get Helix, the best text editor 😎 - trigger: ";helix" replace: | { sudo apt install software-properties-common git -y sudo add-apt-repository ppa:maveonair/helix-editor -y sudo apt update sudo apt install helix -y } || { sudo dnf install helix -y } || { sudo pacman -S helix --noconfirm } || { flatpak install flathub com.helix_editor.Helix flatpak run com.helix_editor.Helix } hx --grammar fetch mkdir -p ~/.config/helix echo '{{HELIX_CONFIG}}' > ~/.config/helix/config.toml echo '{{HELIX_LANG_CONFIG}}' > ~/.config/helix/languages.toml vars: # these yoink the values from the helix configs on my host # and redirect them into files on the target so I can keep # them "portable" - name: HELIX_CONFIG type: shell params: cmd: "cat ~/.config/helix/config.toml" - name: HELIX_LANG_CONFIG type: shell params: cmd: "cat ~/.config/helix/languages.toml" # i use dracula theme colors for lots of things - triggers: [";dracback", ";dracdark"] replace: "#282a36" - triggers: [";dractext", ";dracwhite", ";draclight"] replace: "#f8f8f2" - trigger: ";dracgreen" replace: "#50fa7b" - trigger: ";dracred" replace: "#ff5555" - trigger: ";dracyellow" replace: "#f1fa8c" - trigger: ";dracblue" replace: "#8be9fd" - trigger: ";dracpurple" replace: "#bd93f9" - trigger: ";dracpink" replace: "#ff79c6" - trigger: ";dracorange" replace: "#ffb86c" - triggers: [";dracgray", ";dracgrey"] replace: "#6272a4" - triggers: ["allinpath", "listall", "listallinpath"] replace: "bash -c \"for dir in $(echo $PATH | tr ':' ' '); do ls -1 $dir; done\"" - triggers: ["reporoot", "gitreporoot"] replace: "git rev-parse --show-toplevel" # you like readable YAML? too bad :D - trigger: ";arch" replace: " \t -`\n \t .o+`\n \t `ooo/\n \t `+oooo:\n \t `+oooooo:\n \t -+oooooo+:\n \t `/:-:++oooo+:\n \t `/++++/+++++++:\n \t `/++++++++++++++:\n \t `/+++ooooooooooooo/`\n \t ./ooosssso++osssssso+`\n \t .oossssso-````/ossssss+`\n \t -osssssso. :ssssssso.\n \t :osssssss/ osssso+++.\n \t /ossssssss/ +ssssooo/-\n \t `/ossssso+/:- -:/+osssso+-\n \t `+sso+:-` `.-/+oso:\n \t`++:. `-/+/\n \t.` `/\n " --- # pseudo-autofill global_vars: - name: bws_access_token type: shell params: # use the OS keyring to get access token for secrets manager, where BW_PASSWORD is stored cmd: 'security find-generic-password -w -s "BWS_ACCESS_TOKEN" -a "$USER"' # macOS - name: bw_session type: shell params: cmd: | if [ -z "$BW_SESSION" ]; then export BW_NOINTERACTION=1 export BWS_ACCESS_TOKEN="{{bws_access_token}}" # `bws run` injects the environment variables in the following command bws run 'bw unlock "$BW_PASSWORD" --raw || bw login "$VAULT_EMAIL" "$BW_PASSWORD" --raw' fi matches: - regex: "(u|U)<(?P.*)>" # fill a username with u or U replace: "{{bw_usename}}" vars: - name: bw_usename type: shell params: shell: zsh cmd: |- export BW_SESSION="{{bw_session}}" bw list items --search "{{item}}" | jq -r '.[0] | select(.name | ascii_downcase) | .login.username' - regex: "(p|P)<(?P.*)>" # fill a password with p or P replace: "{{bw_pass}}" vars: - name: bw_pass type: shell params: shell: zsh cmd: |- export BW_SESSION="{{bw_session}}" bw list items --search "{{item}}" | jq -r '.[0] | select(.name | ascii_downcase) | .login.password' - regex: "(t|T)<(?P.*)>" # fill a totp with t or T replace: "{{bw_totp}}" vars: - name: id type: shell params: shell: zsh cmd: |- export BW_SESSION="{{bw_session}}" bw list items --search "{{item}}" | jq -r '.[0].id' - name: bw_totp type: shell params: shell: zsh cmd: |- export BW_SESSION="{{bw_session}}" bw get totp "{{id}}"