How to intercept e-mail messages using E-MailRelay SMTP proxy

Recently I had a suspicion, that my e-mail messages weren’t delivered properly. I use Gmail as a client, however some of my messages are fetched from and sent through the third party server. I was under the impression, that not all of the messages that I send are delivered to the recipient. This problem is hard to debug, because Gmail provides no logs nor client support, and it is also troublesome to get the information from my e-mail/hosting company every time I think something’s wrong.

Continue…

How to modify and calibrate regular servo to be continuous servo

Most of the servos that are available at reasonable prices are “standard” servos. That means, the output shaft of the servo can be positioned in the position from 0 to 180 degrees. It can be set by the duration of the pulse sent to the control wire (yellow, orange or white) of the servo. Other two wires are power (red) and ground (black or brown). In Arduino, there is Servo library, which serves this purpose.

Standard servo is useful when you want to control angle. However sometimes, you need continuous rotation in specified direction. It is easy to modify standard servo to become continuous servo. In such case, degree of 0 means full speed in one direction, 180 – full speed in other, while middle value means no motion (it is around 90 – more about calibration later).

This tutorial will show you, how to perform such easy modification. You will need to remove the potentiometer and replace it with two 2,2k Ohm resistors.

Continue…

Renew your CrashPlan subscription with discount exclusive for new users

CrashPlan is pretty amazing backup solution – it provides multiple backup solutions for your personal data, including unlimited cloud storage, backup to friends or local devices and other. They charge $59.99 annually for unlimited plan (1 computer). Frequently (like, all the time) they offer large discounts (20% and more) for new users. However, they forget about existing users – if you want to extend your subscription, you need to pay full amount. When I asked them about that, they told me, that it is a technical difficulty to sort this out in their billing system.

I think it’s unfair for existing customers, who refer the service to their friends and families (i.e. I referred them to at least 4 or 5 paying customers). I found a way to extend your account with the discount in a couple of easy steps:

  1. Log into your CrashPlan account on their website.
  2. Find your subscription, cancel it. They will warn you, that all data will be deleted. What they won’t tell you is that they will not do it immediately – your data is still there for a couple of hours.
  3. At this moment go to the discount offer page (look at their website or facebook page), while still logged in.
  4. Buy the discounted subscription. You will receive new license key.
  5. In the CrashPlan application delete old license key and paste the new one.
  6. Enjoy your extended subscription at the discounted price ­čÖé

Note: this method is valid as of November 1, 2013.

Note2: I tried to use this method recently (November 1, 2015) and it doesn’t seem to be working anymore. If you were successful – please let me know!

Use multiple computers with one mouse and keyboard – Synergy

Recently at my office we have set up extra machine with large screen to show project statistics, error notifications, occasional after-5pm-funny-videos, etc. (I plan to cover this subject in the future). Unfortunately, it is quite uncomfortable to work on this  machine with head upwards all the time, stuck between two desks with mouse and keyboard on your laps.

That’s why I found a tool, that is great, when one wants to control multiple computers with just one keyboard and mouse: Synergy. This solution doesn’t require to set up any remote desktop connection or any special hardware. One doesn’t have to switch between the devices – you can move the cursor (and thus, the keyboard’s focus) from one computer to another. Furthermore, it’s multiplatform, so you can use it on the Mac, Windows and Linux machine on the same time. The software is built on the server-client architecture – computer with keyboard and mouse attached (i.e. your desktop computer) is server. It runs the service and all other devices should connect to this computer. You can use the other devices’ keyboard and mouses simultaneously on the respective devices, but only the server can move the cursor between the computers.

Configuration is straightforward: you have to install the application on every device you wish to use. Then, on the designated server, you should configure the computers that are allowed to connect (by designating simple names). You have to place every computer on the matrix. Then, start the server and on the clients – connect to the given server’s IP. That’s it.

Main "Synergy" application screen.

Main “Synergy” application screen.

Client configuration matrix - "Synergy".

Client configuration matrix – “Synergy”.

Awesome version control visualization with gource

After a big project it is often cool to release “making of” video, presenting collaborative effort of people who contributed to the success. In case of designers, filmmakers or other “artistic” types it is quite easy to present their work in progress. But what about developers? They always sit at their desks and type on their keyboards, it looks the same at the beginning and at the end of the project – nothing spectacular.

A year ago, when we finished new version of www.k2.pl website I wanted to show – in light and comprehensive way – the vast amount of awesome work performed by my team. This is where gource came to the rescue. Gource is an awesome tool to visualize work on the codebase in form of colorful video. It takes information about the code structure, contributors and timing from logs of revision control tools (Git, Mercurial, SVN and Bazaar are supported). Code is presented as branches and leaves, being worked on by developer icons flying around. As the tool is highly parameterizable, it is easy to add colors, logos, backgrounds, etc., show or hide specific information.

You may easily play with the tool by yourself, so as a quick tutorial, here are the commands to generate simple video. You need gource itself and the FFmpeg library. These commands are Windows specific (as my Windows box is more powerful), but they’re easy to port to Linux. Try to play with the parameters by yourself.

First, of course, clone your repository to specific location. Then, run this command to create PPM file with the video (PPM file is a series of bitmap images, so expect this file to be huge):

"c:\program files (x86)\gource\gource.exe" -s 0.5 --hide filenames -1280x720 -o gource.ppm

Then, you need to convert the PPM file to compressed video:

C:\ffmpeg\bin\ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i gource.ppm -vcodec libx264 -preset ultrafast -crf 1 -threads 0 -bf 0 gource.x264.avi

And voila, you have a nice video:

Good luck with preparing your own awesome visualizations ­čÖé

Monitoring your services with Papertrail and Heroku

Recently I have noticed some problems with my Internet connection, sometimes it was completely unavailable. I concluded that I need some precise information about the outages, so I can talk to my ISP. As at the same time I learned about the Paper Trail service, I decided to use it in my setup. Other thing, that I wanted to learn was Heroku, so I gave it a try. Both services have some free tier, which is perfectly sufficient for my needs.

The architecture of my solution is as follows: I have local server running on Raspberry Pi (as mentioned in one of the previous posts about the online radio streaming). On this server, I have a Python script, running as a cron job every 10 minutes. This script sends simple log message to my Papertrail account. Then, I have another Python script, that runs every 10 minutes as a scheduled job on Heroku. This script checks, if there are recent “heartbeat” logs on Papertrail and if not – sends an e-mail message. You can download the source code of both scripts from the github repository.

Continue…

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…”)

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.