Compare commits

..

1 Commits

Author SHA1 Message Date
f31b83ef2b Added tabby to install list
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-01-09 19:03:45 +00:00
68 changed files with 636 additions and 2277 deletions

4
.gitignore vendored
View File

@@ -28,7 +28,3 @@
/home/.kube/*
!/home/.kube/clusters/.gitkeep
!/home/.kube/switch-config.yaml
/home/.k9s/benchmarks
/home/.k9s/clusters
/home/.k9s/screen-dumps

View File

@@ -1,2 +0,0 @@
alias date='gdate'
alias sed='gsed'

View File

@@ -1,55 +0,0 @@
END_CHARS="\e[0m\n"
tput colors &>/dev/null
if [ $? -eq 0 ]; then
bold() {
printf "\e[1m$@${END_CHARS}"
}
italic() {
printf "\e[3m$@${END_CHARS}"
}
underline() {
printf "\e[4m$@${END_CHARS}"
}
orange() {
printf "\e[38;5;208m$@${END_CHARS}"
}
blue() {
printf "\e[38;5;75m$@${END_CHARS}"
}
green() {
printf "\e[32;5;75m$@${END_CHARS}"
}
else
bold() {
echo $@
}
italic() {
echo $@
}
underline() {
echo $@
}
orange() {
echo $@
}
blue() {
echo $@
}
green() {
echo $@
}
fi
_fzf() {
fzf --multi --ansi -i -1 --height=50% --reverse -0 --header-lines=1 --border --info=hidden
}

View File

@@ -1,38 +0,0 @@
#!/usr/bin/env bash
source .utils
REGIONS=( $(aws ec2 describe-regions --region eu-west-1 | jq -r '.Regions[].RegionName') )
INSTANCE_TYPES=()
print_usage() {
orange "aws-instance-type-availability - check EC2 instance type availability in all regions"
echo " "
underline "Usage:"
echo "aws-instance-type-availability [instance type IDs]"
echo " "
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
INSTANCE_TYPES+=${1}
break
;;
esac
done
for INSTANCE in "${INSTANCE_TYPES[@]}"; do
blue "${INSTANCE} availability:"
for REGION in "${REGIONS[@]}"; do
aws ec2 describe-instance-type-offerings --filters Name=instance-type,Values=${INSTANCE} --region ${REGION} | jq -r '.InstanceTypeOfferings[0].Location | select( . != null )'
done
echo ""
done

View File

@@ -1,68 +0,0 @@
#!/usr/bin/env bash
source .utils
set -e
VERBOSE=""
ALL=""
TARGET_RESOURCE="kustomization"
NAMESPACES="-n flux-system"
print_usage() {
blue "flux-pause - Suspends Flux Kustomization resources"
echo " "
underline "Usage:"
echo "flux-pause [options] RESOURCE_NAME..."
echo " "
underline "Options:"
echo " --all pause all Kustomizations"
echo "-n, --namespace the namespace resources belong in. Default: flux-system"
echo "-v --verbose show full verbose output"
echo "-h, --help show this help text"
}
RESOURCES=()
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
-n|--namespace)
shift
NAMESPACES="-n $1"
shift
;;
-v|--verbose)
VERBOSE="true"
shift
;;
--all)
ALL="true"
shift
;;
*)
RESOURCES+=(${1})
shift
;;
esac
done
if [[ "${ALL}" == "true" ]]; then
RESOURCES=$(kubectl get kustomization ${NAMESPACES} -o json | jq -r '.items[] | "\( .metadata.name)"')
fi
for RESOURCE in ${RESOURCES[@]}
do
printf "Pausing '${RESOURCE}'..."
if [[ "${VERBOSE}" == "true" ]]; then
echo ""
flux suspend kustomization ${NAMESPACES} ${RESOURCE} || true
else
flux suspend kustomization ${NAMESPACES} ${RESOURCE} &> /dev/null || true
printf " ✅"
fi
echo ""
done

View File

@@ -1,129 +0,0 @@
#!/usr/bin/env bash
source .utils
set -e
VERBOSE=""
TARGET_RESOURCE="all"
NAMESPACES="-A"
print_usage() {
blue "flux-refresh - Refresh all flux resources"
echo " "
underline "Usage:"
echo "flux-refresh [options]"
echo " "
underline "Options:"
echo "-t, --type the resource type to target. Valid options: gitrepo, helmrepository, kustomization, helmrelease & all. Default: all"
echo "-n, --namespace the namespace resources belong in. Default: all namespaces"
echo " --verbose show full verbose output"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
-t|--type)
shift
TARGET_RESOURCE=$1
shift
;;
-n|--namespace)
shift
NAMESPACES="-n $1"
shift
;;
--verbose)
VERBOSE="true"
shift
;;
*)
shift
;;
esac
done
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "gitrepo" ]]; then
GITREPOS=$(kubectl get gitrepo ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
fi
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "helmrepository" ]]; then
HELMREPOS=$(kubectl get helmrepository ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
fi
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "kustomization" ]]; then
KUSTOMIZATIONS=$(kubectl get kustomization ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
fi
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "helmrelease" ]]; then
HEALMRELEASES=$(kubectl get helmrelease ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
fi
if [[ "${GITREPOS}" != "" ]]; then
blue "Refreshing GitRepositories"
for RESOURCE in ${GITREPOS}
do
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
printf "${PARTS[0]}/${PARTS[2]}"
if [[ "${VERBOSE}" == "true" ]]; then
echo ""
flux reconcile source git -n ${PARTS[0]} ${PARTS[2]} || true
else
flux reconcile source git -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
printf " ✅"
fi
echo ""
done
fi
if [[ "${HELMREPOS}" != "" ]]; then
blue "Refreshing HelmRepositories"
for RESOURCE in ${HELMREPOS}
do
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
printf "${PARTS[0]}/${PARTS[2]}"
if [[ "${VERBOSE}" == "true" ]]; then
echo ""
flux reconcile source helm -n ${PARTS[0]} ${PARTS[2]} || true
else
flux reconcile source helm -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
printf " ✅"
fi
echo ""
done
fi
if [[ "${KUSTOMIZATIONS}" != "" ]]; then
blue "Refreshing Kustomizations"
for RESOURCE in ${KUSTOMIZATIONS}
do
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
printf "${PARTS[0]}/${PARTS[2]}"
if [[ "${VERBOSE}" == "true" ]]; then
echo ""
flux reconcile kustomization -n ${PARTS[0]} ${PARTS[2]} || true
else
flux reconcile kustomization -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
printf " ✅"
fi
echo ""
done
fi
if [[ "${HEALMRELEASES}" != "" ]]; then
blue "Refreshing HelmReleases"
for RESOURCE in ${HEALMRELEASES}
do
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
printf "${PARTS[0]}/${PARTS[2]}"
if [[ "${VERBOSE}" == "true" ]]; then
echo ""
flux reconcile helmrelease -n ${PARTS[0]} ${PARTS[2]} || true
else
flux reconcile helmrelease -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
printf " ✅"
fi
echo ""
done
fi

View File

@@ -1,43 +0,0 @@
#!/usr/bin/env bash
source .utils
set -e
print_usage() {
blue "flux-resume-all - Resume all flux resources"
echo " "
underline "Usage:"
echo "flux-resume-all [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
KUSTOMIZATIONS=$(kubectl get kustomization -A -o json | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
GITREPOS=$(kubectl get gitrepo -A -o json | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
if [[ "${KUSTOMIZATIONS}" == "" ]] && [[ "${GITREPOS}" == "" ]]; then
italic "Nothing to resume"
fi
for RESOURCE in ${KUSTOMIZATIONS} ${GITREPOS}
do
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
blue "Resuming ${PARTS[1]} - ${PARTS[0]}/${PARTS[2]}"
kubectl patch ${PARTS[1]} -n ${PARTS[0]} ${PARTS[2]} -p '{"spec":{"suspend":null}}' --type merge
done

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env bash
source .utils
set -e
print_usage() {
blue "flux-state - Check if any Flux resources are suspended"
echo " "
underline "Usage:"
echo "flux-state [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
blue "'kustomization' resources:"
KUSTOMIZATIONS=$(kubectl get kustomization -A -o json)
echo ${KUSTOMIZATIONS} | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .metadata.name) - ⚠Suspended"' | column -t
echo ${KUSTOMIZATIONS} | jq -r '.items[] | select(.spec.suspend!=true) | "\(.metadata.namespace)/\( .metadata.name) - ⚡Active"' | column -t
echo ""
blue "'gitrepo' resources:"
GITREPOS=$(kubectl get gitrepo -A -o json)
echo ${GITREPOS} | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .metadata.name) - ⚠Suspended"' | column -t
echo ${GITREPOS} | jq -r '.items[] | select(.spec.suspend!=true) | "\(.metadata.namespace)/\( .metadata.name) - ⚡Active"' | column -t

74
home/.bin/gs-create-cluster Executable file
View File

@@ -0,0 +1,74 @@
#!/usr/bin/env bash
NAMESPACE="org-giantswarm"
RELEASE="20.0.0-alpha1"
PROVIDER="aws"
AZS="eu-west-1a"
print_usage() {
echo "gs-create-cluster - create a Giant Swarm managed workload cluster"
echo " "
echo "gs-create-cluster [cluster-name]"
echo " "
echo " "
echo "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the cluster is in (default: org-giantswarm)"
echo "-r, --release the namespace the cluster is in (default: 20.0.0-alpha1)"
echo "-p, --provider the cloud provider to use (default: aws)"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-r|--release)
shift
RELEASE=$1
shift
;;
-p|--provider)
shift
PROVIDER=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
# Positional args
NAME=${1:-wc001}
PREFIXED_NAMESPACE="org-$NAMESPACE"
case $NAMESPACE in org-*)
PREFIXED_NAMESPACE="$NAMESPACE"
NAMESPACE=${NAMESPACE#"org-"}
esac
echo "✨ Pre-flight checks"
gs-get-cluster --namespace ${PREFIXED_NAMESPACE} ${NAME} &>/dev/null
if [ $? -eq 0 ]; then
echo "Cluster named '${NAME}' already exists"
exit 1
else
echo "Cleaning up any old awsclusterroleidentities..."
kubectl delete --namespace ${PREFIXED_NAMESPACE} awsclusterroleidentities ${NAME} 2>/dev/null
fi
echo "✨ Creating an ${PROVIDER} cluster called '${NAMESPACE}/${NAME}' with release '${RELEASE}'"
kubectl-gs template cluster --provider ${PROVIDER} --release ${RELEASE} --organization ${NAMESPACE} --name ${NAME} --description "$(whoami)'s test cluster" | kubectl apply -f -
echo "✨ Adding node pool to cluster"
kubectl-gs template nodepool --provider ${PROVIDER} --release ${RELEASE} --organization ${NAMESPACE} --cluster-name ${NAME} --description "$(whoami)'s test cluster" --availability-zones ${AZS} | kubectl apply -f -
echo "✨ Checking status..."
gs-get-cluster --namespace ${PREFIXED_NAMESPACE} ${NAME}

35
home/.bin/gs-get-cluster Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -e
NAMESPACE="org-giantswarm"
print_usage() {
echo "gs-get-cluster - get a Giant Swarm managed workload cluster"
echo " "
echo "gs-get-cluster [cluster-name]"
echo " "
echo " "
echo "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the cluster is in (default: org-giantswarm)"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
kubectl-gs get cluster --namespace $NAMESPACE $@ 2>/dev/null || kubectl get cl --namespace $NAMESPACE $@

82
home/.bin/gs-login Executable file
View File

@@ -0,0 +1,82 @@
#!/usr/bin/env bash
TTL="8h"
CERTIFICATE_GROUP="system:masters"
DEBUG=""
print_usage() {
echo "gs-login - login to Giant Swarm managed clusters"
echo " "
echo "gs-login [INSTALLATION] [WORKLOAD CLUSTER] [ORGANISATION]"
echo " "
echo "Examples:"
echo "> gs-login gauss"
echo "> gs-login gauss mywc1"
echo " "
echo "Options:"
echo "-h, --help show this help text"
echo "-t, --ttl the certificate ttl for the workload cluster login (default: 8h)"
echo "-g, --certificate-group the certificate group to login as on the workload cluster (default: system:masters)"
}
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-t|--ttl)
shift
TTL=$1
shift
;;
-g|--certificate-group)
shift
CERTIFICATE_GROUP=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
--debug)
DEBUG="--debug"
shift
;;
/)
# We want to ignore slash seperators between MC and WC
shift
;;
*)
POS_ARGS+=(`echo $1 | tr '/' ' '`)
shift
;;
esac
done
if [ ${#POS_ARGS[@]} -eq 0 ]; then
POS_ARGS+=(`opsctl list installations --short | tr ' ' '\n' | fzf`)
fi
MC_EXIST=$(kubectl config get-contexts --no-headers -o name gs-${POS_ARGS[0]} 2>/dev/null | wc -l | xargs)
case ${#POS_ARGS[@]} in
1)
kubectl config delete-context gs-${POS_ARGS[0]} &>/dev/null
kubectl gs login ${POS_ARGS[0]} ${DEBUG} 2>/dev/null || opsctl kgs login -i ${POS_ARGS[0]} || opsctl create kubeconfig -i ${POS_ARGS[0]}
;;
2)
if [ ${MC_EXIST} -eq 0 ]; then gs-login ${POS_ARGS[0]}; fi
kubectl gs login ${POS_ARGS[0]} --workload-cluster ${POS_ARGS[1]} --certificate-group ${CERTIFICATE_GROUP} --certificate-ttl ${TTL} ${DEBUG}
;;
3)
if [ ${MC_EXIST} -eq 0 ]; then gs-login ${POS_ARGS[0]}; fi
ORG_FLAG="--organization ${POS_ARGS[2]}"
if [[ "${POS_ARGS[2]}" == "default" ]]; then
ORG_FLAG="--insecure-namespace"
fi
kubectl gs login ${POS_ARGS[0]} --workload-cluster ${POS_ARGS[1]} --certificate-group ${CERTIFICATE_GROUP} --certificate-ttl ${TTL} ${ORG_FLAG} ${DEBUG}
;;
*)
print_usage
exit 1
;;
esac

103
home/.bin/gs-release Executable file
View File

@@ -0,0 +1,103 @@
#!/usr/bin/env bash
set -e
print_usage() {
echo "gs-release - create a new release of a Giant Swarm repo"
echo " "
echo "gs-release [SEMVER LEVEL]"
echo " "
echo " "
echo "Options:"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
SEMVER=$1
CURRENT_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
MAIN_BRANCH=$(git remote show origin 2>/dev/null|grep HEAD|sed 's/.* //')
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
if [ "$MAIN_BRANCH" != "$CURRENT_BRANCH" ]; then
echo "Not currently on main branch, please switch to ${MAIN_BRANCH} to perform a release"
exit 1
fi
VERSION_PARTS=($(echo $CURRENT_TAG | tr "." "\n"))
VERSION_MAJOR=${VERSION_PARTS[0]}
VERSION_MINOR=${VERSION_PARTS[1]}
VERSION_PATCH=${VERSION_PARTS[2]}
echo "The latest released version is ${CURRENT_TAG}"
echo ""
if [[ "$SEMVER" == "" ]]; then
printf "What semver release level? (patch, minor or major): "
read SEMVER
fi
case ${SEMVER} in
patch)
VERSION_PATCH=$((VERSION_PATCH+1))
;;
minor)
VERSION_MINOR=$((VERSION_MINOR+1))
VERSION_PATCH=0
;;
major)
if [[ ${VERSION_MAJOR:0:1} == "v" ]]; then
VERSION_MAJOR="v$((VERSION_MAJOR+1))"
else
VERSION_MAJOR=$((VERSION_MAJOR+1))
fi
VERSION_MINOR=0
VERSION_PATCH=0
;;
*)
echo "Unknown Semver level provided"
exit 1
;;
esac
NEW_VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
NEW_BRANCH="${MAIN_BRANCH}#release#${NEW_VERSION}"
echo ""
echo "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "
echo "Current version ${CURRENT_TAG}"
echo " New version ${NEW_VERSION}"
echo " Release branch ${NEW_BRANCH}"
echo "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "
echo ""
printf "Confirm? (y/n): "
read CONFIRM
if [ "${CONFIRM}" = "y" ]; then
echo "Publishing new release branch..."
git checkout -b "${NEW_BRANCH}"
git push -u origin "${NEW_BRANCH}"
ORG_NAME=$(git remote get-url origin | sed 's/.*github.com[:|\/]//' | sed 's/\.git$//' | tr '/' ' ' | awk '{print $1}')
REPO_NAME=$(git remote get-url origin | sed 's/.*github.com[:|\/]//' | sed 's/\.git$//' | tr '/' ' ' | awk '{print $2}')
echo "🚀 Keep an eye on https://github.com/${ORG_NAME}/${REPO_NAME}/pulls for the new release PR"
else
echo "Aborting..."
exit 1
fi

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env bash
source .utils
print_usage() {
orange "jq-test - interactively use JQ against a json file"
echo " "
underline "Usage:"
echo "jq-test [FILE]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
POS_ARGS+=$1
shift
;;
esac
done
if [ ${#POS_ARGS[@]} -eq 0 ]
then
print_usage
exit 0
fi
echo '' | fzf --preview "jq {q} < ${POS_ARGS[@]}"

View File

@@ -1,141 +0,0 @@
#!/usr/bin/env bash
source .utils
NAME=""
VERSION="1.34.0@sha256:7416a61b42b1662ca6ca89f02028ac133a309a2a30ba309614e8ec94d976dc5a"
NODES="2"
FEATURE_GATES="MutatingAdmissionPolicy"
RUNTIME_CONFIG="admissionregistration.k8s.io/v1alpha1"
AUDIT_POLICY=""
print_usage() {
orange "kind-create-cluster - create a Kind cluster"
echo " "
underline "Usage:"
echo "kind-create-cluster [cluster-name]"
echo " "
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-v, --version the version of kubernetes to use (default: ${VERSION})"
echo "-n, --nodes the number of worker nodes (default: ${NODES})"
echo "-f, --feature-gates a comma seperated list of feature-gates to enable (default: ${FEATURE_GATES})"
echo "-r, --runtime-config a comma seperated list of API versions to enable (default: ${RUNTIME_CONFIG})"
echo " --audit-policy a file containing the audit policy config"
}
while test $# -gt 0; do
case "$1" in
-n|--nodes)
shift
NODES=$1
shift
;;
-v|--version)
shift
VERSION=$1
shift
;;
-f|--feature-gates)
shift
FEATURE_GATES=$1
shift
;;
-r|--runtime-config)
shift
RUNTIME_CONFIG=$1
shift
;;
--audit-policy)
shift
AUDIT_POLICY=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
# Positional args
NAME=${1:-$(LC_ALL=C tr -dc a-z </dev/urandom | head -c 10)}
function node() {
TYPE=$1
COUNT=$2
for ((i = 1 ; i <= $COUNT ; i++)); do
echo "- role: ${TYPE}"
echo " image: kindest/node:${VERSION}"
if [[ "${AUDIT_POLICY}" != "" ]]; then
if [[ "${TYPE}" == "control-plane" ]]; then
echo " kubeadmConfigPatches:"
echo " - |"
echo " kind: ClusterConfiguration"
echo " apiServer:"
echo " extraArgs:"
echo " audit-log-path: /var/log/kubernetes/kube-apiserver-audit.log"
echo " audit-policy-file: /etc/kubernetes/policies/audit-policy.yaml"
echo " extraVolumes:"
echo " - name: audit-policies"
echo " hostPath: /etc/kubernetes/policies"
echo " mountPath: /etc/kubernetes/policies"
echo " readOnly: true"
echo " pathType: "DirectoryOrCreate""
echo " - name: "audit-logs""
echo " hostPath: "/var/log/kubernetes""
echo " mountPath: "/var/log/kubernetes""
echo " readOnly: false"
echo " pathType: DirectoryOrCreate"
echo " extraMounts:"
echo " - hostPath: ${AUDIT_POLICY}"
echo " containerPath: /etc/kubernetes/policies/audit-policy.yaml"
echo " readOnly: true"
fi
fi
done
}
function feature-gates() {
if [[ "${FEATURE_GATES}" != "" ]]; then
echo "featureGates:"
FEATURES=(${FEATURE_GATES//,/ })
for f in "${FEATURES[@]}"; do
echo " \"${f}\": true"
done
fi
}
function runtime-config() {
if [[ "${RUNTIME_CONFIG}" != "" ]]; then
echo "runtimeConfig:"
RUNTIME=(${RUNTIME_CONFIG//,/ })
for f in "${RUNTIME[@]}"; do
echo " \"${f}\": true"
done
fi
}
CONFIG="kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: ${NAME}
nodes:
$(node "control-plane" 1)
$(node "worker" $NODES)
$(feature-gates)
$(runtime-config)
"
CONFIG_FILE=`mktemp`
echo "${CONFIG}" > ${CONFIG_FILE}
cat ${CONFIG_FILE}
kind create cluster --config ${CONFIG_FILE}
kind get kubeconfig --name ${NAME} > ~/.kube/clusters/kind.yaml

View File

@@ -1,22 +0,0 @@
#!/usr/bin/env bash
source .utils
CONTEXT_NAME=$(kubectl config current-context | sed -e "s/kind-//")
print_usage() {
orange "kind-delete-cluster - delete a Kind cluster"
echo " "
underline "Usage:"
echo "kind-delete-cluster [cluster-name]"
echo " "
echo "If no cluster-name is provided it will attempt to get it from the current kubectl context"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
# Positional args
NAME=${1:-${CONTEXT_NAME}}
kind delete cluster --name ${NAME}

View File

@@ -1,53 +0,0 @@
#!/usr/bin/env zsh
source .utils
TAG_COUNT=5
MINOR_VERSION="v1."
print_usage() {
orange "kind-list-images - List latest images for use with Kind nodes"
echo " "
underline "Usage:"
echo "kind-list-images [minor-version]"
echo " "
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --last-n-minors return the last n minor versions (default: ${TAG_COUNT})"
}
while test $# -gt 0; do
case "$1" in
-n|--last-n-minors)
shift
TAG_COUNT=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
MINOR_VERSION=$1
shift
;;
esac
done
TAGS=( $(crane ls kindest/node | sort | grep 'v1.' | grep -vE 'alpha|beta' | grep ${MINOR_VERSION}) )
declare -A latestMinor
for TAG in "${TAGS[@]}"; do
MINOR="${TAG%.*}"
latestMinor[$MINOR]=$TAG
done
RETURN_TAGS=( $(echo $latestMinor | tr ' ' '\n' | sort -r | head -n ${TAG_COUNT}) )
for TAG in "${RETURN_TAGS[@]}"; do
echo " - kindest/node:$(blue $TAG)@$(crane digest kindest/node:$TAG)"
done

View File

@@ -1,20 +1,18 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
NAMESPACE=${NAMESPACE:-default}
LABEL=""
ALL_NAMESPACES=false
print_usage() {
blue "kube-all - A better 'kubectl get all' - actually get all Kubernetes resources, including custom resources"
echo "kube-all - A better 'kubectl get all' - actually get all Kubernetes resources, including custom resources"
echo " "
underline "Usage:"
echo "kube-all [options]"
echo " "
underline "Options:"
echo "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the to search in"
echo "-l, --selector the label selector to match on"
@@ -47,17 +45,14 @@ while test $# -gt 0; do
esac
done
NAMESPACED="--namespaced"
if [[ "${LABEL}" != "" ]]; then
LABEL="-l ${LABEL}"
NAMESPACED=""
fi
NAMES="$(kubectl api-resources ${NAMESPACED} --verbs list -o name | tr '\n' ,)"
NAMES="$(kubectl api-resources --namespaced --verbs list -o name | tr '\n' ,)"
if [[ "$ALL_NAMESPACES" == "true" ]]; then
kubectl get "${NAMES::${#NAMES}-1}" --show-kind --ignore-not-found ${LABEL} -A 2>/dev/null
kubectl get "${NAMES::${#NAMES}-1}" --show-kind --ignore-not-found ${LABEL} -A
else
kubectl get "${NAMES::${#NAMES}-1}" --show-kind --ignore-not-found ${LABEL} -n ${NAMESPACE} 2>/dev/null
kubectl get "${NAMES::${#NAMES}-1}" --show-kind --ignore-not-found ${LABEL} -n ${NAMESPACE}
fi

View File

@@ -1,20 +1,17 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
LABEL=""
ALL_NAMESPACES=false
print_usage() {
blue "kube-clean-replicasets - Remove all olf ReplicaSets with 0 desired pods"
echo "kube-clean-replicasets - Remove all olf ReplicaSets with 0 desired pods"
echo " "
underline "Usage:"
echo "kube-clean-replicasets [options]"
echo " "
underline "Options:"
echo "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the to search in"
echo "-l, --selector the label selector to match on"

View File

@@ -1,29 +0,0 @@
#!/usr/bin/env bash
source .utils
set -e
print_usage() {
blue "kube-count-events - Counts events by type"
echo " "
underline "Usage:"
echo "kube-count-events [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
kubectl get events -A | awk '{ print $4 }' | sort | uniq -c | sort -bgr

View File

@@ -1,61 +0,0 @@
#!/usr/bin/env bash
source .utils
set -e
WEBHOOK_TYPE="mutating"
print_usage() {
blue "kube-disable-webhook - Disabled a webhook by modifying the namespace selector"
echo " "
underline "Usage:"
echo "kube-disable-webhook [options] NAME"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-t, --type the type of webhook [mutating (default), validating]"
}
while test $# -gt 0; do
case "$1" in
-t|--type)
shift
WEBHOOK_TYPE=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
NAME=${1}
FAKE_SELECTOR='"namespaceSelector":{"matchExpressions":[{"key":"disabled","operator":"In","values":["webhook"]}]}'
if [[ "${WEBHOOK_TYPE}" == "mutating" ]]; then
printf "🚫 Disabling mutating webhook ${NAME}..."
kubectl annotate mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state="$(kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json)" &>/dev/null
HOOKS=$(kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
for HOOK in ${HOOKS}
do
kubectl patch mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -p '{"webhooks": [{"name": "'${HOOK}'", '${FAKE_SELECTOR}'}]}' 1>/dev/null
done
printf " ✅ Done"
elif [[ "${WEBHOOK_TYPE}" == "validating" ]]; then
printf "🚫 Disabling validating webhook ${NAME}..."
kubectl annotate validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state="$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json)" &>/dev/null
HOOKS=$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
for HOOK in ${HOOKS}
do
kubectl patch validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -p '{"webhooks": [{"name": "'${HOOK}'", '${FAKE_SELECTOR}'}]}' 1>/dev/null
done
printf " ✅ Done"
else
echo "Unknown webhook type"
exit 1
fi

View File

@@ -1,94 +0,0 @@
#!/usr/bin/env bash
source .utils
set -e
NAMESPACE=""
CONTEXT="$(kubectl config current-context)"
print_usage() {
blue "kube-empty-namespace - Force delete all resources in the provided namespace"
echo " "
underline "Usage:"
echo "kube-empty-namespace"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo " --context sets the context from the kubeconfig to use"
echo "-n, --namespace the namespace the resources are in (required)"
}
YOLO="0"
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
--context)
shift
CONTEXT="$1"
shift
;;
--yolo)
YOLO="1"
shift
;;
*)
POS_ARGS+=(`echo $1 | tr '/' ' '`)
shift
;;
esac
done
if [[ "${NAMESPACE}" == "" ]]; then
echo "Please provide the namespace to empty"
exit 1
fi
function deleteResource() {
RES="${1//.v1/}"
kubectl --context "${CONTEXT}" patch -p '{"metadata":{"finalizers":null}}' --type=merge -n ${NAMESPACE} ${RES} 1>/dev/null || printf ""
kubectl --context "${CONTEXT}" delete -n ${NAMESPACE} ${RES} 2>/dev/null || printf ""
}
printf "⚠️ This could leave cloud resources undeleted if finalizers aren't honoured ⚠️\n\n"
RESOURCES=()
if [[ "${YOLO}" == 0 ]]; then
printf "Are you sure you want to force delete all resources in '${NAMESPACE}'? (y/n): "
read CONFIRM
else
echo ""
echo ""
orange "YOLO MODE!!! (What could go wrong?!)"
CONFIRM="y"
fi
if [ "${CONFIRM}" = "y" ]; then
echo ""
echo "💣 OK, I hope you know what you're doing..."
echo "Deleting all resources in namespace '${NAMESPACE}'"
echo ""
NAMES="$(kubectl --context "${CONTEXT}" api-resources --namespaced --verbs list -o name 2>/dev/null | tr '\n' ,)"
RESOURCES=$(kubectl --context "${CONTEXT}" get "${NAMES::${#NAMES}-1}" --ignore-not-found -n ${NAMESPACE} -o go-template='{{range.items}}{{.kind}}.{{.apiVersion}}/{{.metadata.name}}{{"\n"}}{{end}}' 2>/dev/null | tr '[:upper:]' '[:lower:]' | sed -r "s|/(v.+)/|/|g")
IFS='
'
for RESOURCE in ${RESOURCES}
do
deleteResource ${RESOURCE}
done
else
echo "Aborting..."
exit 1
fi

View File

@@ -1,20 +1,17 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
POD=""
CMD="sh"
print_usage() {
blue "kube-exec - execute commands within a pod"
echo "kube-exec - execute commands within a pod"
echo " "
underline "Usage:"
echo "kube-exec [options]"
echo " "
underline "Options:"
echo "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the pod is in"
echo "-p, --pod the name of the pod"
@@ -56,9 +53,9 @@ if [[ "$POD" == "" ]]; then
exit 1
)
pod=($(kubectl get pods --all-namespaces -o wide | _fzf | awk '{print $1, $2}'))
POD=${pod[1]}
NAMESPACE=${pod[0]}
pod=($(kubectl get pods --all-namespaces -owide | fzf | awk '{print $1, $2}'))
POD=$pod[1]
NAMESPACE=$pod[0]
fi
echo kubectl exec -it --namespace $NAMESPACE $POD $CMD

View File

@@ -1,113 +0,0 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
SELECTOR=""
CONTEXT="$(kubectl config current-context)"
print_usage() {
blue "kube-force-delete - Force delete resources, even those with finalizers"
echo " "
underline "Usage:"
echo "kube-force-delete [RESOURCE_TYPE] [RESOURCE_NAME]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo " --context sets the context from the kubeconfig to use"
echo "-n, --namespace the namespace the resource is in (default: current namespace)"
}
YOLO="0"
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-l|--selector)
shift
SELECTOR="$1"
shift
;;
-h|--help)
print_usage
exit 0
;;
--context)
shift
CONTEXT="$1"
shift
;;
--yolo)
YOLO="1"
shift
;;
/)
# We want to ignore slash seperators between resource types and names
shift
;;
*)
POS_ARGS+=(`echo $1 | tr '/' ' '`)
shift
;;
esac
done
if [ ${#POS_ARGS[@]} -lt 2 ] && [[ "${SELECTOR}" == "" ]]; then
echo "Please provide the resource type and name to delete"
exit 1
fi
function deleteResource() {
RES="${1//.v1/}"
echo "Deleting ${RES}"
kubectl --context "${CONTEXT}" patch -p '{"metadata":{"finalizers":null}}' --type=merge -n ${NAMESPACE} ${RES} 1>/dev/null|| printf ""
kubectl --context "${CONTEXT}" delete -n ${NAMESPACE} ${RES} 2>/dev/null || printf ""
}
printf "⚠️ This could leave cloud resources undeleted if finalizers aren't honoured ⚠️\n\n"
RESOURCES=()
if [[ "${SELECTOR}" == "" ]]; then
printf "Are you sure you want to delete ${POS_ARGS[0]}/${POS_ARGS[1]}? (y/n): "
RESOURCES=("${POS_ARGS[0]}/${POS_ARGS[1]}")
else
printf "Are you sure you want to delete all matching '${SELECTOR}'? (y/n): "
fi
if [[ "${YOLO}" == 0 ]]; then
read CONFIRM
else
echo ""
echo ""
orange "YOLO MODE!!! (What could go wrong?!)"
CONFIRM="y"
fi
if [ "${CONFIRM}" = "y" ]; then
echo ""
echo "💣 OK, I hope you know what you're doing..."
if [[ "${SELECTOR}" != "" ]]; then
SELECTOR="-l ${SELECTOR}"
NAMES="$(kubectl --context "${CONTEXT}" api-resources --verbs list -o name 2>/dev/null | tr '\n' ,)"
RESOURCES=$(kubectl --context "${CONTEXT}" get "${NAMES::${#NAMES}-1}" --ignore-not-found ${SELECTOR} -n ${NAMESPACE} -o go-template='{{range.items}}{{.kind}}.{{.apiVersion}}/{{.metadata.name}}{{"\n"}}{{end}}' 2>/dev/null | tr '[:upper:]' '[:lower:]' | sed -r "s|/(v.+)/|/|g")
fi
IFS='
'
for RESOURCE in ${RESOURCES}
do
deleteResource ${RESOURCE}
done
else
echo "Aborting..."
exit 1
fi

View File

@@ -1,20 +1,16 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
HOST_PORT=10001
print_usage() {
blue "kube-forward-all - create port-forwards for all pods in the given namespace"
echo "kube-forward-all - create port-forwards for all pods in the given namespace"
echo " "
underline "Usage:"
echo "kube-forward-all [options]"
echo " "
underline "Options:"
echo "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace to launch the pod in"
echo "-p, --port the port to start at (and increment from for each service) (default: 10001)"

View File

@@ -1,20 +1,17 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
POD=""
ARGS=""
print_usage() {
blue "kube-logs - tail logs from a pod"
echo "kube-logs - tail logs from a pod"
echo " "
underline "Usage:"
echo "kube-logs [options]"
echo " "
underline "Options:"
echo "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the pod is in"
echo "-p, --pod the name of the pod to get logs for"
@@ -56,9 +53,9 @@ if [[ "$POD" == "" ]]; then
exit 1
)
pod=($(kubectl get pods --all-namespaces -o wide | _fzf | awk '{print $1, $2}'))
POD=${pod[1]}
NAMESPACE=${pod[0]}
pod=($(kubectl get pods --all-namespaces -owide | fzf | awk '{print $1, $2}'))
POD=$pod[1]
NAMESPACE=$pod[0]
fi
echo kubectl logs -f $ARGS --namespace $NAMESPACE $POD

View File

@@ -1,51 +0,0 @@
#!/usr/bin/env bash
source .utils
set -e
WEBHOOK_TYPE="mutating"
print_usage() {
blue "kube-reenable-webhook - Re-enable a previously disabled webhook"
echo " "
underline "Usage:"
echo "kube-reenable-webhook [options] NAME"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-t, --type the type of webhook [mutating (default), validating]"
}
while test $# -gt 0; do
case "$1" in
-t|--type)
shift
WEBHOOK_TYPE=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
NAME=${1}
FAKE_SELECTOR='"namespaceSelector":{"matchExpressions":[{"key":"disabled","operator":"In","values":["webhook"]}]}'
if [[ "${WEBHOOK_TYPE}" == "mutating" ]]; then
printf "🔌 Re-enabling mutating webhook ${NAME}..."
kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o custom-columns="prev:.metadata.annotations.previous-state" --no-headers | kubectl apply -f -
printf " ✅ Done"
elif [[ "${WEBHOOK_TYPE}" == "validating" ]]; then
printf "🔌 Re-enabling validating webhook ${NAME}..."
kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o custom-columns="prev:.metadata.annotations.previous-state" --no-headers | kubectl apply -f -
printf " ✅ Done"
else
echo "Unknown webhook type"
exit 1
fi

View File

@@ -1,38 +0,0 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
NAMESPACE="-A"
print_usage() {
blue "kube-restarting - Show all pods with restarts"
echo " "
underline "Usage:"
echo "kube-restarting [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the to search in (searches all if not set)"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE="-n $1"
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
kubectl get pod ${NAMESPACE} -o json | jq --raw-output '.items[] | select([.status.containerStatuses[].restartCount] | add > 0) | "\( .metadata.namespace)/\( .metadata.name) \t \([.status.containerStatuses[].restartCount] | add)" ' | column -t

View File

@@ -1,58 +0,0 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
DEPLOYMENT=""
print_usage() {
blue "kube-schedule-anywhere - modify a deployment to schedule on any node"
echo " "
underline "Usage:"
echo "kube-schedule-anywhere [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the pod is in"
echo "-d, --deployment the name of the deployment to modify"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-d|--deployment)
shift
DEPLOYMENT=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
if [[ "$DEPLOYMENT" == "" ]]; then
which fzf &>/dev/null || (
echo "If no deployment provided, fzf is required to select deployments"
echo ""
print_usage
exit 1
)
deployment=($(kubectl get deployments --all-namespaces -o wide | _fzf | awk '{print $1, $2}'))
DEPLOYMENT=${deployment[1]}
NAMESPACE=${deployment[0]}
fi
kubectl patch deployment -n ${NAMESPACE} ${DEPLOYMENT} -p '{"spec": { "template": { "spec": { "tolerations": [ { "operator": "Exists" } ] } } } }' 1>/dev/null

View File

@@ -1,25 +1,22 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
POD="shell"
IMAGE="digitalocean/doks-debug"
CMD="bash"
IMAGE="bash"
CMD="sh"
print_usage() {
blue "kube-shell - create a new pod and exec into it's shell"
echo "kube-shell - create a new pod and exec into it's shell"
echo " "
underline "Usage:"
echo "kube-shell [options]"
echo " "
underline "Options:"
echo "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the pod should launch in"
echo "-p, --pod the name of the pod to get logs for (default: shell)"
echo "-i, --image the image to use for the shell container (default: digitalocean/doks-debug)"
echo "-i, --image the image to use for the shell container (default: bash)"
echo "-c, --command the initial command to execute in the container (default: sh)"
}
@@ -57,16 +54,5 @@ done
NAMESPACE=${NAMESPACE:-default}
OVERRIDES='{
"spec": {
"securityContext": {"runAsGroup": 1000,"runAsNonRoot": true,"runAsUser": 1000,"seccompProfile": {"type": "RuntimeDefault"}},
"containers": [
{
"name":"'$POD'","image":"'$IMAGE'", "command": ["'$CMD'"],
"stdin": true,"stdinOnce": true,"tty": true,
"securityContext": {"allowPrivilegeEscalation": false,"capabilities": {"drop": ["ALL"]},"privileged": false,"runAsGroup": 1000,"runAsNonRoot": true,"runAsUser": 1000,"seccompProfile": {"type": "RuntimeDefault"}}
}
]
}
}'
kubectl run -it --namespace $NAMESPACE $POD --image $IMAGE --restart Never --overrides "${OVERRIDES}" --rm -- $CMD
echo kubectl run -it --namespace $NAMESPACE $POD --image $IMAGE --restart Never --rm -- $CMD
kubectl run -it --namespace $NAMESPACE $POD --image $IMAGE --restart Never --rm -- $CMD

View File

@@ -1,25 +1,21 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
POD="kube-ssh"
NODE=""
IMAGE="alpine"
print_usage() {
blue "kube-ssh - gain access to a Kubernetes host node (ssh-like for when a host doesn't have ssh)"
echo "kube-ssh - gain access to a Kubernetes host node (ssh-like for when a host doesn't have ssh)"
echo " "
underline "Usage:"
echo "kube-ssh [options]"
echo " "
underline "Options:"
echo "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace to launch the pod in"
echo "-p, --pod the name of the pod to launch (default: kube-ssh)"
echo "-N, --node the name of the node to access"
echo "-i, --image the image to launch for debugging (default: alpine)"
}
while test $# -gt 0; do
@@ -29,16 +25,16 @@ while test $# -gt 0; do
NAMESPACE=$1
shift
;;
-p|--pod)
shift
POD=$1
shift
;;
-N|--node)
shift
NODE=$1
shift
;;
-i|--image)
shift
IMAGE=$1
shift
;;
-h|--help)
print_usage
exit 0
@@ -50,9 +46,9 @@ while test $# -gt 0; do
done
if [[ "$NODE" == "" ]]; then
NODES=$(kubectl get nodes --no-headers -o custom-columns=name:.metadata.name)
if [ -z "$(which fzf)" ]; then
NODES=$(kubectl get nodes --no-headers -o custom-columns=name:.metadata.name)
i=0
while read -r node; do
echo "[$i] - $node"
@@ -63,18 +59,33 @@ if [[ "$NODE" == "" ]]; then
IFS=$'\n' NODES=($NODES)
NODE=${NODES[$REPLY]}
else
NODES=$(kubectl get nodes)
NODE=$(echo "$NODES" | _fzf | awk '{print $1}')
NODE=$(echo "$NODES" | fzf)
fi
fi
SERVER_VERSION=$(kubectl version --client=false -o json 2>/dev/null | jq -r '.serverVersion.minor')
if [ ${SERVER_VERSION} -ge 22 ]; then
kubectl debug node/${NODE} -it --image ${IMAGE}
else
NODE_NAME=$(kubectl get node $NODE -o template --template='{{index .metadata.labels "kubernetes.io/hostname"}}')
NODE_SELECTOR='"nodeSelector": { "kubernetes.io/hostname": "'${NODE_NAME}'" },'
kubectl run --namespace ${NAMESPACE} $POD --rm -it --image ${IMAGE} --privileged --overrides '{"spec":{'"${NODE_SELECTOR}"'"hostPID": true}}' --command nsenter -- --mount=/proc/1/ns/mnt -- /bin/bash
fi
NODE_NAME=$(kubectl get node $NODE -o template --template='{{index .metadata.labels "kubernetes.io/hostname"}}')
NODE_SELECTOR='"nodeSelector": { "kubernetes.io/hostname": "'${NODE_NAME}'" },'
kubectl run --namespace ${NAMESPACE} $POD --restart=Never -it --rm --image overriden --overrides '
{
"spec": {
"hostPID": true,
"hostNetwork": true,
'"${NODE_SELECTOR}"'
"tolerations": [{
"operator": "Exists"
}],
"containers": [
{
"name": "kube-ssh",
"image": "averagemarcus/kube-ssh:latest",
"stdin": true,
"tty": true,
"securityContext": {
"privileged": true
}
}
]
}
}' --attach

View File

@@ -1,62 +0,0 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
print_usage() {
blue "kube-template - Quickly template up kubernetes resources"
echo " "
underline "Usage:"
echo "kube-template [options] RESOURCE_KIND NAME [extra arguments]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the to search in"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE="--namespace $1"
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
NAME=${2}
case "$1" in
deployment|dp)
kubectl create ${NAMESPACE} deployment ${NAME} --image=nginx:1.21 --dry-run=client -o yaml ${@:3}
;;
ingress|in)
kubectl create ${NAMESPACE} ingress ${NAME} --dry-run=client -o yaml --rule=example.com/=my-service:web ${@:3}
;;
service|svc)
kubectl create ${NAMESPACE} service clusterip ${NAME} --dry-run=client -o yaml ${@:3}
;;
configmap|cm)
kubectl create ${NAMESPACE} configmap ${NAME} --dry-run=client -o yaml ${@:3}
;;
secret|sec)
kubectl create ${NAMESPACE} secret generic ${NAME} --dry-run=client -o yaml ${@:3}
;;
cronjob|cj)
kubectl create ${NAMESPACE} cronjob ${NAME} --image=alpine:latest --schedule="1 * * * *" --dry-run=client -o yaml ${@:3}
;;
job|jo)
kubectl create ${NAMESPACE} job ${NAME} --image=alpine:latest --dry-run=client -o yaml ${@:3}
;;
esac

View File

@@ -1,40 +0,0 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
print_usage() {
blue "kube-trigger-cronjob - Triggers a CronJob by creating a new job based on it"
echo " "
underline "Usage:"
echo "kube-trigger-cronjob [options] CRONJOB_NAME"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the to search in"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
NAME=${1}
kubectl create job --namespace ${NAMESPACE} ${NAME}-manual --from=cronjob/${NAME} ${@:3}

View File

@@ -1,41 +0,0 @@
#!/usr/bin/env bash
source .utils
set -e
if [ -z `which hidapitester` ]; then
bold "hidapitester command not found"
echo "Download from https://github.com/todbot/hidapitester"
exit 1
fi
print_usage() {
blue "litractl - Control Litra Glow"
echo " "
underline "Usage:"
echo "litractl [on / off]"
}
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
POS_ARGS+=(`echo $1`)
shift
;;
esac
done
if [[ "${POS_ARGS[0]}" == "on" ]]; then
italic "Turning Litra Glow on... "
hidapitester --vidpid 046D/C900 --open --length 20 --send-output 0x11,0xff,0x04,0x1c,0x01 &>/dev/null
elif [[ "${POS_ARGS[0]}" == "off" ]]; then
italic "Turning Litra Glow off... "
hidapitester --vidpid 046D/C900 --open --length 20 --send-output 0x11,0xff,0x04,0x1c &>/dev/null
else
print_usage
fi

View File

@@ -1,82 +0,0 @@
#!/usr/bin/env bash
source .utils
set -e
RENOVATE_USER="29139614"
MERGE=false
print_usage() {
blue "renovate-prs - List all Renovate PRs and batch approve"
echo " "
underline "Usage:"
echo "renovate-prs [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-m, --merge merge PRs after approving"
}
while test $# -gt 0; do
case "$1" in
-m|--merge)
shift
MERGE=true
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
PULLS=$(curl --silent -L -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/search/issues?q=is%3Apr%20is%3Aopen%20archived%3Afalse%20sort%3Aupdated-desc%20review-requested%3AAverageMarcus%20renovate" \
| jq -r -c ".items[] | select(.user.id == ${RENOVATE_USER} and .draft == false) | @base64")
if [[ "${PULLS}" == "" ]]; then
blue "No Renovate PRs pending"
else
for PR in ${PULLS}; do
PR=$(echo ${PR} | base64 -d)
NUMBER=$(echo ${PR} | jq -r '.number')
TITLE=$(echo ${PR} | jq -r '.title')
URL=$(echo ${PR} | jq -r '.pull_request.html_url')
BODY=$(echo ${PR} | jq -r '.body')
PACKAGES=""
HEADER_FOUND=false
DIVIDER_FOUND=false
while IFS= read -r line; do
if [[ "${line}" == "" ]] && [[ "${HEADER_FOUND}" == "true" ]] && [[ "${DIVIDER_FOUND}" == "true" ]]; then
break
fi
if [[ "${HEADER_FOUND}" == "true" ]] && [[ "${DIVIDER_FOUND}" == "true" ]]; then
line=$(echo ${line} | sed -r 's/\((.+)\)//g' | sed -r 's/(\[|\]|`)//g')
parts=(${line//|/ })
PACKAGES+=" - ${parts[0]} - ${parts[${#parts[@]}-3]]} ➡ ${parts[${#parts[@]}-1]]}\n"
fi
if [[ "${line}" == "| Package | Type | Update | Change |" ]] || [[ "${line}" == "| Package | Update | Change |" ]]; then
HEADER_FOUND=true
fi
if [[ "${line}" == "|---|---|---|---|" ]] || [[ "${line}" == "|---|---|---|" ]]; then
DIVIDER_FOUND=true
fi
done <<< "$BODY"
bold "#${NUMBER} ${STATE} $(blue "${TITLE}")"
printf "🌐 $(underline ${URL})\n"
printf "${PACKAGES}"
echo ""
done
fi

View File

@@ -1,71 +0,0 @@
#!/usr/bin/env bash
source .utils
set -e
if [[ "${TALOSCONFIG}" == "" ]]; then
echo "You need to set TALOSCONFIG before running this"
exit 1
fi
LATEST_RELEASE=$(curl --silent https://api.github.com/repos/siderolabs/talos/releases | jq -r '[.[] | select(.prerelease == false)] | .[0]')
TALOS_VERSION="$(jq --argjson LATEST_RELEASE "$LATEST_RELEASE" -c -n -r '$LATEST_RELEASE.tag_name')"
KUBERNETES_VERSION="$(jq --argjson LATEST_RELEASE "$LATEST_RELEASE" -c -n -r '$LATEST_RELEASE.body | match("registry.k8s.io/kube-apiserver:v([0-9\\.]+)") | .captures[0].string')"
blue "TALOS_VERSION = ${TALOS_VERSION}"
blue "KUBERNETES_VERSION = ${KUBERNETES_VERSION}"
echo ""
blue "ISO URL: https://github.com/siderolabs/talos/releases/download/${TALOS_VERSION}/metal-amd64.iso"
echo ""
kubectl cluster-info
echo ""
printf "Continue? (y/n): "
read CONFIRM
if [[ "${CONFIRM}" != "y" ]]; then
exit 1
fi
echo ""
blue "Ensuring talosctl is up-to-date..."
brew upgrade siderolabs/tap/talosctl
CONTROL_PLANE="$(talosctl get nodetaintspec -o json | jq -r '.node')"
WORKERS=( $(talosctl get nodeips -o json | jq -r '.node | select(. != "'${CONTROL_PLANE}'")'))
echo ""
kubectl get no -o wide
echo ""
blue "Upgrading the control plane first..."
talosctl upgrade --image ghcr.io/siderolabs/installer:${TALOS_VERSION} --preserve=true --nodes ${CONTROL_PLANE}
echo ""
blue "Upgrading the worker nodes..."
SLEEP="10"
for NODE in "${WORKERS[@]}"
do
talosctl upgrade --image ghcr.io/siderolabs/installer:${TALOS_VERSION} --preserve=true --nodes ${NODE}
italic "Waiting for ${SLEEP} seconds to let pods settle..."
sleep ${SLEEP}
done
echo ""
kubectl get no -o wide
# Only the control plane requires the k8s version upgrading, the workers are done as part of the OS upgrade
echo ""
blue "Upgrading Kubernetes..."
talosctl upgrade-k8s --nodes ${CONTROL_PLANE} --to ${KUBERNETES_VERSION}
echo ""
kubectl get no -o wide
echo ""
orange "🎉 Upgrade Complete! 🎉"
echo ""
blue "ISO URL: https://github.com/siderolabs/talos/releases/download/${TALOS_VERSION}/metal-amd64.iso"

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env bash
source .utils
print_usage() {
orange "yq-test - interactively use YQ against a json file"
echo " "
underline "Usage:"
echo "yq-test [FILE]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
POS_ARGS+=$1
shift
;;
esac
done
if [ ${#POS_ARGS[@]} -eq 0 ]
then
print_usage
exit 0
fi
echo '' | fzf --preview "yq {q} < ${POS_ARGS[@]}"

View File

@@ -3,6 +3,7 @@ export ZSH="$HOME/.oh-my-zsh"
plugins=(
zsh-syntax-highlighting
)
autoload -U compinit
# Use this setting if you want to disable marking untracked files under VCS as dirty.
# This makes repository status checks for large repositories much, much faster.
@@ -15,6 +16,7 @@ zstyle ':omz:update' mode reminder
source `brew --prefix switch`/switch.sh
# History
HISTFILE="$HOME/.zsh_history"
HISTIGNORE="&:exit:reset:clear:zh"
@@ -29,6 +31,7 @@ setopt HIST_REDUCE_BLANKS
setopt autocd
autoload -U add-zsh-hook
DISABLE_AUTO_TITLE="true"
# Override auto-title when static titles are desired ($ title My new title)
@@ -52,6 +55,8 @@ preexec() {
printf "\033]0;%s\a" "${1%% *} | $cwd" # Omit construct from $1 to show args
}
if [ $(/bin/ps -ef | /usr/bin/grep "ssh-agent" | /usr/bin/grep -v "grep" | wc -l) -eq 0 ]; then
eval "$(ssh-agent -s)" > /dev/null
fi
# Giant Swarm specific
which opsctl &>/dev/null && opsctl completion zsh > /usr/local/share/zsh/site-functions/_opsctl
which gsctl &>/dev/null && gsctl completion zsh --stdout > /usr/local/share/zsh/site-functions/_gsctl
which devctl &>/dev/null && devctl completion zsh > /usr/local/share/zsh/site-functions/_devctl

View File

@@ -2,7 +2,7 @@
alias _cat=`which cat`
alias _curl=`which curl`
alias _ls="/bin/ls"
alias _grep="/usr/bin/grep"
alias _grep="/bin/grep"
alias _diff="/usr/bin/diff"
alias _du=`which du`
alias _df=`which df`
@@ -10,40 +10,28 @@ alias _find=`which find`
alias _top=`which top`
alias _ps="/bin/ps"
alias _dig=`which dig`
alias _readlink='/usr/bin/readlink'
alias _sed='/usr/bin/sed'
alias _date='/bin/date'
alias _base64='/usr/bin/base64'
alias _git=`which git`
if command -v $(brew --prefix)/bin/git &>/dev/null; then
alias _git=$(brew --prefix)/bin/git
fi
alias _readlink=`which readlink`
# Aliases
alias cat='bat '
alias curl='curlie'
alias ls='eza --group-directories-first --icons --header --git --ignore-glob=.git'
alias ls='exa --group-directories-first --icons --header --git --ignore-glob=.git'
alias grep='rg'
alias diff='delta'
alias du='dust'
alias df='duf -hide special'
alias find='fd'
alias find-empty-dirs='fd --type empty --type directory'
alias bandwhich='sudo bandwhich'
alias top='btm'
alias ps='procs'
alias dig='doggo'
alias dig='dog'
alias kubectx='switch'
alias kctx='switch'
alias machine-info='macchina -t Boron --bar'
alias watch='watch '
alias tmp='cd $(mktemp -d)'
# Ensure GNU version of tools are used by default (symlink so they are picked up in scripts also)
which greadlink &>/dev/null && ln -sfn `which greadlink` /usr/local/bin/readlink
which gsed &>/dev/null && ln -sfn `which gsed` /usr/local/bin/sed
which gdate &>/dev/null && ln -sfn `which gdate` /usr/local/bin/date
which gbase64 &>/dev/null && ln -sfn `which gbase64` /usr/local/bin/base64
which greadlink &>/dev/null && alias readlink=`which greadlink`
lt() {
DEPTH=$(echo $1 | grep "^[0-9]*$")
@@ -73,75 +61,16 @@ git() {
elif [ "$1" = "commit" ]; then # Sign all commits
shift
_git commit -s $@
elif [ "$1" = "co" ]; then # Create a new branch
shift
_git checkout -b $@
elif [ "$1" = "push" ]; then # Guard against pushing to certain orgs
shift
if [ $# -eq 0 ]; then
remote_url=$(_git remote get-url $(git current-remote))
if [[ $remote_url == *"kubernetes/"* ]] || [[ $remote_url == *"kubernetes-sigs/"* ]]; then
echo "⚠️ Don't push directly to Kubernetes"
return 1
fi
fi
_git push $@
elif [ "$1" = "release" ]; then # Create a new tag
shift
SEMVER=$1
CURRENT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
VERSION_PARTS=($(echo $CURRENT_TAG | tr "." "\n"))
VERSION_MAJOR=${VERSION_PARTS[1]}
VERSION_MINOR=${VERSION_PARTS[2]}
VERSION_PATCH=${VERSION_PARTS[3]}
case ${SEMVER} in
patch)
VERSION_PATCH=$((VERSION_PATCH+1))
;;
minor)
VERSION_MINOR=$((VERSION_MINOR+1))
VERSION_PATCH=0
;;
major)
if [[ ${VERSION_MAJOR:0:1} == "v" ]]; then
VERSION_MAJOR="v$((VERSION_MAJOR+1))"
else
VERSION_MAJOR=$((VERSION_MAJOR+1))
fi
VERSION_MINOR=0
VERSION_PATCH=0
;;
*)
echo "Unknown Semver level provided"
exit 1
;;
esac
NEW_VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
echo ""
echo "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "
echo "Current version ${CURRENT_TAG}"
echo " New version ${NEW_VERSION}"
echo "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "
echo ""
printf "Confirm? (y/n): "
read CONFIRM
if [ "${CONFIRM}" = "y" ]; then
git tag -a -m "${NEW_VERSION}" ${NEW_VERSION}
echo "New tag created, don't forget to push to remote"
else
echo "Aborting..."
exit 1
fi
else
_git $@
fi
}
# Giant Swarm specific
alias prom='opsctl open -a prometheus --sso -i'
alias happa='opsctl open -a happa --sso -i'
alias grafana='opsctl open -a grafana --sso -i'
alias argo='opsctl open -a argocd --sso -i'
alias cloud-provider='opsctl open -a cloudprovider -i'
alias get-cluster='gs-get-cluster'
alias create-cluster='gs-create-cluster'

View File

@@ -3,7 +3,6 @@ export VISUAL='code'
export GPG_TTY=$(tty)
# AWS
export AWS_PAGER=""
if [ -f ~/.aws/profile ]; then
export AWS_PROFILE=$(cat ~/.aws/profile)
export AWS_DEFAULT_REGION=eu-west-1
@@ -25,15 +24,3 @@ export STARSHIP_LOG=error
# Bat
export BAT_THEME="Monokai Extended Light"
export BAT_STYLE="grid,header"
# TZ
export TZ_LIST="Europe/Berlin;Europe/Sofia;UTC"
# Docker
export DOCKER_HOST=$(docker context inspect --format='{{.Endpoints.docker.Host}}')
# Brew - Prevent updating all packages when installing a new one
export HOMEBREW_NO_AUTO_UPDATE=1
# k9s
export K9S_CONFIG_DIR="$HOME/.k9s"

View File

@@ -1,6 +0,0 @@
# Giant Swarm utils
which opsctl &>/dev/null && screen -dm bash -c 'opsctl version update'
which devctl &>/dev/null && screen -dm bash -c 'devctl version update'
which kubectl-gs &>/dev/null && screen -dm bash -c 'kubectl-gs selfupdate'
which opsctl &>/dev/null && opsctl completion zsh > /usr/local/share/zsh/site-functions/_opsctl
which devctl &>/dev/null && devctl completion zsh > /usr/local/share/zsh/site-functions/_devctl

View File

@@ -7,5 +7,6 @@ alias fix-broken-replicasets='kube-clean-replicasets '
alias kube-forward='kube-forward-all '
source <(kubectl completion zsh)
source <(tkn completion zsh)
# tkn currently doesn't work with Mac ARM chips
# source <(tkn completion zsh)

View File

@@ -1,2 +0,0 @@
# Ensure local dnsmasq is used for DNS
which networksetup &>/dev/null && networksetup -setdnsservers Wi-Fi 127.0.0.1

View File

@@ -22,7 +22,6 @@
[push]
default = simple
followTags = true
[init]
defaultBranch = main
@@ -38,15 +37,13 @@
[alias]
basename = "!git remote -v | head -n1 | awk '{print $2}' | sed 's/.*\\///' | sed 's/\\.git//'"
remote-base-url = "!git remote get-url $(git fork-or-origin) | tr ':' '/' | sed 's|ssh///git@|https://|' | sed 's|git@|https://|' | sed 's|\\.git|/|'"
org-name = "!git remote -v | grep -m 1 -o ':.*/' | sed 's:^.\\(.*\\).$:\\1:'"
branch-name = "!git rev-parse --abbrev-ref HEAD"
changelog-changed = "!test $(git diff --name-only HEAD origin/$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') | grep CHANGELOG.md | wc -l | xargs) = 1"
main-branch = "!git remote show origin 2>/dev/null | grep HEAD | sed 's/.* //'"
fork-or-origin = "!func(){ $(git remote show fork &>/dev/null); if [[ $? == 0 ]]; then echo \"fork\" ; else echo \"origin\"; fi; }; func"
main-branch = "!git remote show origin|grep HEAD|sed 's/.* //'"
main = "!git remote set-head origin --auto && git checkout $(git main-branch) && git pull"
pr-link = "!echo \"$(git remote-base-url)compare/$(git main-branch)...$(git branch-name)?expand=1\""
publish = "!func(){ if [[ $(git branch-name) != \"$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')\" ]]; then git push -u $(git fork-or-origin) $(git branch-name) && (git changelog-changed || echo '\n\n⚠ Dont forget to update changelog ⚠️ ') && (echo '\n\n'; git pr-link) ; else echo "Wat?!"; fi; }; func"
publish = "!func(){ if [[ $(git branch-name) != \"$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')\" ]]; then git push -u origin $(git branch-name) && (git changelog-changed || echo '\n\n⚠ Dont forget to update changelog ⚠️ ') ; else echo "Wat?!"; fi; }; func"
cleanup = "!git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done"
dont-change-file = "!git update-index --assume-unchanged"
ignore-file = "!git update-index --skip-worktree"
@@ -54,7 +51,7 @@
logg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
dif = "!git diff -w"
pop = "!git stash pop"
current-remote = "!func(){ REMOTE=$(git rev-parse --abbrev-ref @{u}) ; echo ${REMOTE%/*} ; }; func"
[help]
autocorrect = 1
@@ -65,5 +62,3 @@
insteadOf = https://github.com
[pull]
rebase = false
[gpg]
program = /opt/homebrew/bin/gpg

