How to Enhance Your Linux Desktop with Conky

I have been using Conky as my desktop monitoring widgets for quite some time now. Before this, I’ve been using few applications like screenlets and gdesklets, but there’s a lot of drawbacks on these applications. Among them were limited customizations, it’s difficult to develop your own widgets, unable to find widgets you’re looking for, and if you do find them, they are too buggy to be used in the first place.

Then, I’ve found Conky. I’ll never turn back.

This is the best system monitor I have ever experienced. It is highly customizable, all you have to do is modify the Conky config file. There’s a lot of widgets/variables to use, such as system monitoring tools (CPU, RAM, SWAP, Hard Drive, etc), batteries capacity, networking, and more. And best of all, it is very, very easy to create your own widgets. If you know any programming language such as Python, Perl, or even a simple Shell Scripts, then you’re off to create your own.

Continue reading

Extend Transmission Torrent with Scripts

Transmission is one of my favourite bittorrent client. However, it’s lack the feature of running command(s) before or after you have finished downloading. Luckily we can improvise this with the help of transmission-remote, a command based client for transmission, and along with some Linux bash scripting.

Below I have created a simple bash script. What it does is, converting all of the finished avi’s to wmv. The conversion is via ffmpeg. The script below is easily modified to suit your needs, such as:
i – Copying the finished torrent to another location.
ii – Doing any conversion to your media.
iii – Send you mail notifying the torrent have finished downloading.
iv – etc, etc.

So, let’s get started.
Continue reading

How To Share Media Between Xbox 360 and Linux

I’ve got a little project going on in the past few days. I have a reasonable amount of media; movies, mp3’s and family pictures in my Linux desktop, Ubuntu 8.10. Would it be nice if I could stream all the movies and music directly from the Linux machine to my Xbox 360? This is a very easy feat in Windows, where we could simply use the Windows Media Share option in Windows Media Player 11. But, what about Linux?

Xbox-Linux box media sharing could be achieved by using GeeXbox uShare. GeeXboX uShare is a free UPnP A/V & DLNA Media Server for Linux. Installation and configuration explained after the jump below:

Continue reading

Moonlight: Microsoft Silverlight in Linux


Need to view Microsoft Silverlight enabled sites, but you’re on Linux, and running Firefox as the web browser? Have no fear, Moonlight is here.

Moonlight is an open source implementation of Microsoft Silverlight for Unix or Linux platform.

The current release version is 1.0. All you have to do is, just go to their site, and install the plugin/add-on from your Firefox.


Automated scp on Linux


You would like to automate the export of SQL dump files from one Linux server to another using scp. These dump files are to be generated and exported once every two weeks. You also wish to archive these dump files on the source server.

So let’s say the servers and directories are as follows:


Hostname: perak
Username: nazham
Dump file directory: /home/nazham/data_export/current
Archive directory: /home/nazham/data_export/archive/yyyymmdd


Hostname: selangor
Username: romantika
Target directory: /home/romantika/data_import

Passwordless scp

First you need to set it up so that you don’t need to enter a password for scp. The overall picture is as follows:

  1. At the source server, generate a pair of public and private keys [1] using RSA.
  2. Store the private key in a specific place in the source server.
  3. Store the public key in a specific place in the destination server.
  4. And that’s it! Now you’ll no longer be prompted for a password when using scp.

One-off steps

# login to perak with username nazham
ssh-keygen -t rsa
# choose default location, no passphrase - just press enter at all prompts
scp ~/.ssh/ romantika@selangor:/home/romantika/.ssh/authorized_keys
# I'm assuming the file authorized_keys does not exist!
# otherwise, you need to append the contents of to it.
crontab -e
# add the following:
# 1 0 1,15 * * nazham /home/nazham/run_data_export >> /dev/null 2>&1
# which means, run at 12:01 am every 1st and 15th of the month
mkdir ~/data_export
mkdir ~/data_export/current
mkdir ~/data_export/archive

The run_data_export script

todaysDate=`date +%Y%m%d`
oldDate=`date -d '1 year ago' +%Y%m%d`
mysqldump -u username -ppassword -r ~/$exportDir/current/filename dbname tablenames
echo $todaysDate > ~/$exportDir/current/importdate.txt
scp ~/$exportDir/current/* romantika@selangor:/home/romantika/data_import
mkdir ~/$exportDir/archive/$todaysDate
rm ~/$exportDir/current/importdate.txt
mv ~/$exportDir/current/* ~/$exportDir/archive/$todaysDate
if [ -d ~/$exportDir/archive/$oldDate ]; then rm -r ~/$exportDir/archive/$oldDate; fi

The Linux date command

I’m very impressed by the Linux date command. This might be old news to some, but the fact that I’m able to say date -d '1 year ago' or date -d '30 days ago' completely blows the mind.


[1] From Pass on Passwords with scp: “If you’re not familiar with public key cryptography, here’s the 15-second explanation. In public key cryptography, you generate a pair of mathematically related keys, one public and one private. You then give your public key to anyone and everyone in the world, but you never ever give out your private key. The magic is in the mathematical makeup of the keys; anyone with your public key can use it to encrypt a message, but only you can decrypt it with your private key.”