Browse Source

add aliases

master
Marcel Schneider 2 years ago
parent
commit
4c8482e76b
No known key found for this signature in database GPG Key ID: 86027C59718EEE88
  1. 20
      zsh/custom.zsh

20
zsh/custom.zsh

@ -48,3 +48,23 @@ swth()
source ~/.zshrc
fi
}
awscreds() {
SSOFILE=~/.aws/sso/cache/$(\ls -t ~/.aws/sso/cache | head -n 1)
CACHEFILE=~/.aws/cli/cache/$(\ls -t ~/.aws/cli/cache | head -n 1)
export AWS_ACCESS_KEY_ID="$(jq -r '.Credentials.AccessKeyId' $CACHEFILE)" AWS_SECRET_ACCESS_KEY="$(jq -r '.Credentials.SecretAccessKey' $CACHEFILE)"
export AWS_SESSION_TOKEN="$(jq -r '.Credentials.SessionToken' $SSOFILE)"
}
s3bat() {
# create temporary folder
path_hash=$(echo -n "$1" | sha256sum | head -c 64)
tmpfile="/tmp/${path_hash}"
# check if tmpfile already exists
if [[ ! -a "$tmpfile" ]]; then
aws --profile backend s3 cp --request-payer requester $1 "$tmpfile"
fi
bat "$tmpfile"
}
Loading…
Cancel
Save