156
home/.hyper.js Normal file
View File

@@ -0,0 +1,156 @@
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
scrollback: 10000000,
// default font size in pixels for all tabs
fontSize: 13,
// font family with optional fallbacks
fontFamily: '"OpenDyslexicMono Nerd Font", "Fira Code", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
// default font weight: 'normal' or 'bold'
fontWeight: 'normal',
// font weight for bold characters: 'normal' or 'bold'
fontWeightBold: 'bold',
// line height as a relative unit
lineHeight: 1,
// letter spacing as a relative unit
letterSpacing: 0,
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
// terminal text color under BLOCK cursor
cursorAccentColor: '#000',
// `'BEAM'` for |, `'UNDERLINE'` for _, `'BLOCK'` for █
cursorShape: 'BEAM',
// set to `true` (without backticks and without quotes) for blinking cursor
cursorBlink: true,
// color of the text
foregroundColor: '#fff',
// terminal background color
// opacity is only supported on macOS
backgroundColor: '#000',
// terminal selection color
selectionColor: 'rgba(248,28,229,0.3)',
// border color (window, tabs)
borderColor: '#333',
// custom CSS to embed in the main window
css: `.line {
color: #999;
stroke: #999;
}`,
// custom CSS to embed in the terminal window
termCSS: '',
// if you're using a Linux setup which show native menus, set to false
// default: `true` on Linux, `true` on Windows, ignored on macOS
showHamburgerMenu: '',
// set to `false` (without backticks and without quotes) if you want to hide the minimize, maximize and close buttons
// additionally, set to `'left'` if you want them on the left, like in Ubuntu
// default: `true` (without backticks and without quotes) on Windows and Linux, ignored on macOS
showWindowControls: '',
// custom padding (CSS format, i.e.: `top right bottom left`)
padding: '12px 14px',
// the full list. if you're going to provide the full color palette,
// including the 6 x 6 color cubes and the grayscale map, just provide
// an array here instead of a color map object
colors: {
black: '#000000',
red: '#C51E14',
green: '#1DC121',
yellow: '#C7C329',
blue: '#0A2FC4',
magenta: '#C839C5',
cyan: '#20C5C6',
white: '#C7C7C7',
lightBlack: '#686868',
lightRed: '#FD6F6B',
lightGreen: '#67F86F',
lightYellow: '#FFFA72',
lightBlue: '#6A76FB',
lightMagenta: '#FD7CFC',
lightCyan: '#68FDFE',
lightWhite: '#FFFFFF',
},
// the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
// if left empty, your system's login shell will be used by default
//
// Windows
// - Make sure to use a full path if the binary name doesn't work
// - Remove `--login` in shellArgs
//
// Bash on Windows
// - Example: `C:\\Windows\\System32\\bash.exe`
//
// PowerShell on Windows
// - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
shell: '',
// for setting shell arguments (i.e. for using interactive shellArgs: `['-i']`)
// by default `['--login']` will be used
shellArgs: ['--login'],
// for environment variables
env: {},
// set to `false` for no bell
bell: `false`,
// if `true` (without backticks and without quotes), selected text will automatically be copied to the clipboard
copyOnSelect: false,
// if `true` (without backticks and without quotes), hyper will be set as the default protocol client for SSH
defaultSSHApp: true,
// if `true` (without backticks and without quotes), on right click selected text will be copied or pasted if no
// selection is present (`true` by default on Windows and disables the context menu feature)
// quickEdit: true,
// URL to custom bell
// bellSoundURL: 'http://example.com/bell.mp3',
// for advanced config flags please refer to https://hyper.is/#cfg
},
// a list of plugins to fetch and install from npm
// format: [@org/]project[#version]
// examples:
// `hyperpower`
// `@company/project`
// `project#1.0.1`
plugins: ["hyper-search", "hyperterm-paste", "hyper-tabs-enhanced", "hyper-chesterish", "hyper-quit"],
// in development, you can create a directory under
// `~/.hyper_plugins/local/` and include it here
// to load it and avoid it being `npm install`ed
localPlugins: [],
keymaps: {
// Example
// 'window:devtools': 'cmd+alt+o',
},
};

