Skip to content

Instantly share code, notes, and snippets.

View triangletodd's full-sized avatar

Todd Edwards triangletodd

View GitHub Profile
@triangletodd
triangletodd / create_pdbs.sh
Last active February 27, 2019 23:48
Create a PDB for all deployments in the default Kubernetes namespace with a minAvailable of 50%
#!/usr/bin/env bash
set -e
template() {
cat <<EOF
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{NAME}}
namespace: default
@triangletodd
triangletodd / working_verify_slack.go
Created February 7, 2019 23:29
Golang Verify Slack
package middlewares
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"github.com/gin-gonic/gin"
)
@triangletodd
triangletodd / .bash_colors
Created December 13, 2018 19:16
Bash Colors
#!/usr/bin/env bash
#░█ ██ ██
#░█ ░██ ░░
#░█ █████ ██████ ░██ ██████ ██████ ██ ██████ █████
#░█ ██░░░██ ██░░░░██ ░██ ██░░░░██░░██░░█░██░░░░██ ██░░░██
#░█ ░██ ░░ ░██ ░██ ░██░██ ░██ ░██ ░ ░██ ██ ░███████
#░█ ░██ ██░██ ░██ ░██░██ ░██ ░██ ░██ ██ ░██░░░░
#░█ ░░█████ ░░██████ ███░░██████ ░███ ░██ ██████░░██████
#░█ ░░░░░ ░░░░░░ ░░░ ░░░░░░ ░░░ ░░ ░░░░░░ ░░░░░░
@triangletodd
triangletodd / README.md
Last active August 6, 2018 17:33 — forked from adambom/README.md
Backup Kubernetes Cluster State

Run this in order to backup all you k8s cluster data. It will be saved in a folder bkp. To restore the cluster, you can run kubectl apply -f bkp.

Please note: this recovers all resources correctly, including dynamically generated PV's. However, it will not recover ELB endpoints. You will need to update any DNS entries manually, and manually remove the old ELB's.

Please note: This has not been tested with all resource types. Supported resource types include:

  • services
  • replicationcontrollers
  • secrets
  • deployments
  • horizontal pod autoscalers
@triangletodd
triangletodd / check-vertica-certificate.py
Created July 26, 2018 17:02
A Nagios compatible script to check your Vertica SSL certificate expiration.
#!/usr/bin/env python
import argparse
import socket
import ssl
import struct
import subprocess
import sys
from datetime import *
@triangletodd
triangletodd / check_apt_updates.sh
Last active June 22, 2018 17:51
Nagios compatible check for pending Ubuntu updates.
#!/bin/sh
#
# Standard Nagios plugin return codes.
STATUS_OK=0
STATUS_WARNING=1
STATUS_CRITICAL=2
STATUS_UNKNOWN=3
# Query pending updates.
updates=$(/usr/lib/update-notifier/apt-check 2>&1)
@triangletodd
triangletodd / bs_deb_stretch_vbox.sh
Created December 25, 2017 05:54
Debian Stretch Virtualbox VM.
#!/usr/bin/env bash
set -e
PACKAGES="i3 tmux vim stow"
read -d '' APT_SRC <<"EOF" ||:
deb http://mirrors.kernel.org/debian/ stretch main contrib non-free
deb http://security.debian.org/debian-security stretch/updates main
deb http://mirrors.kernel.org/debian/ stretch-updates main contrib non-free
deb http://mirrors.kernel.org/debian stretch-backports main contrib non-free
@triangletodd
triangletodd / Makefile
Created November 21, 2017 23:44
Make OPTS example
SHELL := /usr/bin/env bash
RSYNC_OPTS := -av --exclude-from 'rsync-exclude.list'
RSYNC = rsync $(RSYNC_OPTS)
install :
$(RSYNC) $(PWD)/ $(HOME)/
dryinstall : RSYNC_OPTS += --dry-run
dryinstall : install
@triangletodd
triangletodd / gce_ip_ranges.log
Last active November 8, 2019 13:12
Google Compute Engine GCE IP Ranges
8.34.208.0/20
8.35.192.0/21
8.35.200.0/23
23.236.48.0/20
23.251.128.0/19
35.184.0.0/14
35.188.0.0/15
35.190.0.0/17
35.190.128.0/18
35.190.192.0/19
@triangletodd
triangletodd / github_org_backup
Last active November 2, 2017 14:22
Backup your private Github organization.
#!/usr/bin/env bash
set -e
trap cleanup EXIT
cleanup() {
cd "$(dirs -l -0)" && dirs -c
}
setup() {