This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export TMPDIR=/tmp | |
TMPAWSDIR=$(mktemp -d -t aws.XXXXXX) | |
pushd "$TMPAWSDIR" > /dev/null 2>&1 || exit | |
# remove comments from file # split file in multiple ones separated by regex | |
[ -f ~/.aws/config ] && grep -vE "^([[:blank:]]*#+.*$|$)" ~/.aws/config | csplit -s -z -f aws_profile_ -b %03d - '/^\[profile/' '{*}' | |
if [ -f aws_profile_000 ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat yamlfile.yml | python -c 'import sys,json,yaml; print(json.dumps(yaml.safe_load(sys.stdin.read()),indent=2))' | |
# convert a yaml file to json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Save this script on your computer, and give it exec permissions (chmod +x) | |
# To enable it: | |
# Edit or create ~/.vault Add setting: | |
# token_helper = "/full/path/to/script/vault-token-file.sh" | |
# Please refer to: https://www.vaultproject.io/docs/commands/token-helper for further details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This gist has been deprecated. Have a look to: https://github.com/gianluca-mascolo/bash-profile-switcher |