Skip to content

Instantly share code, notes, and snippets.

View chaspy's full-sized avatar
💭
🤔

Takeshi Kondo chaspy

💭
🤔
View GitHub Profile
@chaspy
chaspy / retry.sh
Created January 7, 2019 01:47 — forked from sj26/LICENSE.md
Bash retry function
# Retry a command up to a specific numer of times until it exits successfully,
# with exponential back off.
#
# $ retry 5 echo Hello
# Hello
#
# $ retry 5 false
# Retry 1/5 exited 1, retrying in 1 seconds...
# Retry 2/5 exited 1, retrying in 2 seconds...
# Retry 3/5 exited 1, retrying in 4 seconds...
@chaspy
chaspy / peco-kubectx
Created September 9, 2018 15:45 — forked from yuya-takeyama/peco-kubectx
Select Kubernetes context with peco
#!/bin/bash
PECO_CMD="peco"
KUBECTL_CMD="kubectl"
if ! hash "${PECO_CMD}" 2> /dev/null; then
>&2 echo "error: ${PECO_CMD} is not installed"
>&2 echo "see https://github.com/peco/peco"
exit 1
fi