34 lines
635 B
Bash
Executable File
34 lines
635 B
Bash
Executable File
#!/bin/bash
|
|
|
|
function sanitize-perms {
|
|
chown $USER.$USER . -R
|
|
find . -type d -exec chmod 755 {}\;
|
|
find . -type f -exec chmod 644 {}\;
|
|
}
|
|
|
|
# Kubernetes
|
|
function kres {
|
|
local _O _D
|
|
_O="-ocustom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name"
|
|
_D="[0-9A-Za-z\-]"
|
|
if [ -z "$3" ]; then
|
|
kubectl get $1 -A $_O | grep "$2"
|
|
else
|
|
kubectl get $1 -A $_O | grep "$_D*$2$_D*\s\+$_D*$3$_D*"
|
|
fi
|
|
}
|
|
|
|
function pwgen {
|
|
local _LEN=$1
|
|
case $_LEN in
|
|
''|*[!0-9]*)
|
|
echo "Enter a valid number" > /dev/stderr
|
|
return 1
|
|
;;
|
|
esac
|
|
LC_ALL=C tr -dc '[:graph:]' </dev/urandom | head -c $_LEN
|
|
if [ -t 1 ]; then
|
|
echo
|
|
fi
|
|
}
|