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
# kubeconfig management | |
function kubeconfig() { | |
local kubeconfigDir="$HOME/.kube/configs" | |
unset KUBECONFIG | |
for config in $(ls -d ${kubeconfigDir}/*); do | |
export KUBECONFIG=$KUBECONFIG:$config | |
done | |
} | |
kubeconfig |
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
function awsaroff { | |
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN | |
aws sts get-caller-identity | |
} | |
function awsar { | |
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN | |
local ARN="$(cat ~/.aws/config | grep "arn:aws" | awk -F " = " '{print $2};' | fzf)" | |
echo "assuming role: ${ARN}" | |
if [[ ! $1 ]]; 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
function versionswitcher { | |
local BINARY="$1" | |
local URL="$2" #must contain 'VERSION' in it somewhere to enable download of different versions | |
local CACHE="${HOME}/.${BINARY}.versions" | |
local DSTFILE="/usr/local/bin/${BINARY}" | |
local TEMPDIR="${CACHE}/tmp" | |
mkdir -p "$CACHE" | |
if [[ ! "$3" ]]; 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
resource "aws_vpc" "vpc" { | |
cidr_block = "10.0.0.0/16" | |
tags = { | |
Name = "test-vpc" | |
} | |
provisioner "local-exec" { | |
when = destroy | |
command = <<EOT |
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
resource "aws_vpc" "vpc" { | |
cidr_block = "10.0.0.0/16" | |
tags = { | |
Name = "test-vpc" | |
} | |
provisioner "local-exec" { | |
when = destroy | |
command = <<EOT |
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 | |
# stashing original context | |
OLD_CONTEXT=$(kubectl config current-context) | |
if [ -z "$1" ]; then | |
NEW_CONTEXT=$(kubectl config get-contexts --output=name | fzf) | |
else | |
NEW_CONTEXT="$1" | |
fi |
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
# git lazy - add all files, commit all files and publish all changes | |
function gl { | |
echo "${BOLD}${MAGENTA}[ Git Lazy ]${END}" | |
PRETTYBRANCH=$(script -q /dev/null git status -sb | head -1) | |
echo "${BLUE}On branch${END} $PRETTYBRANCH" | |
echo "${YELLOW}+ Pull${END}" | |
git pull | |
echo "${YELLOW}+ Adding files${END}" | |
git status -s | |
git add --all |
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
# enable colours | |
RED=$'\e[1;31m' | |
GREEN=$'\e[1;32m' | |
YELLOW=$'\e[1;33m' | |
BLUE=$'\e[1;34m' | |
MAGENTA=$'\e[1;35m' | |
CYAN=$'\e[1;36m' | |
END=$'\e[0m' | |
# enable special text formating |