Wifi in my car: proof of concept

Some drivers love fancy chrome wheel rims, some add a huge wing spoiler on their car, or fuzzy dice hanging from their rear-view mirror. Me, when I bought my new car, I decided that I wanted a Wifi network in my car. So that any passenger with a laptop/iPod could read his email. And I imagined driving to distant holiday locations while my passenger where watching movies streamed from a NAS disk built into the car.

This weekend I finished episode one: Internet in the car. I used the following components:

The important details here are:

  • The Huawei stick is compatible with the TP-Link router.
  • The Huawei stick can be configured with ‘Save my PIN’, so that when it starts up, it connects to the 3G network without any manual intervention.
  • The TP-Link router runs on 12V DC (which is what a car has)

For the rest, the exercise was quite straight-forward: I configured the Huawei stick on my laptop with the right PIN code, popped it in myTP-Link router, configured the right 3G settings for Telenet (see here). Then I took an old 12V power transformer, chopped off the connector and linked it up to an old car cigarette lighter type of plug (sometimes it’s good to have an archive of obsolete cables and power supplies). I then hid the router under the base plate of my trunk, where there is also the battery (the BMW X1 stores the battery in the back, where you would normally have the spare tyre). I switch on the car and 20 seconds later, I have a Wifi network “OnTheRoadAgain” that is connected to the Internet. Proof of concept is OK!

The next step now is to add a (Synology) NAS, which also runs on 12V, and hook up my iPad to the car Wifi to view my collection of backed-up DVDs from that disk. And maybe run some extra programs (e.g. MRTG for monitoring) on that NAS. To be continued!

Convert Black/White footage to thermographic-like video

I am doing some really cool research lately concerning video conversion and one of the issues I ran into concerns infrared imaging. In short: all the ‘cool’ thermographic (colour is dependent on radiated temperature) images are in color, and the images you get from cheap IR cameras is black and white. How do you convert the B/W into colour?

First of all: we’re talking about two different imaging technologies: the ‘real’ thermographic cameras measure only infra-red (not visible) light, are very precise, expensive and are created by companies like FLIR. They make the cameras that you might have seen in CSI.

On the other hand, you have the cheaper webcam/IP-cam devices that have ‘night-vision’. This means that, in addition to all visible light, the cameras are also sensitive to a part of the IR spectrum, and with some additional IR-lighting, one is capable of seeing in very dark places. They produce B/W images or colour, but then sometimes they show green grass as a bit purple/pink.

What I was trying to do is convert a ‘cheap’ B/W video into the coloured thermographic equivalent, but without expecting that e.g. orange will always mean 38°-39°. Since we start from a mixed visible/IR light video, brightness does not correlate perfectly with temperature. Still, the end result might be easier to interpret.

So this is my source material: a Foscam FI8918W video from Youtube: two cats playing in a kitchen.

I find some inspiration from a guy who did something similar with ImageMagick. The dark/cold areas are supposed to be black/blue, the medium areas more green, then going to yellow, orange, red and white. This seems like a job for the FFMPEG video filter.

I use the ‘curves’ filter and try first with really strong contrast colours:

The color scheme is kind of OK, but we lose a lot of detail (the cats become hard to distinguish). So then I try a more gradual approach:

And this is rather OK. I like it. The cats come out nice.

For the record: the curves used are approximately this:

curves=r='0.4/0 0.6/1':g='.25/1 .75/.5 .9/0 1/1':b='0/1 .25/0 .75/0 1/1'

All scripts and parameters are on my GitHub account: https://github.com/pforret/pfor_ffmpeg/tree/master/thermography

 

Status page for telecom/internet providers

My mobile provider Telenet had a partial outage today. Sometimes calls would go though, sometimes not. Same things with SMS and 3G. I wanted to check if there was a page I could check to see if it was just for me, just for that location on globally in Belgium. You know, a proper status page like Google and Apple have. Or in Belgium, like Combell. It appears Telenet has one, but it’s for the Internet division. They also have a Twitter account that is well followed up. How does this compare to the other providers? Here is an overview of who offers what:

Mobile Telephony/Data

Belgacom Proximus

Mobistar

Telenet (on Mobistar network)

Base (part of KPN)

Mobile Vikings (on Base network)

Broadband Internet

Belgacom

Telenet

Scarlet (part of Belgacom)

Kudos to http://www.ionasj.com/welk-netwerk-voorziet-de-beste-dekking/

Cleaning up an infected PHP server (Mal/Badsrc-M – Troj/PHPShll-B)

I recently discovered that a number of sites of mine were considered unsafe by Google, Firefox, Yandex … The reason was they had detected malware being served to visitors of the site. I checked a bit further and I discovered it was the Mal/Badsrc-M – Troj/PHPShll-B trojan. In each of my (WordPress and other) PHP files, the first line had been changed to

<?php /* */ eval(base64_decode("...(bad stuff)"));?><?php ...
The file is easy to clean up: you remove the eval statement and that’s it. Only, on this server several hundreds of PHP files (WordPress, MediaWiki, …) were affected. So I made a script to go through all of them and clean up. It uses the fact that

  • the whole injected statement is on 1 line
  • no ‘decent’, trustworthy program uses eval(base64_decode(" ... ")) in its PHP code
  • it moves the second <?php to the second line and then removes the whole first line

So if you have the same problem, use a bash script like this and run it in the root of all your websites: