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

Don't grep, but filter terminal output and colour certain lines (and print all other lines too)

Ruby:

acoc source with dependency of term-ansicolor gem.

Perl:

tail -f /some/log | perl -MTerm::ANSIColor -ne'print color("red") if /error/i; print $_; print color("reset");'

or

tail -f /some/log | perl -MTerm::ANSIColor -pne's/foo/color("cyan")."foo".color("reset")/e;'

or

tail -f /some/log | perl -MTerm::ANSIColor -pne's/(error|bar)/color("green").$1.color("reset")/eig;'

Bash:

Emacs font-lock-keywords can easily be implemented in a 3 line bash script. Call it "highlight":

    # Usage: tail -f error.log | highlight "error"
    RED="$(tput setaf 1)"
    RESET="$(tput setaf 7)"
    sed "s/$1/$RED$1$RESET/"

Non-functional checklist

When writing a user story or writing a spec for a piece of development work, consider the following non-functional aspects:

  • Authentication
  • Session management
  • Access control
  • Input validation
  • Output encoding/escaping
  • Encryption
  • Error handling and logging
  • Data protection
  • Communication security
  • HTTP security features
  • Monitoring
    • Logging of significant code paths
    • Logging of expected events and errors
    • Catching and logging of unexpected errors (crashes)
    • Metrics for stats of usage and throughput (requests)
  • Performance, e.g. response time must be <500ms


This is especially useful when building new systems like a new app or API.

Can't connect to London underground WiFi after changing device

Problem:

You just changed your phone/tablet/device. Now you can't connect to the free Virgin Media wifi at London underground stations.

Solution:

  • Call your phone company's tech support (For EE it's 150, the 1, 3, 4)
  • Tell the level 1 support person that you've already tried all the troubleshooting steps including a network refresh
  • Ask to be put through to level 2
  • Ask the level 2 tech to un-register you from London underground wifi, wait 24 hours and re-register.
  • After that, follow the process for a new WiFi password (for EE it's texting EEWIFI to 9527).