• $ 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:undefined:…:undefined:

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

    commandlinefu.com

    Diff your entire server config atScriptRock.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 :undefined:‘:undefined:with_entries(if .key == :undefined:“:undefined:data:undefined:”:undefined: then .value=(.value | to_entries | map( { (.key): (.value|@base64) } ) | add ) elif .key == :undefined:“:undefined:kind:undefined:”:undefined: then .value=:undefined:“:undefined:Secret:undefined:”:undefined: else . end):undefined:’:undefined: > secret.json; kubectl create -f secret.json

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

    commandlinefu.com

    Diff your entire server config atScriptRock.com

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

    read more
});