Bash Scripts Quickstart Guide

Bash scripts are a great way to automate simple tasks in our electronic day-to-day life. Once you get used to writing them, it easily becomes a productivity increasing habit. Here's a list of my most often used bash features and constructs. Shebang and Options I like to start every bash script with the following 3 lines: #!/usr/bin/env bash set -e set noclobber The first is the shebang line which lets us run the script as executable. Note the use of env which makes the

Read more

Writing Simple Filters In Perl, Python and Ruby

File input opeations in perl, python and ruby feels almost as if they were written by the same person. In this post I'd like to examine their similarities and differences, and hopefully learn something about the philosophy of the languages themselves. Our Task A unix filter is a command that takes its input from stdin, though most filters also allow input from files passed in as command line arguments. Take wc for example: $ ls | wc $ wc /etc/passwd $ wc /etc/passwd /etc/shells All 3 work

Read more

3 Cool Uses For Tagged Template Literals

ES6 Template literals have become one of my most used JavaScript features. Tagged template literals work about the same way but let you write your own "tagger" or handler function which does the interpolation. Why would you want to? I could think of 3 reasons. But first the gory details

Read more