Skip to content

Instantly share code, notes, and snippets.

@rubenhortas
Last active May 18, 2024 21:20
Show Gist options
  • Save rubenhortas/b111aff3858b287297c0b6c39d510399 to your computer and use it in GitHub Desktop.
Save rubenhortas/b111aff3858b287297c0b6c39d510399 to your computer and use it in GitHub Desktop.
Aliases to encode/decode strings in base64 url (and filesystem safe alphabet) using python3
alias b64urlencode='python3 -c "import sys, base64; print(base64.urlsafe_b64encode(bytes(sys.argv[1], \"UTF-8\")).decode(\"UTF-8\"))"'
alias b64urldecode='python3 -c "import sys, base64; print(base64.urlsafe_b64decode(bytes(sys.argv[1], \"UTF-8\")).decode(\"UTF-8\"))"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment