Skip to content

Instantly share code, notes, and snippets.

View binlab's full-sized avatar
🗡️
Do, or do not. There is no "try"

Mark binlab

🗡️
Do, or do not. There is no "try"
View GitHub Profile
@binlab
binlab / parse_ini.sh
Created August 18, 2021 20:37 — forked from wyllie/parse_ini.sh
Parse aws credentials file in bash
#!/usr/bin/env bash
INI_FILE=~/.aws/credentials
while IFS=' = ' read key value
do
if [[ $key == \[*] ]]; then
section=$key
elif [[ $value ]] && [[ $section == '[default]' ]]; then
if [[ $key == 'aws_access_key_id' ]]; then
@binlab
binlab / kubernetes_add_service_account_kubeconfig.sh
Created March 17, 2020 18:37 — forked from innovia/kubernetes_add_service_account_kubeconfig.sh
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@binlab
binlab / kubernetes_add_service_account_kubeconfig.sh
Last active March 17, 2020 18:37 — forked from xtavras/kubernetes_add_service_account_kubeconfig.sh
create kubernetes service account and corresponding kubeconfig
#!/usr/bin/env bash
# script was taken from https://gist.github.com/innovia/fbba8259042f71db98ea8d4ad19bd708 and adjusted with "apply_rbac" function and colorized output
set -e
set -o pipefail
# Colors
RED="\e[01;31m"
@binlab
binlab / get_latest_release.sh
Created February 19, 2019 09:40 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4