Skip to content

Instantly share code, notes, and snippets.

{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "aws-auth",
"namespace": "kube-system",
"uid": "8e201215-2d34-418b-afd1-190ec3a3bc80",
"resourceVersion": "5040",
"creationTimestamp": "2022-09-04T12:39:05Z",
"managedFields": [
@njgibbon
njgibbon / test_divide_bad.py
Created July 23, 2021 18:53
test_divide_bad.py
import unittest
import divide
class TestDivide(unittest.TestCase):
def test_divide_pass_0(self):
try:
self.assertEqual(divide.divide(10, 5), 2)
except:
@njgibbon
njgibbon / test_assertion_error.py
Created July 23, 2021 18:49
test_assertion_error.py
def test(self):
try:
assert False
except AssertionError:
assert True
@njgibbon
njgibbon / test_divide_good.py
Last active July 23, 2021 18:45
test_divide_good.py
import unittest
import divide
class TestDivide(unittest.TestCase):
def test_divide_pass_0(self):
self.assertEqual(divide.divide(10, 5), 2)
def test_divide_pass_1(self):
@njgibbon
njgibbon / divide.py
Created July 23, 2021 18:43
divide.py
def divide(a,b):
return a/b
@njgibbon
njgibbon / remove_k8s_ns_finalizer.sh
Created January 27, 2021 19:37
Force removal of Kubernetes Namespace Finalizer(s).
set -eou pipefail
namespace=$1
if [ -z "$namespace" ]
then
echo "This script requires a namespace argument input. None found. Exiting."
exit 1
fi
kubectl get namespace $namespace -o json | jq '.spec = {"finalizers":[]}' > rknf_tmp.json
kubectl proxy &
sleep 5
@njgibbon
njgibbon / hello_world.py
Created October 11, 2020 14:53
Python Hello World
print("Hello World")
@njgibbon
njgibbon / host-docker-internal-demo.yaml
Created September 29, 2020 21:55
host-docker-internal-demo.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: host-docker-internal-demo
spec:
containers:
- image: alpine
name: alpine
command: ["sh"]
@njgibbon
njgibbon / minimal_zshrc_1.sh
Last active August 9, 2020 17:31
Minimal .zshrc to output git branch name in prompt using vcs_info.
# ~/.zshrc
# Enabling and setting git info var to be used in prompt config.
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
# This line obtains information from the vcs.
zstyle ':vcs_info:git*' formats "- (%b) "
precmd() {
vcs_info
}
@njgibbon
njgibbon / minimal_zshrc_0.sh
Last active January 12, 2021 17:11
Minimal .zshrc to output git branch name in prompt.
# ~/.zshrc
# Find and set branch name var if in git repository.
function git_branch_name()
{
branch=$(git symbolic-ref HEAD 2> /dev/null | awk 'BEGIN{FS="/"} {print $NF}')
if [[ $branch == "" ]];
then
:
else