Archive for June, 2009

How to download using a Rapidshare Premium Account in Linux

For a lot of people, the lack of a proper downloader in linux to use with their premium rapidshare accounts seems to be quite a turn off. Well, there’s jDownloader, but I find that a bit too heavy. Unknown to them, they already have a good downloading tool, called wget.

Its basically a two step process being:

  1. Saving a cookie with your Rapidshare login details in it. To do that, just enter the following command:
    $ wget --save-cookies ~/cookies.txt --post-data "login=USERNAME&password=PASSWORD" -O - https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi > /dev/null

    Replace USERNAME & PASSWORD with your own Rapidshare details.
    What this script does is login to Rapidshare and saves the cookie to a file named cookies.txt in your home directory. Any normal HTML output is piped to the resident unix blackhole, /dev/null.

  2. Downloading your file using the cookie to supply your Rapidshare credentials. Now that we’ve saved your cookie information, you can go ahead and download to your heart’s content (or maybe daily limit). Here’s an example of how you’d do that. Remember that the cookie you created previously was stored in your home directory. For most linux shells, you can refer to it like this:- ~/cookies.txt

    To actually download, use the following command:-

    wget --load-cookies ~/cookies.txt your-rapidshare-url.com/file-link.html

Happy downloading. :)

VirtualBox 3.0 Released

VirtualBox

VirtualBox

VirtualBox 3.0 has been released!!! Highlights for me are:

  • Windows guests: ability to use Direct3D 8/9 applications / games (experimental)
  • Support for OpenGL 2.0 for Windows, Linux and Solaris guests
  • USB: Support for high-speed isochronous endpoints has been added. In addition, read-ahead buffering is performed for input endpoints (currently Linux hosts only). This should allow additional devices to work, notably webcams

Looks interesting. Read the full changelog. Go ahead and download.

How to search and replace in Vim

Just for reference, may help other people. Searching for text and replacing in vim is an invaluable skill, which helps sysadmins during the conf. file troubleshooting.

For example, assume you have this /etc/hosts file with a list of machines that are numbered sequentially. For some insane reason, some dude suggests a now naming scheme. Replacing 10 or 15 lines manually is a pain, not to mention error prone.

192.168.0.1	node01
192.168.0.2	node02
192.168.0.3	node03
192.168.0.4	node04
192.168.0.5	node05
192.168.0.6	node06

Now, your resident office genius decides that the names for these machines should be cluster-nodexx instead of nodexx. Great, now imagine having 200 machines in your hosts file. No way you’re going to manually edit that by hand. This is where vim’s search & replace function comes in handy.

First, open the file in vim:

# vim hosts

Now, to replace the the word node with cluster-node, press the colon “:” to enter command mode an type the following:-

:%s/node/cluster-node/gc

Lets break down the command.

  • %s : instructs vim to search
  • /node/: The words within the first two forward slashes are the characters vim will search for
  • /cluster-node/: The words between the second and third forward slashes are what vim will replace node with.
  • g: after the thrid forward slash, the ‘g’ stands for global. Without this, vim will only replace the first occurrence of the word node.
  • c: ‘C’ will make vim prompt you for confirmation before replacing the word. Very handy especially when editing source or configuration files.
  • Here’s an example of how this would look like:
    vim-search_n_replace

    Note the highlighted matches, and the prompt below asking for your confirmation.

This should help you do some mass replacing with ease.

How to speed up liferea load times

After using using Liferea for a while, it tends to slow down during startup. This is most probably caused by the sqlite database it uses becoming fragmented. Using the sqlite VACUUM command helps solve this.

To run this, do the following:

  1. Shutdown liferea.
  2. Run the following command:
    sqlite3 ~/.liferea_1.4/liferea.db "VACUUM;"
  3. Load up liferea and feel the speed difference

Source:
Liferea Developer blog

The Obama-natar

Yes, apparently being the president of one of the most powerful countries in the world requires leet fly swatting relfexes that may put Mr. Miyagi to shame. Check it out :)

The Obama-nator

How to upload files to a FTP server using curl

A simple tip for anyone, uploading files using the curl command line tool.

curl -T filename.ext -u username:password ftp://ftpserver.com

The command explained:

  • -T The switch that tells curl this is a transfer
  • -u Your username and password, seperated by a colon. ‘:’