Skip to content

Instantly share code, notes, and snippets.

@yogeshlonkar
Last active September 30, 2019 12:42
Show Gist options
  • Save yogeshlonkar/e60f6cc68608f81c2e392422553a4132 to your computer and use it in GitHub Desktop.
Save yogeshlonkar/e60f6cc68608f81c2e392422553a4132 to your computer and use it in GitHub Desktop.
Useful bash scripts functions in dazn workspace
# requires oathtool configuration
function mfa() {
echo valid $(expr 30 - $(date +%s) % 30)s
oathtool --totp --base32 <mfa-secret-key> | tee /dev/tty | pbcopy
}
# set env for terraform
function dazn_aws_set_env()
{
mfa
if [[ -z $1 ]]; then
acc=dazn-payments-dev
else
acc=$1
fi
echo "Using $acc"
dazn aws exec -p $acc -- echo ""
eval "$(dazn aws exec -p $acc -- printenv | grep AWS_ | sed 's/^/export /g')"
}
# cleanup gone branches
function git_branch_cleanup() {
if [[ "$1" == "-f" ]]; then
git branch -va | grep gone | awk '{print $1}' | xargs git branch -D
else
git branch -va | grep gone
echo 'For cleanup run git_branch_cleanup -f'
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment