diff --git a/.config/espanso/match/base.yml b/.config/espanso/match/base.yml index 266ea6c..a6d1d2e 100644 --- a/.config/espanso/match/base.yml +++ b/.config/espanso/match/base.yml @@ -1,7 +1,6 @@ -# Automatically generated by espanso migration tool -# Original file: default.yml - matches: + - trigger: ":see" + replace: "🙈" - trigger: ":grue" replace: |- Grüße, @@ -25,138 +24,3 @@ matches: type: shell params: cmd: "curl 'https://api.ipify.org'" - # Sensitive data through pass - - trigger: ":ep" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/email/personal - - trigger: ":ec" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/email/church - - trigger: ":eu" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/email/uni - - trigger: ":eaur" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/email/aur - - trigger: ":a0" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/address | head -1 - - trigger: ":a1" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/address | head -2 | tail -1 - - trigger: ":as" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: "pass info/address | head -2 | tail -1 | cut -d' ' -f1" - - trigger: ":a2" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/address | tail -1 - - trigger: ":ap" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: "pass info/address | tail -1 | cut -d' ' -f1" - - trigger: ":ac" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: "pass info/address | tail -1 | cut -d' ' -f2" - - trigger: ":tel" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/phone - - trigger: ":adt" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/address-bt - - trigger: ":add" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/address - - trigger: ":tax" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/tax-id | head -1 - - trigger: ":ss" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/social-security | head -1 - - trigger: ":sign" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/signature - - trigger: ":sigo" - replace: |- - #+ATTR_ORG: :width 200 - #+ATTR_LATEX: :width 4cm :center nil - [[file:{{signature}}]] \\ - {{name}} - vars: - - name: signature - type: match - params: - trigger: ":sign" - - name: name - type: match - params: - trigger: ":a0" - - trigger: ":iban" - replace: "{{output}}" - vars: - - name: output - type: shell - params: - cmd: pass info/banking/dkb | head -1 diff --git a/.config/espanso/match/pass.yml b/.config/espanso/match/pass.yml new file mode 100644 index 0000000..d046145 --- /dev/null +++ b/.config/espanso/match/pass.yml @@ -0,0 +1,136 @@ +# Sensitive data through pass +matches: + - trigger: ":ep" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/email/personal + - trigger: ":ec" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/email/church + - trigger: ":eu" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/email/uni + - trigger: ":eaur" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/email/aur + - trigger: ":a0" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/address | head -1 + - trigger: ":a1" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/address | head -2 | tail -1 + - trigger: ":as" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: "pass info/address | head -2 | tail -1 | cut -d' ' -f1" + - trigger: ":a2" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/address | tail -1 + - trigger: ":ap" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: "pass info/address | tail -1 | cut -d' ' -f1" + - trigger: ":ac" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: "pass info/address | tail -1 | cut -d' ' -f2" + - trigger: ":tel" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/phone + - trigger: ":adt" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/address-bt + - trigger: ":add" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/address + - trigger: ":tax" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/tax-id | head -1 + - trigger: ":ss" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/social-security | head -1 + - trigger: ":sign" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/signature + - trigger: ":iban" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: pass info/banking/dkb | head -1 + - trigger: ":sigo" + replace: |- + #+ATTR_ORG: :width 200 + #+ATTR_LATEX: :width 4cm :center nil + [[file:{{signature}}]] \\ + {{name}} + vars: + - name: signature + type: match + params: + trigger: ":sign" + - name: name + type: match + params: + trigger: ":a0" diff --git a/.config/shell/functions b/.config/shell/functions index 14309bd..c816d9f 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -4,7 +4,7 @@ if test "$ZSH_NAME" = "zsh" then alias -g ___='"$(eval "$(fc -ln -1)" | tail -n 1)"' alias -g G="| grp" - alias -g X="| xargs -d '\n'" + alias -g X="| xargs -d '\n' -L 1" alias -g X1="| xargs -d '\n' -n 1" alias -g XC="| xclip -selection clipboard" alias -g L="--color=always | ${PAGER:-less}" diff --git a/.config/shell/server b/.config/shell/server new file mode 100644 index 0000000..e3758a0 --- /dev/null +++ b/.config/shell/server @@ -0,0 +1,41 @@ +export STACKSPIN="$HOME/stackspin" +_stackspin_cluster_cache=/var/tmp/stackspin-cluster + +# Stackspin CLI Wrapper +# Initialize once with "stack select example.org", +# then it loads the last selected one on startup. +# Presumes a mapping like the following in your ssh config: +# Host example.org +# Hostname [IP] +stack() { + case "$1" in + (select) shift + export _cluster_name="$1" + export _cluster_ip="$(ssh -G "$_cluster_name" | grep --max-count 1 "^hostname " | cut -d " " -f2-)" + export CLUSTER_DIR="$STACKSPIN/clusters/$_cluster_name" + export KUBECONFIG="$CLUSTER_DIR/kube_config_cluster.yml" + echo Selected "$_cluster_name" with IP "$_cluster_ip" + echo "$_cluster_name" >"$_stackspin_cluster_cache" + ;; + (sso) shift + builtin cd "$STACKSPIN" + kubectl exec -n stackspin $(kubectl get pods -A | grep single-sign-on-login | awk '{print $2}') -- flask "$@";; + (user) + if test "$2" = "init" + then mail="$3" + shift 3 + stack user create "$mail" + stack user update "$mail" name "$*" + echo "Initialized user '$*' with email '$mail'" + else kubectl exec -n stackspin $(kubectl get pods -A | grep single-sign-on-login | awk '{print $2}') -- flask "$@" + fi;; + (*) builtin cd "$STACKSPIN" + if test $# -gt 1 -a "$1" = install + then shift && "./install/install-$1.sh" || ./install/install-app.sh "$@" + else python3 -m stackspin "$_cluster_name" "$@" + fi;; + esac +} +cat "$_stackspin_cluster_cache" 2>/dev/null | + while read cluster; do stack select "$cluster"; done +cd "$HOME/stackspout" diff --git a/.local/bin/scripts/rpl b/.local/bin/scripts/rpl index c9be95c..c73cbe9 100755 --- a/.local/bin/scripts/rpl +++ b/.local/bin/scripts/rpl @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/bash -e # Use grep and sed to replace $1 with $2 recursively and print what is done grep --null --recursive --files-with-matches \ --binary-files=without-match "--exclude-dir={$DIRS_IGNORE}" "$1" "${@:3}" |