Archive for the 'Perl' Category

Removing dead tracks from your Banshee library

Sunday, October 6th, 2013

I used MusicBrainz Picard to reorganize hundreds of the files in my music collection. For some reason Banshee spotted that new files appeared, but it didn’t remove the old ones from the library. My library had hundreds of entries relating to files that no longer existed on disk. I would have hoped that Banshee would […]

Scanning for open recursive DNS resolvers

Friday, January 11th, 2013

A few days ago we unfortunately had some abuse reports regarding customers with DNS resolvers being abused in order to participate in a distributed denial of service attack. Amongst other issues, DNS servers which are misconfigured to allow arbitrary hosts to do recursive queries through them can be used by attackers to launch an amplified […]

Converting an IPv6 address to its reverse zone in Perl

Thursday, November 29th, 2012

I’m needing to work out the IPv6 reverse zone for a given IPv6 CIDR prefix, that is a prefix with number of bits in the network on the end after a forward slash. e.g.: 2001:ba8:1f1:f004::/64 → 4:2::/32 → 2001:ba8:1f1:400::/56 → I had a quick look for a module that does it, but […]

Adding watermarks to a PDF with Perl’s PDF::API2

Sunday, August 7th, 2011

For ages I’ve been trying to work out how to programmatically add a watermark to an existing PDF using the Perl PDF::API2 module. In case it’s useful for anyone else, here goes: use warnings; use strict; use PDF::API2; my $ifile = “/some/file.pdf”; my $ofile = “/some/newfile.pdf”; my $pdf = PDF::API2->open($ifile); my $fnt = $pdf->ttfont(‘verdana.ttf’, -encode […]

Copying block devices between machines

Sunday, March 13th, 2011

Having a bunch of Linux servers that run Linux virtual machines I often find myself having to move a virtual machine from one server to another. The tricky thing is that I’m not in a position to be using shared storage, i.e., the virtual machines’ storage is local to the machine they are running on. […]

Setting envelope sender when using Mail::Send

Wednesday, March 14th, 2007

I just thought I would blog this so that people can find it in a search, as I could not when I tried. I have a perl script on a machine that sends out transactional emails with the from address like The machine it sends from is not Let’s call it Since […]