A 7-post collection

RSS feed of posts tagged programming

Compute largest summary prefix-length with Python

I'm sure many of you had to compute summary network given a number of subnets. It's one of those rare occasions when you have to dust off binary maths skills »

PyTips 2 - Use itertools.product to replace nested loops

Nested loops, we all love them. Or do we? Five levels of indentation later you are not so sure. Your code starts to look ugly and you wish there was »

PyTips 1 - Get loop counter with enumerate()

In PyTips I'll be talking about Python features, standard libraries, and interesting packages found on PyPi. The idea is to have a short write up and accompanying code snippets for »

Python - sort IP addresses from the Linux shell

Have you ever found yourself needing to quickly sort IP addresses directly from the Linux shell? You just ran grep against all of your configs looking for IPs in some »

Python: Relative and absolute paths

Often we need to read from, or write to, files in directories that are local to our script. For instance, we could use the below code to save to file »