Posts tagged ‘Perl’

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.

Continue reading ‘Tail-ing logfiles with visual timing’ »

As mentioned, my new ESC also has data-logging capabilities. The provided software actually has a fairly descend viewer, but it lacks some features.

Continue reading ‘ESC data logging’ »

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.

Google pointed me to 010 Editor which supports binary templates, which is pretty much what I was looking for. However, this tool only runs on Windows and is commercial. Enough reason to look further.

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
  • Bitfields
  • 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!

rsync is a very nice tool to synchronize two directories, especially if they are on different machines. If you require confidentiality of the transferred data, rsync works great over ssh.

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

Continue reading ‘Restricted rsync over ssh’ »

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!

Continue reading ‘VoltCraft VC-940 protocol reverse engineered’ »

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 instruction manual reveals that there is a computer interface available to read out its data. Naturally, I wanted to explore this!

Continue reading ‘SolarMax MaxTalk protocol reverse engineered’ »

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.

Continue reading ‘Reverse engineering the Oregon WMR928NX weather station’ »

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.

Continue reading ‘Parsing an HTML website in Perl’ »