kubectl explain
kubens/kubectx https://github.com/ahmetb/kubectx
kubecfg https://gist.github.com/caruccio/5c25ef92d7ad0f2e8d2e1b39c0271110
| #!/usr/bin/env python3 | |
| def pizza(qtd_bolas: int, peso_bola: int, hid: int = 75) -> dict: | |
| peso_total = qtd_bolas * peso_bola | |
| sal_g = peso_total * 0.02 | |
| ferm_g = 1 | |
| agua_g = (peso_total / (hid + 100)) * 70 | |
| farinha_g = peso_total - sal_g - agua_g | |
| items = [('farinha', farinha_g), ('agua', agua_g), ('ferm', ferm_g), ('sal', sal_g)] | |
| return dict(items) |
| lowerCamelCase() | |
| { | |
| python -c "s='$1'.replace('-','_').title().replace('_',''); print(s[0].lower()+s[1:])" | |
| } | |
| lowerCamelCase adeus_mundo-cruel | |
| adeusMundoCruel |
| #!/bin/bash | |
| if [ $# -lt 2 ]; then | |
| echo Usage: $0 NEW-REGISTRY NEW-OWNER [push] | |
| exit 1 | |
| fi | |
| new_registry="$1" | |
| new_owner="$2" | |
| push="$3" |
| # curl -sLO https://gist.github.com/caruccio/b9eb86e307ecc293d5b832af8c577605/raw/kubectl-setup.sh && bash -i kubectl-setup.sh | |
| mkdir -p ~/bin ~/opt | |
| ## PATH | |
| if ! [[ "$PATH" =~ (^|.*:)(~/bin/?|$HOME/bin/?)(:.*|$) ]]; then | |
| echo 'PATH="~/bin:$PATH"' >> ~/.bashrc | |
| export PATH="~/bin:$PATH" | |
| fi |
| # Install: add this function to your ~/.bashrc or ~/.profile | |
| # Open a new shell and use it: | |
| # | |
| # $ for_dir /tmp /home /var -- ls -la | |
| # | |
| function for_dir() | |
| { | |
| local dirs=() |
| #!/bin/bash | |
| function download() | |
| { | |
| KUBECTL_VERSIONS=( | |
| $(curl -s "https://api.github.com/repos/kubernetes/kubernetes/releases?per_page=100" \ | |
| | jq -r '.[] | .tag_name' \ | |
| | grep '^v[0-9]\.[0-9][0-9]\?\.[0-9][0-9]\?$' \ | |
| | sort -Vr \ | |
| | awk -F . '!a[$1 FS $2]++' \ |
| #!/usr/bin/env python | |
| class TermSequence: | |
| '''Reference: https://stackoverflow.com/a/33206814/1006369 | |
| ''' | |
| sequence = [] | |
| # standard 4-bit color codes | |
| black = 30 | |
| red = 31 |
kubectl explain
kubens/kubectx https://github.com/ahmetb/kubectx
kubecfg https://gist.github.com/caruccio/5c25ef92d7ad0f2e8d2e1b39c0271110
$ cat kubectl-show_tls
#!/bin/bash
BIN_AWK=${0}.awk
command kubectl get secret -o json "$@" \
| jq -r 'select(.type="kubernetes.io/tls") | .data|.[]|values|@base64d' \
| xargs printf "%b" \| #!/bin/bash | |
| usage() | |
| { | |
| echo "Usage: kubectl show-secret [-n namespace] secret [...secret]" | |
| exit | |
| } | |
| while [ $# -gt 0 ]; do | |
| while getopts n: opt; do |