Entries filed under Useful tools

Sleep better by making your display adapt to the time of the day

Some research show, that sleep problems are often caused by usage of computers or other electronic devices before going to sleep [1]. I am one of these people, who like (or have to) work late in night. About a year ago I found piece of software called f.lux, which runs in the background and makes your display to adapt to the time of the day. It takes your location and current date and calculates the time of the sunset. It then gradually adjusts your display colors’ temperature to be warmer – thus helping you get better sleep or not being blinded when you turn on your display at night.

The f.lux software is available for free for Windows, Linux, Mac and jaibroken iOS devices from it’s website: http://stereopsis.com/flux/.

[1] http://stereopsis.com/flux/research.html

f.lux configuration dialog

f.lux configuration dialog

How to force Gmail to check your POP3 account as often as possible

One, of the killer features of Gmail (in my opinion) is ability to collect e-mails from external POP3 accounts and send messages via external SMTP servers. This way, one can use Gmail as slick, web based e-mail client to virtually any account in any domain, with the benefit of IMAP access, labels, autoresponders, spam filtering, etc.

Unfortunately, Gmail uses “intelligent” algorithm to figure out, how often it should collect e-mail messages from your POP3 server. It is based on the amount of mail you get – if you receive merely few messages per day, Gmail will check the server twice every hour. In extreme situation it means 29-minute delay in delivering the message that you are waiting for – not very convenient lag, hard to accept in the 21st century. If you get your e-mails often, Gmail is going to check your account every five minutes or so.

So, how to get your account checked every few minutes (= almost no delay in delivery of your important messages)? Lure Gmail into thinking, that you get maaany important emails every few minutes. You can accomplish it by simple Python script, that you should run on your server (i.e. Raspberry Pi with Raspbian, that you can run in your home). (Click “Continue…”)


Multitail – monitor multiple log files with tail on steroids

Every developer is familiar with tail – tool used to display the last lines – or tail – of the file. Of course most popular usage of this command is:

tail -f /var/log/uwsgi.log

…which displays continuously updates to the file. Every time new line is appended (i.e. to the log file), it is also printed to the screen. It is useful, when one wants to monitor log files in the real time to see the progress of some action or to look for errors in the application.

Recently, I had to monitor four application servers at once. At every one of them there was the same application. To monitor logs, I had to open four ssh sessions and then run four tail commands. I had to switch to such log monitoring once every few hours, so it started to be tiring. After short search, I found the most useful tool since tail – multitail. It allows you to tail multiple files at once – in many different configurations. Multitail not only is capable of displaying the log files, but also filtering them, adding some lines, etc. Just look at the list of the features.

So with multitail, monitoring four logfiles on remote machines is as easy as:

[email protected]:~$ multitail -s 2 \
 -l "ssh pr_app1 tail -f /var/log/uwsgi.log" \
 -l "ssh pr_app2 tail -f /var/log/uwsgi.log" \
 -l "ssh pr_app3 tail -f /var/log/uwsgi.log" \
 -l "ssh pr_app4 tail -f /var/log/uwsgi.log"

(where pr_app[1-4] are different hosts, defined in my .ssh/config file and “\” denotes line break, for easier reading).

Result is very similar to this:

Multitail example.