Bash: having the last word
Bash is the de facto shell these days, and for good reason. Most of us who peck away at our shells all day become pretty good with Bash’s keyboard shortcuts, but there’s one handy and little known...
View ArticleIntercepting the STDIN and STDOUT of a process with strace
There are times when debugging system behaviour when it can be very useful to see what the inputs and/or outputs of a process are: to read its STDIN and STDOUT filehandles. It can be handy to know...
View ArticleExtract all sender email addresses from a mailbox with Python
As a freelance tech contractor, I get a lot of emails every day from recruiters about prospective jobs. Many of these are unsolicited, but this is a good thing, as over time, quite a large list of...
View ArticleObtain the external IP address from the command line
The IP address that a host presents to the Internet is probably not the same one on its network interface, thanks to the magic of NAT. The difficulty of obtaining this address comes from the fact that...
View ArticleDetermine MongoDB secondary node without authenticating
While operating a MongoDB cluster, it can often be useful in maintenance scripts to check whether a host is the primary or secondary (master or slave). This is easy to do, and can be done without...
View ArticleFast Indenting with vi
Indenting lines with leading tabs is an important technique for writing clear and readable code, and are essential in Python where they have syntactic meaning. Many IDEs insert tabs automatically, but...
View ArticleReconfigure Mongo DB Replica Set Member by Attribute
When configuring the attributes of members of a Mongo DB replica set, either in the mongo shell or a script, the typical procedure is to set each attribute by its array reference. The weakness in this...
View ArticleRandomly stagger parallel command execution
I’m a big fan of using MultiSSH for performing quick hacks on multiple hosts at once. ClusterSSH is nice too. I hate myself for using it, because frankly any form of parallel execution should really...
View ArticleSchedule Icinga/Nagios Downtime with Capistrano
Capistrano is an invaluable automation tool, but simultaneously restarting services and hosts can play havoc with your monitoring and alerting. It’s therefore also a good idea to use Capistrano to...
View ArticlePuppet iteration through recursion
One thing that the Puppet language doesn’t do – and apparently this is entirely by design – is iteration. There’s no way to loop a block – no foreach, while or repeat. While this function would seem to...
View Article
More Pages to Explore .....