Skip to content

Instantly share code, notes, and snippets.

Avatar

Roland Eschenburg reschenburgIDBS

View GitHub Profile
View .bash_profile
# 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
@reschenburgIDBS
reschenburgIDBS / .bashrc
Last active Jan 25, 2022
git lazy - aliases/functions for simple repeating git tasks
View .bashrc
# 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
@reschenburgIDBS
reschenburgIDBS / fix-tiller-image.sh
Created Sep 3, 2021
patch tiller image to new ghcr registry
View fix-tiller-image.sh
#!/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
@reschenburgIDBS
reschenburgIDBS / main.tf
Created Oct 23, 2020
terraform Global Accelerator Security Group in VPC workaround
View main.tf
resource "aws_vpc" "vpc" {
cidr_block = "10.0.0.0/16"
tags = {
Name = "test-vpc"
}
provisioner "local-exec" {
when = destroy
command = <<EOT
@reschenburgIDBS
reschenburgIDBS / main.tf
Last active Oct 30, 2020
terraform Global Accelerator Security Group in VPC workaround with assume role support - requires jq installed on the terraforming device!!
View main.tf
resource "aws_vpc" "vpc" {
cidr_block = "10.0.0.0/16"
tags = {
Name = "test-vpc"
}
provisioner "local-exec" {
when = destroy
command = <<EOT
@reschenburgIDBS
reschenburgIDBS / .bashrc
Last active Oct 2, 2020
version switcher for kubectl, kops, helm and terraform - requires https://github.com/junegunn/fzf
View .bashrc
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
@reschenburgIDBS
reschenburgIDBS / .bashrc
Last active Jan 20, 2022
quick aws assume-role based on configured profiles - requires https://github.com/junegunn/fzf and https://stedolan.github.io/jq/
View .bashrc
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
@reschenburgIDBS
reschenburgIDBS / .bashrc
Last active Apr 12, 2021
kubeconfig management
View .bashrc
# kubeconfig management
function kubeconfig() {
local kubeconfigDir="$HOME/.kube/configs"
unset KUBECONFIG
for config in $(ls -d ${kubeconfigDir}/*); do
export KUBECONFIG=$KUBECONFIG:$config
done
}
kubeconfig