View File

@@ -1,9 +0,0 @@
aliases:
dp: deployments
sec: v1/secrets
jo: jobs
cr: clusterroles
crb: clusterrolebindings
ro: roles
rb: rolebindings
np: networkpolicies

View File

@@ -1,42 +0,0 @@
k9s:
liveViewAutoRefresh: false
refreshRate: 2
maxConnRetry: 5
readOnly: false
noExitOnCtrlC: false
ui:
enableMouse: false
headless: false
logoless: true
crumbsless: false
reactive: true
noIcons: false
skin: default
skipLatestRevCheck: false
disablePodCounting: false
shellPod:
image: busybox:1.35.0
namespace: default
limits:
cpu: 100m
memory: 100Mi
tty: true
imageScans:
enable: false
exclusions:
namespaces: []
labels: {}
logger:
tail: 5000
buffer: 50000
sinceSeconds: 0
fullScreen: false
textWrap: false
showTime: false
thresholds:
cpu:
critical: 90
warn: 80
memory:
critical: 90
warn: 80

26
home/.k9s/config.yml Normal file
View File

@@ -0,0 +1,26 @@
k9s:
refreshRate: 2
maxConnRetry: 5
enableMouse: false
headless: false
logoless: true
crumbsless: false
readOnly: false
noIcons: false
logger:
tail: 5000
buffer: 50000
sinceSeconds: 0
fullScreenLogs: false
textWrap: false
showTime: false
currentContext:
currentCluster:
clusters: []
thresholds:
cpu:
critical: 90
warn: 80
memory:
critical: 90
warn: 80

