A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

SSH port forwarding / tunnelling

Command for a tunnel:

ssh -D 9999 username@remote-host
  • -D means "dynamic application-level port forwarding"
  • 9999 is a port you make up
  • username@remote-host is the account you're relaying through
  • A prompt on the remote host will appear, ignore it (or use -N to avoid)
In your web browser, set the SOCKS5 proxy to localhost:9999

Don't indent so much

TL;DR: Don't indent over more than one page.

When programming, please factor your subroutines enough. One test for this is the level of indentation. If you find the code is indented for longer than one page (i.e. around 40-50 lines), then split that indented code out into its own subroutine.

This applies to loops, if-then statements, try-catch blocks, and given-when blocks. Especially when any combination of those are nested over several pages, it makes the code very difficult to follow.

Anything that indents the code indicates a logical grouping which you may find fits happily into a new subroutine. You can even give the subroutine a meaningful name which will serve as a signpost to future maintainers (not to mention a useful checkpoint to assert that variable contents are correct by validating the subroutine arguments).