1
0

work setup sync

This commit is contained in:
2026-04-09 18:41:44 +02:00
parent eb8c484c45
commit 414602c66a
7 changed files with 131 additions and 44 deletions

View File

@@ -7,14 +7,13 @@ alias tmux_secondary_win='tmux new-session -t main -s secondary'
# enable color support of ls and also add handy aliases
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='grep -F --color=auto'
alias egrep='grep -E --color=auto'
alias docker=podman
alias d='dirs -v'
# shfmt needs to ignore this because it is a zsh specific syntax
# shfmt:ignore:start
for index ({1..9}) alias "c$index"="cd +${index}"; unset index
# shfmt:ignore:end
for index in 1 2 3 4 5 6 7 8 9; do alias "c$index"="cd +${index}"; done; unset index
alias kpget="keepassxc-cli show -a Password ${KEEPASS_DB}"
alias kptotp="keepassxc-cli show -t ${KEEPASS_DB}"
@@ -26,7 +25,7 @@ _KP_KEYCHAIN_SVC="keepassxc-cli-cache"
_KP_KEYCHAIN_ACCT="master-password"
_kp_pw_store() {
case "$(uname -s)" in
case "$UNAME_STRING" in
Darwin)
security add-generic-password -U \
-s "$_KP_KEYCHAIN_SVC" -a "$_KP_KEYCHAIN_ACCT" -w "$1"
@@ -39,7 +38,7 @@ _kp_pw_store() {
}
_kp_pw_get() {
case "$(uname -s)" in
case "$UNAME_STRING" in
Darwin)
security find-generic-password \
-s "$_KP_KEYCHAIN_SVC" -a "$_KP_KEYCHAIN_ACCT" -w 2>/dev/null
@@ -52,7 +51,7 @@ _kp_pw_get() {
}
_kp_pw_clear() {
case "$(uname -s)" in
case "$UNAME_STRING" in
Darwin)
security delete-generic-password \
-s "$_KP_KEYCHAIN_SVC" -a "$_KP_KEYCHAIN_ACCT" &>/dev/null
@@ -87,12 +86,30 @@ function load_gemini() {
}
function totp() {
local clip=false
[[ "$1" == "-c" ]] && clip=true && shift
local code
case "$1" in
hcf) kptotps "personal/Dev/AWS Console" ;;
aws) kptotps "work/Own/AWS console" ;;
pci) kptotps "work/Own/PCI/AWS Workspaces" ;;
*) echo "Usage: totp {hcf|aws|pci}" >&2; return 1 ;;
hcf) code=$(kptotps "personal/Dev/AWS Console") ;;
aws) code=$(kptotps "work/Own/AWS console") ;;
pci) code=$(kptotps "work/Own/PCI/AWS Workspaces") ;;
*) echo "Usage: totp [-c] {hcf|aws|pci}" >&2; return 1 ;;
esac
echo "$code"
if $clip; then
case "$UNAME_STRING" in
Darwin) echo -n "$code" | pbcopy ;;
Linux) if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then
echo -n "$code" | wl-copy
else
echo -n "$code" | xclip -selection clipboard
fi ;;
esac
echo "(copied to clipboard)"
fi
}
_get_aws_config_path() {
@@ -147,16 +164,23 @@ _awsume_cmd() {
alias asm="_awsume_cmd"
alias tf="terraform"
alias tfi="tf init"
alias tfp="tf plan -lock=false"
alias tfa="tf apply"
alias tfu="tf get -update"
alias tg="terragrunt"
alias tgi="tg init"
alias tgp="tg plan -lock=false"
alias tga="tg apply"
alias tgu="tg get -update"
_ensure_awsume() {
if [[ -z "$AWSUME_PROFILE" ]]; then
echo "No awsume session found. Starting one..."
_awsume_cmd || return 1
fi
}
tf() { _ensure_awsume && terraform "$@"; }
tfi() { _ensure_awsume && terraform init "$@"; }
tfp() { _ensure_awsume && terraform plan -lock=false "$@"; }
tfa() { _ensure_awsume && terraform apply "$@"; }
tfu() { _ensure_awsume && terraform get -update "$@"; }
tg() { _ensure_awsume && terragrunt "$@"; }
tgi() { _ensure_awsume && terragrunt init "$@"; }
tgp() { _ensure_awsume && terragrunt plan -lock=false "$@"; }
tga() { _ensure_awsume && terragrunt apply "$@"; }
tgu() { _ensure_awsume && terragrunt get -update "$@"; }
alias curltime="curl -w \"@$HOME/.curl-format.txt\" -o /dev/null -s "
@@ -196,7 +220,7 @@ git_push() {
local branch
branch=$(git branch --show-current)
git push origin "$branch" $@
git push origin "$branch" "$@"
}
alias gpush="git_push"
@@ -204,7 +228,7 @@ alias gpush="git_push"
passgen() {
length=${1:-"12"}
if [[ "$length" == <-> ]]; then
echo $(cat /dev/urandom| base64 | head -c "$length")
echo $(cat /dev/urandom| base64 -w0 | head -c "$length")
else
echo "passgen() takes a positive integer as first argument"
echo "got $length"

View File

@@ -22,6 +22,8 @@ export SSH_ENV="$HOME/.ssh/agent-environment"
export GOPRIVATE="gitlab.feedzai.com,git.hcf.zone"
export UNAME_STRING=$(uname -s)
. "$HOME/.cargo/env"
# Interactive shells (e.g. new tmux windows): set PATH so we don't need a login shell.
@@ -30,7 +32,7 @@ if [[ -t 0 ]]; then
export PATH=~/.local/bin:$PATH
export PATH=~/.dotnet:$PATH
export PATH=$DOTFILES/scripts/hcf/:$PATH
case "$(uname -s)" in
case "$UNAME_STRING" in
Linux*) eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" ;;
Darwin*)
eval "$(/opt/homebrew/bin/brew shellenv)"

View File

@@ -1,11 +1,8 @@
setopt INC_APPEND_HISTORY
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
setopt HIST_FIND_NO_DUPS # Do not display a previously found event.
setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate.
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
unsetopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
setopt SHARE_HISTORY # Share history between all sessions.
bindkey -e
@@ -25,15 +22,11 @@ setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
DISABLE_AUTO_TITLE="true"
# install zsh-syntax-highlighting
case "$(uname -s)" in
case "$UNAME_STRING" in
Linux*) {
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# make less more friendly for non-text input files, see lesspipe(1)
local lesspipe_bin_location
lesspipe_bin_location=$(which lesspipe)
if [ $? -eq 0 ]; then
[ -x $lesspipe_bin_location ] && eval "$(lesspipe)"
fi
(($+commands[lesspipe])) && eval "$(lesspipe)"
} ;;
Darwin*) {
# Use HOMEBREW_PREFIX (set in .zshenv) to avoid slow brew --prefix subprocess on every new shell
@@ -137,7 +130,3 @@ function +vi-git-extra() {
fi
fi
}
### MANAGED BY RANCHER DESKTOP START (DO NOT EDIT)
export PATH="/Users/inaki.dominguez/.rd/bin:$PATH"
### MANAGED BY RANCHER DESKTOP END (DO NOT EDIT)