Prefetch Technologies // Keeping your cache lines cozy

Archive

Posts from 2017

Normalizing date strings with the Python dateutil module

personalAug 2, 2017 1 min read

I recently attended a Python workshop with Jeff Cohen and he answered a ton of random questions from students. One student mentioned that he was overwhelmed with the number of Python modules and Jeff told us that he has evolved his Python skills by learning at least one new module each week. I've started doing this as well and it's been a HUGE help. Each Sunday I find a module I'm not familiar with in PiPY or the standard library and read through the documents…

$ read more →

Monitoring DNS domain name expiration with dns-domain-expiration-checker

networkingpythonAug 2, 2017 2 min

Several years ago I wrote a simple bash script to check the expiration date of the DNS domains I own. At the time I wrote this purely for my own needs but after receiving 100s of e-mails from folks who were using it (and submitting patches) I decided to enhance it to be more useful. As time has gone on Registrar WHOIS data formats have changed and I came to the realization that there is no standard time format for expiration records. I needed a more suitable solution so I spent last weekend re-writing my original script in Python…

$ read more →

Using awk character classes to simplify parsing complex strings

shellJul 21, 2017 1 min

This week I was reading a shell script in a github repository to see if it would be good candidate to automate a task. As I was digging through the code I noticed a lengthy shell pipeline to parse a string similar to this: Here is the code they were using to extract the string "gorp": After my eyes recovered I thought this would be a good candidate to simplify with awk character classes. These are incredibly useful for applying numerous field separators to a given line of input. I took what the original author had and simplified it to this: The argument passed to the field separated option (-F) contains a list of characters to use as delimiters…

$ read more →

Debugging ansible playbooks, plays and tasks

ansibleJul 19, 2017 7 min

I am a long time ansible user and have wrangled it into automating just about everything I do. As my roles and playbooks have increased in quantity and size I've found it's essential to have a good grasp of the debugging capabilities built into ansible. These are useful for detecting syntax errors, finding ordering issues and most importantly for learning how ansible works under the covers. In this post I'm going to cover a number of methods to test playbooks and troubleshoot issues when they pop up…

$ read more →

Simplifying python development with virtual environments

pythonJul 19, 2017 2 min

Over the past year I've spent a considerable amount of time beefing up my development skills. One of the best ways I've found to improve my skills is by reading code from well respected developers, watching udemy and youtube videos, fixing bugs in code I'm not familiar with (you will find some doozies this way) and benchmarking code to see what the system and resource ramifications of a change are. To allow myself to experiment in isolation I've relied heavily on Python virtual environments. Virtual environments are code sandboxes and everything (libraries, packages, etc.) in a given virtual environment is isolated from everything else on your system…

$ read more →