Skip to content

Instantly share code, notes, and snippets.

View 15below-adamhancock's full-sized avatar

15below-adamhancock

View GitHub Profile
@15below-adamhancock
15below-adamhancock / delete-evicted-pods-all-namespaces.sh
Last active February 24, 2020 09:24 — forked from svx/delete-evicted-pods-all-namespaces.sh
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces
kubectl get pods --all-namespaces | grep -E 'ImagePullBackOff|ErrImagePull|Evicted' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod -n 15below
# Number of pods not in Running state
kubectl get pods --all-namespaces | sed 's/\s\s*/ /g' | awk '{if(NR>1)print}' | cut -d ' ' -f4 | grep -vx 'Running' | wc -l
# Number of Nodes not in Ready state.
kubectl get nodes | sed 's/\s\s*/ /g' | awk '{if(NR>1)print}' | cut -d ' ' -f2 | grep -xv 'Ready' | wc -l
@15below-adamhancock
15below-adamhancock / generate-ssh-key.sh
Created January 20, 2020 15:00 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
#!/bin/bash
name=`echo $1 | tr -d '.pfx'`
read -s -p "Enter PFX Password: " password
openssl pkcs12 -in $1 -nocerts -nodes -out $name-key.pem -passin pass:$password
echo "Exporting $name.key"
openssl rsa -in $name-key.pem -out $name.key
rm -rf $name-key.pem
echo "Exporting $name-cert.pem"
openssl pkcs12 -in $1 -clcerts -nokeys -out $name-cert.pem -passin pass:$password