• $ for f infind . -type d; do pushd . > /dev/null ; echo -ecd $f ; find . -name *.js | wc -l"\t" $f | grep -v ^0 ; popd >/dev/null; done | sort -n -k 1 -r | less

    I wanted to count and display the top directories containing JavaScript files in some of my project. Here it is. Maybe it can be written to more simply syntax by using find -exec…

    View this command to comment, vote or add to favourites View all commands by tobi

    commandlinefu.com

    Diff your entire server config at ScriptRock.com

    http://feedproxy.google.com/~r/Command-line-fu/~3/ZAMRabS8DqE/count-number-of-javascript-files-in-subdirectories

    read more
  • $ cat configmap.json | jq 'with_entries(if .key == "data" then .value=(.value | to_entries | map( { (.key): (.value|@base64) } ) | add ) elif .key == "kind" then .value="Secret" else . end)'

    simple jq one-liner to convert from configmaps to secrets (which require the values to be base64 encoded).

    To automatically pull the config map, convert it, and re-upload the corresponding secret:

    kubectl get --export -o json cm [configmap name] | jq ‘with_entries(if .key == “data” then .value=(.value | to_entries | map( { (.key): (.value|@base64) } ) | add ) elif .key == “kind” then .value=“Secret” else . end)’ > secret.json; kubectl create -f secret.json

    View this command to comment, vote or add to favourites View all commands by tyzbit

    commandlinefu.com

    Diff your entire server config at ScriptRock.com

    http://feedproxy.google.com/~r/Command-line-fu/~3/qgjN_q700bU/convert-kubernetes-configmaps-to-secrets

    read more
});