URL Decoding with Ruby on the Command Line
When working with URLs that contain other URLs (such as a
redirect_uri in an OAuth2 authorization request), you may get annoyed when you can't decode the encoded URL off the top of your head. I couldn't find an easy command-line tool to do this for me, so have resorted to trusty Ruby.
Following the advice from this Stack Overflow answer, we can use
CGI.unescape, and create a nice command-line one-liner:
ruby -rcgi -e 'puts CGI.unescape(ARGF.read)'
This lets us i.e. run:
$ echo 'https%3A%2F%2Fwww.jvt.me' | ruby -rcgi -e 'puts CGI.unescape(ARGF.read)' https://www.jvt.me