View File

@@ -1,154 +0,0 @@
plugins:
# kubectl-blame by knight42
# Annotate each line in the given resource's YAML with information from the managedFields to show who last modified the field.
# Source: https://github.com/knight42/kubectl-blame
# Install via:
# krew: `kubectl krew install blame`
# go: `go install github.com/knight42/kubectl-blame@latest`
blame:
shortCut: b
confirm: false
description: "Blame"
scopes:
- all
command: sh
background: false
args:
- -c
- "kubectl-blame $RESOURCE_NAME $NAME -n $NAMESPACE --context $CONTEXT | less"
# Suspends/Resumes a cronjob
toggleCronjob:
shortCut: Shift-S
confirm: true
scopes:
- cj
description: Toggle to suspend or resume a running cronjob
command: kubectl
background: true
args:
- patch
- cronjobs
- $NAME
- -n
- $NAMESPACE
- --context
- $CONTEXT
- -p
- '{"spec" : {"suspend" : $!COL-SUSPEND }}'
# Flux
reconcile-git:
shortCut: Shift-R
confirm: false
description: Flux reconcile
scopes:
- gitrepositories
command: bash
background: false
args:
- -c
- >-
flux
reconcile source git
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-hr:
shortCut: Shift-R
confirm: false
description: Flux reconcile
scopes:
- helmreleases
command: bash
background: false
args:
- -c
- >-
flux
reconcile helmrelease
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-helm-repo:
shortCut: Shift-R
description: Flux reconcile
scopes:
- helmrepositories
command: bash
background: false
confirm: false
args:
- -c
- >-
flux
reconcile source helm
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-oci-repo:
shortCut: Shift-R
description: Flux reconcile
scopes:
- ocirepositories
command: bash
background: false
confirm: false
args:
- -c
- >-
flux
reconcile source oci
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-ks:
shortCut: Shift-R
confirm: false
description: Flux reconcile
scopes:
- kustomizations
command: bash
background: false
args:
- -c
- >-
flux
reconcile kustomization
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
remove_finalizers:
shortCut: Ctrl-F
confirm: true
scopes:
- all
description: |
Removes all finalizers
command: kubectl
background: true
args:
- patch
- --context
- $CONTEXT
- --namespace
- $NAMESPACE
- $RESOURCE_NAME.$RESOURCE_GROUP
- $NAME
- -p
- '{"metadata":{"finalizers":null}}'
- --type
- merge
watch-events:
shortCut: Shift-E
confirm: false
description: Watch Events
scopes:
- all
command: sh
background: false
args:
- -c
- "kubectl events --context $CONTEXT --namespace $NAMESPACE --for $RESOURCE_NAME.$RESOURCE_GROUP/$NAME --watch"

View File

@@ -1,4 +0,0 @@
long_uptime = true
long_shell = true
physical_cores = true
show = [ "Host", "Machine", "OperatingSystem", "Terminal", "Shell", "Uptime" ]

View File

@@ -1,44 +0,0 @@
hide_ascii = true
spacing = 1
padding = 0
separator = ""
key_color = "Cyan"
separator_color = "LightMagenta"
[bar]
glyph = "⭘"
symbol_open = ""
symbol_close = ""
visible = true
[box]
title = " Info "
border = "double"
visible = true
[box.inner_margin]
x = 1
y = 0
[randomize]
key_color = false
separator_color = false
[keys]
host = "Host"
kernel = "Kernel"
battery = "Battery"
os = "OS"
distro = "Distro"
terminal = "Terminal"
shell = "Shell"
packages = "Packages"
uptime = "Uptime"
memory = "Memory"
machine = "Machine"
local_ip = "IP"
backlight = "Brightness"
resolution = "Resolution"
cpu_load = "CPU Load"
cpu = "CPU"

View File

@@ -1,7 +1,7 @@
format = """\
$status\
$cmd_duration\
$hostname\
$line_break\
$directory\
$git_branch\
$git_commit\
@@ -14,51 +14,32 @@ format = """\
$terraform\
$package\
$custom\
$time\
$line_break\
$jobs\
$time\
$character\
"""
command_timeout = 1000
add_newline = true
[hostname]
ssh_only = true
format = "🌐 [$hostname](bold dimmed blue) \n"
disabled = false
[directory]
format = "┏  [$path]($style)[$read_only]($read_only_style) "
[character]
success_symbol = "[✨](yellow)"
error_symbol = "[✗](fg:204)"
success_symbol = "[✨](yellow)"
error_symbol = "[✗](red)"
[git_branch]
format = "⎮ [$symbol$branch]($style) "
symbol = "🌱 "
[aws]
symbol = " "
format = "[$symbol$profile]($style) "
[git_commit]
only_detached = true
[git_status]
format = '\($all_status$ahead_behind\) '
up_to_date = "[✓](green)"
modified = "[!](bold fg:208)"
untracked = "[?](bold fg:75)"
staged = '[++\($count\)](green)'
[aws]
symbol = " "
format = "⎮ [$symbol$profile]($style) "
[golang]
symbol = " "
format = "[$symbol$version](fg:45) "
format = "[$symbol$version]($style) "
[kubernetes]
format = '[$symbol$context (\($namespace\))]($style) '
format = '[$symbol$context \($namespace\)]($style) '
symbol = "ﴱ "
style = "bold blue"
disabled = false
@@ -66,28 +47,25 @@ disabled = false
"gs-(?P<cluster>.+)" = "$cluster [MC]"
[terraform]
format = "[$symbol$version]($style) "
format = "[$symbol$version]($style) "
[nodejs]
symbol = " "
[status]
style = "red"
symbol = "✗"
format = "[↪ $symbol $common_meaning$signal_name$maybe_int](fg:204)\n"
format = '[↪ \[$symbol $common_meaning$signal_name$maybe_int\]]($style)'
map_symbol = true
disabled = false
[helm]
format = "[$symbol$version]($style) "
format = "[$symbol$version]($style) "
symbol = " "
[cmd_duration]
format = " took [$duration]($style) \n"
format = " took [$duration]($style) "
[package]
symbol = "📦"
format = "[$symbol$version]($style) "
[jobs]
number_threshold = 1
format = "┣ [$symbol $number background jobs\n]($style)"
format = "[$symbol$version]($style) "

View File

@@ -3,4 +3,3 @@ set paste
set number
set linespace=3
set cursorline
syntax on

View File

@@ -1,5 +1,3 @@
DISABLE_AUTO_UPDATE="true"
PATH_DIRS=(
"${HOME}/.bin"
"${KREW_ROOT:-${HOME}/.krew}/bin"
@@ -7,7 +5,6 @@ PATH_DIRS=(
"${HOME}/.cargo/bin"
"/home/linuxbrew/.linuxbrew/bin"
"/opt/homebrew/bin/"
"${HOME}/Library/Python/3.11/bin"
"/usr/local/bin"
"/usr/bin"
"/bin"
@@ -16,7 +13,6 @@ PATH_DIRS=(
"${PATH}"
)
export PATH=${"${PATH_DIRS[*]}"// /:}
export FPATH="$FPATH:/opt/homebrew/share/zsh/site-functions"
if [ ! -z ~/.additional_dotfiles/credentials ]; then
source ~/.additional_dotfiles/credentials
@@ -33,5 +29,3 @@ done
rm -f ~/.zcompdump; compinit
eval "$(starship init zsh)"
macchina --config ~/.macchina/config.toml --theme ~/.macchina/theme

162
install.sh Executable file → Normal file
View File

@@ -2,118 +2,65 @@
export PATH="/home/linuxbrew/.linuxbrew/bin:/opt/homebrew/bin/:$PATH"
GITEMAIL=$(git config --get user.email)
[ -d ~/.additional_dotfiles ] || (mkdir -p ~/.additional_dotfiles && touch ~/.additional_dotfiles/credentials)
[ -d /usr/local/share/zsh/site-functions ] || (sudo mkdir -p /usr/local/share/zsh/site-functions && sudo chmod 777 /usr/local/share/zsh/site-functions)
# Install homebrew
echo ""
echo "🔵 Installing homebrew"
which brew >/dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "✅"
echo "🔵 Setting up zsh"
# Install oh-my-zsh
echo ""
echo "🔵 Setting up zsh"
printf "Cloning oh-my-zsh..."
[ -d ${HOME}/.oh-my-zsh ] || sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
printf " ✅\n"
# Install ZSH plugins
printf "Cloning zsh plugins..."
[ -d ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-autosuggestions ] || git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
[ -d ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
printf " ✅\n"
# Set correct permissions on compinit dir
sudo chmod -R 755 /usr/local/share/zsh/site-functions
# Install tools
BREW_TOOLS=(
git argocd bandwhich bat danielfoehrkn/switch/switch derailed/k9s/k9s
dive doggo duf dust eza fd fzf git-delta go helm htop jq kind krew curl
kubectl kustomize node procs progress ripgrep rs/tap/curlie rust starship
tektoncd/tools/tektoncd-cli tldr tailscale yq tabby vale jless macchina tz viddy
homeassistant-cli act dnsmasq gh kubebuilder golangci-lint gnu-sed s3cmd
pulumi/tap/pulumi kubeseal fluxcd/tap/flux ical-buddy baobab
watch crane openssh siderolabs/talos/talosctl civo/tools/civo raspberry-pi-imager
gron ssup2/tap/kpexec opentofu visual-studio-code 1password-cli scw smartmontools
firefox signal slack ffmpeg openscad tsh colima docker docker-buildx nordvpn
1password tailscale-app
argocd bandwhich bat danielfoehrkn/switch/switch derailed/k9s/k9s dive dog duf dust exa fd fzf
git-delta go helm homebrew/cask-fonts/font-open-dyslexic-nerd-font htop jq kind krew
kubectl kubectx kustomize node procs progress ripgrep rs/tap/curlie rust starship
tektoncd/tools/tektoncd-cli tldr tailscale python-yq hashicorp/tap/vault stats
tabby
)
# Brew tools only available / needed on Mac
MAC_BREW_TOOLS=(
pinentry-mac gpg gawk coreutils wget stats font-open-dyslexic-nerd-font
dimentium/autoraise/autoraiseapp the-unarchiver rar mas capcut
mqtt-explorer raycast bettertouchtool calibre kdenlive royal-tsx tableplus
homebrew/cask/todoist ultimaker-cura webtorrent pika pearcleaner spotmenu
jordanbaird-ice
)
CARGO_TOOLS=( bottom )
CARGO_TOOLS=( macchina bottom )
NODE_TOOLS=( git-split-diffs )
KREW_TOOLS=( outdated tree stern explore blame access-matrix cert-manager rbac-tool resource-capacity view-secret )
APT_TOOLS=( zsh gcc )
MAS_TOOLS=(
1263070803 # Lungo
1470584107 # Dato
1351639930 # Gifski
)
KREW_TOOLS=( gs outdated tree stern )
# Tools removed to be cleaned up
REMOVED_BREW_TOOLS=(
exa karabiner-elements kubectx hiddenbar
)
REMOVED_KREW_TOOLS=( gs )
echo ""
echo "🔵 Installing / updating tools"
# Install Debian/Ubuntu specific packages if apt exists
if command -v apt &>/dev/null; then
echo "'apt' found on system, assuming Ubuntu/Debian and installing pre-requisites..."
sudo apt install -y ${APT_TOOLS}
fi
# Homebrew
echo ""
echo "🔵 Homebrew tools"
export HOMEBREW_NO_INSTALL_CLEANUP=true
for tool in "${BREW_TOOLS[@]}"
do
printf "${tool}..."
brew upgrade ${tool} &>/dev/null || brew install ${tool} &>/dev/null
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
printf " ✅\n"
done
# Cargo
echo ""
echo "🔵 Cargo tools"
for tool in "${CARGO_TOOLS[@]}"
do
printf "${tool}..."
cargo install ${tool} &>/dev/null
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
printf " ✅\n"
done
# Krew
echo ""
echo "🔵 Krew tools"
kubectl-krew update &>/dev/null
for tool in "${KREW_TOOLS[@]}"
do
printf "${tool}..."
kubectl-krew upgrade ${tool} &>/dev/null || kubectl-krew install ${tool} &>/dev/null
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
printf " ✅\n"
done
fulllink() {
@@ -125,7 +72,6 @@ fulllink() {
fi
}
echo ""
echo "🔵 OS Specific setup"
echo "Detected OS type: ${OSTYPE}"
@@ -135,35 +81,15 @@ case "${OSTYPE}" in
;;
*darwin*)
# Mac specific setup
echo ""
echo "Instaling Mac-specific Brew tools..."
MAC_BREW_TOOLS=( pinentry-mac gpg gawk coreutils wget )
for tool in "${MAC_BREW_TOOLS[@]}"
do
printf "${tool}..."
brew upgrade ${tool} &>/dev/null || brew install ${tool} &>/dev/null
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
printf " ✅\n"
done
# Mac App Store
echo ""
echo "Instaling Mac-specific App Store tools..."
for tool in "${MAS_TOOLS[@]}"
do
printf "MAS ID: ${tool}..."
mas install ${tool} &>/dev/null
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
done
echo ""
echo "Setting up config files"
FILES=$(/usr/bin/find ./os-specific/darwin/home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
for file in $FILES
do
@@ -185,30 +111,17 @@ case "${OSTYPE}" in
# Handle other files outside of the user's home directory
echo ""
echo "🔵 Handiling non-standard files:"
echo "Handiling non-standard files:"
# 1. Tabby config
mkdir -p "/Users/${USER}/Library/Application Support/tabby"
f=$(fulllink "./other-files/tabby/config.yaml")
dst="/Users/${USER}/Library/Application Support/tabby/config.yaml"
f="./other-files/tabby/config.yaml"
dst="/Users/${USER}/Library/Application\ Support/tabby/config.yaml"
printf "Linking ${f}=>${dst}"
ln -sfn "${f}" "${dst}"
printf " ✅\n"
# 2. dnsmasq
f=$(fulllink "./other-files/dnsmasq/dnsmasq.conf")
dst="$(brew --prefix)/etc/dnsmasq.conf"
printf "Copying ${f}=>${dst}"
cp ${f} ${dst}
printf " ✅\n"
printf "Setting DNS server for 'Wi-Fi' interface to use dnsmasq"
sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1
ln -sfn ${f} ${dst}
printf " ✅\n"
;;
esac
echo ""
echo "🔵 Adding configuration"
FILES=$(/usr/bin/find ./home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
for file in $FILES
@@ -219,36 +132,3 @@ do
ln -sfn ${f} ${dst}
printf " ✅\n"
done
echo ""
echo "🔵 Updating installed tools..."
brew upgrade
mas upgrade
echo ""
echo "🔵 Removing old Homebrew tools"
export HOMEBREW_NO_INSTALL_CLEANUP=true
for tool in "${REMOVED_BREW_TOOLS[@]}"
do
printf "${tool}..."
brew uninstall ${tool} &>/dev/null
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
done
echo ""
echo "🔵 Removing old Krew tools"
for tool in "${REMOVED_KREW_TOOLS[@]}"
do
printf "${tool}..."
kubectl-krew uninstall ${tool} &>/dev/null
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
done

View File

@@ -1,5 +1 @@
pinentry-program /opt/homebrew/bin//pinentry-mac
default-cache-ttl 0
max-cache-ttl 600
default-cache-ttl-ssh 0
max-cache-ttl-ssh 0
pinentry-program /usr/local/bin/pinentry-mac

View File

@@ -1 +0,0 @@
pinentry-mode loopback

View File

@@ -1,12 +0,0 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Brand
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
open 'smb://nas._smb._tcp.local/Nextcloud/Pictures/Brand'

View File

@@ -1,16 +0,0 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Litra Glow Off
# @raycast.mode silent
# Optional parameters:
# @raycast.icon ⚫️
# Documentation:
# @raycast.description Turn off Litra Glow light
cd ~/.bin/
./litractl off

View File

@@ -1,15 +0,0 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Litra Glow On
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 💡
# Documentation:
# @raycast.description Turn on Litra Glow light
cd ~/.bin/
./litractl on

View File

@@ -1,12 +0,0 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Nextcloud
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
open 'smb://nas._smb._tcp.local/Nextcloud'

View File

@@ -1,11 +0,0 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Reaction Gifs
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
open 'smb://nas._smb._tcp.local/Nextcloud/Pictures/ReactionGifs'

View File

@@ -1,15 +0,0 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Restart BusyCal Menu
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
# Documentation:
# @raycast.description Kills the BusyCal process
pkill busycal-setapp.alarm
open /Applications/Setapp/BusyCal.app

View File

@@ -1,14 +0,0 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Restart Logi daemon
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
# Documentation:
# @raycast.description Kills the LogiMgr process to allow a new one to spawn
pkill LogiMgr

View File

@@ -1,12 +0,0 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Things
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
open 'smb://nas._smb._tcp.local/Things'

View File

@@ -1,34 +0,0 @@
#!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Toggle Microphone
# @raycast.mode silent
# @raycast.packageName System
# Optional parameters:
# @raycast.icon 🎙
# Documentation:
# @raycast.author Matthew Morek
# @raycast.authorURL https://github.com/matthewmorek
# @raycast.description Toggles microphone.
on getMicrophoneVolume()
input volume of (get volume settings)
end getMicrophoneVolume
on disableMicrophone()
set volume input volume 0
log "Microphone turned off 🔴"
end disableMicrophone
on enableMicrophone()
set volume input volume 100
log "Microphone turned on 🟢"
end enableMicrophone
if getMicrophoneVolume() is greater than 0 then
disableMicrophone()
else
enableMicrophone()
end if

View File

@@ -1,11 +0,0 @@
server=/cluster.local/192.168.1.3
server=192.168.1.3
server=192.168.1.4
server=192.168.1.5
server=1.1.1.1
port=53
listen-address=127.0.0.1
bogus-priv
no-resolv
bind-interfaces
auth-ttl=0

View File

@@ -1,4 +1,4 @@
version: 7
version: 3
profiles: []
hotkeys:
copy-current-path: []
@@ -129,71 +129,37 @@ hotkeys:
switch-profile:
- ⌘-Shift-E
toggle-window: []
scroll-to-bottom: []
delete-line:
- ⌘-Backspace
settings-tab: {}
explode-tab:
- ⌘-Shift-.
combine-tabs:
- ⌘-Shift-,
pane-nav-1: []
pane-nav-2: []
pane-nav-3: []
pane-nav-4: []
pane-nav-5: []
pane-nav-6: []
pane-nav-7: []
pane-nav-8: []
pane-nav-9: []
pane-increase-vertical: []
pane-decrease-vertical: []
pane-increase-horizontal: []
pane-decrease-horizontal: []
focus-all-tabs:
- ⌘-⌥-Shift-I
scroll-to-top:
- Shift-PageUp
scroll-up:
- ⌥-PageUp
scroll-down:
- ⌥-PageDown
restart-tab: []
reconnect-tab: []
disconnect-tab: []
command-selector:
- ⌘-Shift-P
terminal:
searchOptions: {}
colorScheme:
name: hyper-chesterish
foreground: '#CDD2E9'
background: '#293340'
cursor: '#2C85F7'
name: Desert
foreground: '#ffffff'
background: '#333333'
cursor: '#00ff00'
colors:
- '#293340'
- '#E17E85'
- '#61BA86'
- '#FFEC8E'
- '#4CB2FF'
- '#BE86E3'
- '#2DCED0'
- '#CDD2E9'
- '#546386'
- '#E17E85'
- '#61BA86'
- '#FFB68E'
- '#4CB2FF'
- '#BE86E3'
- '#2DCED0'
- '#CDD2E9'
- '#4d4d4d'
- '#ff2b2b'
- '#98fb98'
- '#f0e68c'
- '#cd853f'
- '#ffdead'
- '#ffa0a0'
- '#f5deb3'
- '#555555'
- '#ff5555'
- '#55ff55'
- '#ffff55'
- '#87ceff'
- '#ff55ff'
- '#ffd700'
- '#ffffff'
font: OpenDyslexicMono Nerd Font
ligatures: true
cursor: beam
pasteOnMiddleClick: false
autoOpen: true
customColorSchemes: []
background: colorScheme
autoOpen: true
ssh: {}
configSync:
parts: {}
@@ -210,9 +176,3 @@ recoverTabs: false
electronFlags:
- - force_discrete_gpu
- '0'
accessibility: {}
hacks: {}
groups: []
providerBlacklist: []
commandBlacklist: []
profileBlacklist: []