I regularly watch log files in real time using the highly appreciated tail -f command. But I usually find myself manually inserting newlines to give a visual clue of which log-lines happened together. Obviously the timestamps in the lines tell you the full story, but it’s not that visually appealing.
Posts tagged ‘Perl’
I was looking for an easy way to parse a binary file. I know what the file contains (it’s an MPEG2 transport stream) and know the bit-field layout. It’s just a pain to figure the bits out manually in a hex editor.
That’s when I came across the Data::ParseBinary perl module, which is a true relief to use. It supports pretty much every thing you need to parse a binary file:
- Signed and unsigned integers
- Big and little endian
- 8, 16, 32 and 64 bit integers
- Enum-types to specify your own names for values
- If-constructs: Fields are present or not depending on the value of another field
In short, an incredible tool!
Besides the standard password authentication, ssh also supports public key authentication. This key-based authentication has the added bonus of having per-key options:
- you can restrict the source IP from which this key may be used
- you can force a command to be executed instead of allowing the connecting side to specify one
I got another toy to play with: A digital multimeter with RS232 interface and True RMS power measurement. Sadly, it comes with Windows-only software, which I interpreted as a challenge!
At my parents place, we installed photovoltaic cells. The produced electricity is converted to AC power and is coupled with the normal grid: if we produce too little, the grid provides the remaining power; overproduction is given to the grid.
The inverter (the device that converts DC into AC) is a SolarMax C-series. It has a 2-line LCD display that gives out some basic information: current, voltage, power; produced energy today, this month, this year, … This is very useful information, but is a bit hard to access. The reveals that there is a computer interface available to read out its data. Naturally, I wanted to explore this!
Our weather station has a serial connection and comes with Windows-software to view the weather data on your PC. The app is very eye-candy, but doesn’t do anything more than displaying the data. I’m more interested in long-term trending. So I wrote my own application to talk to the weather station and store the result in an rrdtool database.
I always wanted to know how to filter pieces of information from all the HTML-bloat surrounding it. As a proof of concept, I wrote a Perl program that parses the Skynet Electronic Program Guide and turns it into an XMLTV-file. XMLTV is a file-format used by programs like MythTV to present the on-screen program-guide and to schedule recordings.