Skip to content

Instantly share code, notes, and snippets.

@ragul28
ragul28 / 1_sa-kubeconfig-gen.sh
Last active December 20, 2022 03:54
kubeconfig generator script for service account with RBAC.
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, RBAC role file needed
if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]]; then
echo "usage: $0 <service_account_name> <namespace> [rbac-role-yaml]"
exit 1
fi
@ragul28
ragul28 / webhook_install.sh
Created May 18, 2020 17:01
Easy webhook installation script to systemd.
#!/bin/bash
echo "[-] Installing webhook.."
wget https://github.com/adnanh/webhook/releases/download/2.6.11/webhook-linux-amd64.tar.gz
tar -xvf webhook*.tar.gz
sudo mv webhook-linux-amd64/webhook /usr/local/bin
rm -rf webhook-linux-amd64*
echo "[ok] Installing webhook."
#!/bin/sh
git filter-branch -f --env-filter '
OLD_EMAIL="<OLD_EMAIL>"
CORRECT_NAME="<NAME>"
CORRECT_EMAIL="<EMAIL>"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@ragul28
ragul28 / awsall-cli.sh
Created February 22, 2023 16:33
Run aws command on all regions
function awsall {
export AWS_PAGER=""
for i in `aws ec2 describe-regions – query "Regions[].{Name:RegionName}" – output text|sort -r`
do
echo "------"
echo $i
echo "------"
echo -e "\n"
if [ `echo "$@"|grep -i '\-\-region'|wc -l` -eq 1 ]
then