Saturday, October 13, 2012

googlecl = blog in vim

This post was uploaded from my Ubuntu box by running the command:
$ google blogger --blog "Curiosity heals the cat" post --title "googlecl = blog in vim" --src googlecl.txt

where googlecl.txt contains the content you are reading. Talk about making it easier to post! :)

Now I can type out on vim snuggled in the dark, warm comfort of the terminal without resorting to browser plugins supporting vim.

A small note on the setup - googlecl works with gdata library. Using the latest versions of googlecl and gdata caused problems for me.

But googlecl worked like a charm when I used the following packages:

googlecl-0.9.13.tar.gz + gdata-2.0.14.tar.gz= vimvana!

Be sure to set/unset http_proxy and https_proxy environment variables before starting to use googlecl. I had moved to a different network without proxy and googlecl gave me a stack trace, instead of a meaningful error message to disable my proxy.

When you run blogger operations for the first time, googlecl will check if you have obtained an access token to perform this action. If you haven't, it will try to obtain one (by opening a browser window and asking you to sign in)

Once you are signed in googlecl will put the authentication token in /home/your_user/.local/share/googlecl with the name as access_tok_your.google.user.name

I find it useful to delete this file once I am done with my work so that my acccess is revoked once I am done with my work. You can also invalidate the access token by going to Google settings => Security => Connected application and sites  and removing the access token manually.

googlecl supports editing of google-docs but not of blog posts. So you have to do a:

$ google blogger --blog "Curiosity heals the cat" delete --title "googlecl = blog in vim"
$ google blogger --blog "Curiosity heals the cat" post --title "googlecl = blog in vim" --src googlecl.txt

May be a deal breaker for some people.

More info about googlecl at googlecl manual

Sunday, March 4, 2012

Using mdadm to learn RAID concepts

I've been using mdadm to learn about software RAID configurations on Linux and I find it to be a great resource to play around with and do some hands on work. How I wish we were taught using these tools in college, rather than just being bombarded by all possible combinations of RAID.

Having the ability to setup and tear down VMs at the snap of a finger makes me think how fortunate CS students are nowadays. We had it tough. At the risk of digression, I sound like one of the Yorkshiremen from the classic Monty Python sketch - The Four Yorkshiremen

Statistics have shown that 85% of the audience, after clicking the above link have spent at least 45 minutes visiting the various sketches of Monty Python, including, but not limited to - Woody and tinny words, Argument Clinic and others.

And.... we are back. :)

This tutorial gives a gentle introduction to RAID and then builds up on the concepts and walks the reader through the mdadm tool. As that HOWTO is already delivering, I will not go into the details of it. The aim of this post is to inform about the pre-requisite setup for building RAIDs.

I am using Virtualbox with a VM running Ubuntu 10.10. For mdadm I have installed the mdadm tool (installation steps mentioned in the tutorial page).

As you are going to play with different RAID configurations, you will need to add multiple disks. For VirtualBox, go to the main menu, right click on the VM, go to settings and then to storage. Out there add 2 more SATA disks each of 1 GB - I used this value because I am going to partition each disk into 2 partitions of 512 MB each. If there are no new disks added to your system, then these disks will show up as /dev/sdb and /dev/sdc on your Linux box.

Boot up your VM. Become root. Execute the following command:
# fdisk -l
You will see a partition table for /dev/sda - containing - /dev/sda1, /dev/sda2, etc. - this is the first disk in which your OS is installed. We are not going to touch this disk.

We are going to work with /dev/sdb and /dev/sdc - the 2 new disks that have been added. If you already had added other disks the device names may be different in your case - but one thing is for sure - for the new disks, the partition table will not exist. Hence for the new ones fdisk output will be something like this: