How to reboot Motorola SURFboard modem from command line

I got this annoying problem - my cable modem start acting weird after a while. So I wanted to setup cron job to restart it sometimes around 3am each day, but the problem is - there is no SSH or any kind of API access. But there is admin panel where you can click "Reboot" button. To solve this problem I used Zombie.js module:

sudo npm install zombie -g

and wrote small script to login into admin interface and click Reboot button:

Libvirt, UFW and port forwarding via DNAT

I am running several virtual machines on my server for different applications. And I am using port forwarding to route connections to appropriate virtual server. For example, I have separate mail server and I map host's port 25 to this virtual server port 25.

MySQL not use indexes for subqueries used in IN clause

One of clients mentioned awful slow query from Drupal's Boost module:

DELETE FROM boost_crawler WHERE hash IN (
  SELECT ca.hash_url FROM boost_cache ca
  WHERE ca.expire BETWEEN 1 AND 434966399 OR ca.expire > 434966400

Running EXPLAIN query turns out MySQL ignores indexes for boost_crawler.hash column completely. And I am not alone:

Installing Net::Amazon::MechanicalTurk on recent version of Perl

If you tried to install Net::Amazon::MechanicalTurk via cpan/cpanm command you likely get something like this:

Patching mod_fastcgi to support chroot setting under Ubuntu 12.04

When running PHP through PHP-FPM you have option to chroot FastCGI PHP server. Unfortunately, Apache is not aware of chrooting and therefore pass wrong script path to the server.

This patch supposed to help with it -

Below are steps I've run in order to apply this patch to my server. First, you want to remove installed mod_fastcgi package:

[SOLVED] GIMP 2.8 Freezes on select tool

Have no clue what happened to my GIMP installation. Every time I am using select tool (any - square, round, magic wand, etc) - it just freezes whole Gnome Shell. But I still able to get into VT with Ctrl+Alt+1 and kill process from there.

After googling everything - nothing came out and I tried simply delete ~/.gimp-2.8 folder. This did it! Probably some settings somewhere made GIMP get into forever loop or something..

Setup automatic backups and email alerts with Duplicity and Logwatch With Ubuntu 12.04

I am using Duplicity to automate off-site backups. What I wasn't doing before - checking integrity of remote backup. Due nature of backing up to remote location, it quite possible to have issues like half uploaded files, corrupted files, missing files, etc. I wanted to have something in place to check backup right after backup procedure is finished and email me if there are any differences.

Happy time with recent GRUB2 update with Ubuntu 12.04 LTS

My short story of dealing with failed grub2 install which rendered my server unbootable.

It was all good till recent update of grub2. Apparently it no longer fits into MBR and I missed related warnings. Or may be I had grub-legacy. I do not know honestly, but in result I had un-bootable remote server.

Using rescue mode (which is like Live-CD, but instead of GUI gives you SSH access so you could restore your server) I was able to get into server and try to update grub. Here is what I got for grub-install /dev/sda:

Nice, SEO-friendly URLs in Catalyst application

I really enjoy power behind Clean URLs in Drupal CMS. It allows me instead of "" path to have nice URL like "". And most important I can change this nice url to whatever I want or need.

I found it is quite easy to implement something similar for Catalyst application.