Ifupdown News

A new version of ifupdown has been uploaded to experimental yesterday, which brings some important changes.


GTK+ 3 Done Right

Ever wanted your GTK+ 3 look better? Unsatisfied with the default settings of Adwaita theme? Add these configuration files to your ~/.config/gtk-3.0:

This will add some nice borders to menus as well proper background to menu items.

And this will set font to Sans 9 and not anything else which is for some reason is the default.


Piano Man

Those who had chance to be in the ‘Stolitsa’ shopping mall in the centre of Minsk yesterday, could enjoy a wonderful performance which was happening there.


Sixxs Suxxs?

Recenly I’ve decided to register at Sixxs to be able to use IPv6 at my new location as they seem to use tunnelling protocol which bypasses NAT, so that was exactly what I needed. I’m a long time HE.NET user, so I expected the same quality of service and ease of use. I went to their website and filled in the registration form.


Binary Watch: NG

LED binary watch is a one of the most common geek gadgets available. The only problem with binary watch is that while it’s done to be ‘cool’ and unusual, it’s also not very convenient to use even for geeks, at least in my opinion. I think so because it fundamentally breaks the way people use watch usually. Correct me if I am wrong, but in my opinion the exact numbers don’t have any real meaning for everyone who uses watch. What’s important is which part of some interval of time is now: morning, evening, noon or midnight, and a fraction which tells us how far we are from one important point in time or from another. The same applies to shorter time intervals: usually an hour’s divided into quarters or 5-minute intervals.

So, I’d like to propose a different approach.

First, we divide twenty-four hours into intervals of 3 hours each, and encode this in binary. Thus, any time between 12:00 and 14:59 will be represented by a code 0100. To specify the exact hour inside that interval, we append its number in binary to the code above, so for 13:00 we get 0100.01. The code .11 isn’t used in this approach at all.

Next, the same we can do to minutes. Two digits can be used to specify an hour quarter. To specify the exact minute, we add four more digits; the code .1111 isn’t used again.

Now, some examples:

12:34 → 12+00 : 30+04 → 0100.00 : 10.0100

03:27 → 03+00 : 15+12 → 0001.00 : 01.1100

Anyone to produce such a binary watch? ;)


Extra Large Image Editing

How often do you need to do something with extra-large images? Usually, I don’t need to, but recently I’ve received one such an image, and really needed to crop it. That image was 21 MiB 16 Kpixel×12 KPixel aerial image in a JPEG file. As anybody knows, JPEG files can be converted without decoding the whole image in the memory, you can read why on the Wikipedia. You just need to go through all image blocks sequentially and write them in the new format. If the image is progressive JPEG, this is even easier. The same with cropping: you can just skip some image blocks without decoding them.

I was surprised when discovered that my usual helper programs couldn’t crop this file without eating all my memory and disk space (my laptop has limited both). ImageMagick’s convert and couldn’t do the task: convert got 795 MiB virt and 300 MiB res, and created 1.2 GiB temp file, so I killed it. nip2, while it was recommended by some people, wasn’t able to work for some reason, it just couldn’t load the image at all.

I was ready to write my own JPEG re-encoder when I’ve found jpegtran. It was written by IJG (Independent JPEG Group). This program was able to do anything I needed. It can crop, flip, flop, rotate, transpose and transverse images, convert them to greyscale, re-optimize, and make JPEG progressive. Also you can control memory usage, so it will not make you system unresponsive by eating it all.

Cropping image is as easy as this:

$ jpegtran -crop 640x480+0+0 in.jpg > out.jpg