This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# Description: | |
# Check which NetworkPolicies, if any, that block connection between to workloads in a Kubernetes cluster | |
# Requires: https://github.com/kubernetes-sigs/network-policy-api/tree/main/cmd/policy-assistant | |
# Requires: fzf | |
SRC_NS="$(kubectl get ns -o custom-columns='NAME:.metadata.name' --no-headers | fzf --height ~50% --prompt "SRC Namespace> " --border)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
if ! type jq 2>/dev/null 1>/dev/null; then | |
echo "jq command is required, please install it" >&2 | |
exit 1 | |
fi | |
kubectl get pdb -A -o json | \ | |
jq -r '.items[] | {name: .metadata.name, namespace: .metadata.namespace, selector: ((.spec.selector.matchLabels // {} | to_entries | .[] |= "\(.key)=\(.value)") + (.spec.selector.matchExpressions // [] | .[] |= .key + " " + (.operator | ascii_downcase) + " (" + (.values[] | @json) + ")")) | join(",") }' -c | \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
NAMESPACE="$1" | |
if [ "${NAMESPACE}x" = "x" ]; then | |
echo "usage: $(basename "$0") <namespace>" >&2 | |
exit 1 | |
fi | |
kubectl api-resources --namespaced -o name | while read -r resource; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: 3D printer spaghetti detector | |
domain: automation | |
input: | |
printer_status: | |
name: Printer current stage entity | |
selector: | |
entity: | |
filter: | |
- domain: sensor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def k8sunits: capture("(?<num>\\d+)(?<unit>.*)") | (.num | tonumber) * {"": 1, "Ki": 1024, "K": 1000, "Mi": pow(1024; 2), "M": pow(1000; 2), "Gi": pow(1024; 3), "G": pow(1000; 3), "Ti": pow(1024; 4), "T": pow(1000; 4), "Ei": pow(1024; 5), "E": pow(1000; 5), "Pi": pow(1024; 6), "p": pow(1000; 6), "m": 0.001}[.unit]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: batch/v1 | |
kind: Job | |
metadata: | |
labels: | |
app: iperf-test | |
component: client | |
name: iperf-test-client | |
spec: | |
template: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sep() | |
{ | |
( | |
if type "cowsay" > /dev/null < /dev/null; then | |
cowsay "separator" | |
cowsay "separator" | |
cowsay "separator" | |
else | |
echo "*-----------*" | |
echo "| separator |" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function utime() | |
{ | |
if [ $# = 1 ] && ([ "${1:0:1}" = "+" ] || [ "${1:0:1}" = "-" ]) && [ "$1" != "--help" ] | |
then | |
# Do date math | |
date -d "$1" "+%s" | |
elif [ $# = 1 ] && (echo "$1" | grep -P "^[[:digit:]]+$" > /dev/null) | |
then | |
# Convert timestamp to human-readable date | |
date -d "@$1" || help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
groups: | |
- docker | |
users: | |
- default | |
- name: ubuntu | |
ssh-authorized-keys: | |
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCvu0XjgnnODcPW2/g2A63Q9L8nKO1LHx5xAdGEa+YH6SPJYncGYGoW2CfckwnQYPYy1vdWli1ZDnvtn0WIpUIRbyp06aQzX7+Iq/hoae0iRcSYXwRlBgAnYzATmXk7Vby/C5oX8yqoTlmSSjkbynRePLm4xvUoPjDir9Lct6xKeeb0hhJgmc4fByEwgP8LD6MjnViuLHjezScqbgfmKnl4bBVfJIJaOm3IGY4/ps2nH3zPVq1rtFkwqKKSjN374GQ6c8DW1+uBib4SfX8UplLCHt66bsrEZLlTfbYoOAdanbgar9OuzjveENa8wTnj3vON8OW5GhmrOhwPt8CfsOoXTbjM87zPnXkFkg1OS+QuEkwtM3y2KcFKE0ME/tHdBZekkII7NqpUn9WvWoDk+HexeIgfm9ZAgkywdcrObLlCqHreQKTuz5f7gDnUgq7fpYueMc6u03x5gsdVVpszuQwH7YjajD+8YATMsCjP8c85EKL0Nzhs2nSOzL/hMxUm9g6kw4uUXAP3wql7Qf4i24NVWmtd8QXABjXMSYzXw3Xf7619Q3/YadLCiDmmi5ArQjNtIwuL19OHNMjLobvOVIXnksGqABfpkOd9EXKRxCI9sWKb+tmvzAAX+T50l2TSfgdL/dwQIUXkasd8ZpIjXQqOmTh/hegVYtr1Bv0x+vMORQ== | |
sudo: ALL=(ALL) NOPASSWD:ALL | |
groups: sudo, docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$github = "jenrik"; | |
$dbhost = ""; | |
$dbname = ""; | |
$dbuser = ""; | |
$dbpass = ""; | |
header("Cache-control: private, max-age=0, no-cache"); |
NewerOlder