When dealing with Kubernetes secrets or when testing REST-services using i.e. curl it’s nice to have a fast’n’easy way of de- and encoding characters using base64.
$ echo -n "Hello World" | base64         # SGVsbG8gV29ybGQ=
$ echo -n "SGVsbG8gV29ybGQ=" | base64 -D # Hello WorldTo make it even more convenient you can define properly named functions in your .aliases (or .bashrc/.zshrc):
function enc() { echo -n "$1" | base64 }
function dec() { echo -n "$1" | base64 -D }Now the initial example can be accomplished using:
enc "Hello World"                        # SGVsbG8gV29ybGQ=
dec SGVsbG8gV29ybGQ=                     # Hello World