Skip navigation

Category Archives: Tools

I was really fascinated by the stuff I have read about Truecrypt. I wanted to try that but I had two reasons to not do that. First, I had nothing really to hide; Second, I thought my poor hp mini won’t be able to handle encrypting a partition, if not the whole disk. And also I was lazy. My close friends, bro and sis know my password anyway. Sis won’t find anything I don’t want her to and I have no problem others finding those. So the only reason I’d try encrypting is curiosity.

One day I was struck by a fireball of curiosity. And I was looking for ways to make portable, encrypted disk I can even put in Dropbox [referral link]. I found few good howtos with lot of details but what I’m going to put together will be an easier howto for a better virtual disk that is encrypted on-the-fly.

I am using Ubuntu 10.04 Lucid Lynx so there maybe a leetle Ubuntu specific things that I’m not sure of. The process has commands that can destroy your data if not used with care. I have tried this and it works perfect for me. If you manage to screw things up in the process that should be purely because you are stupid or careless or even both. And that was my disclaimer.

Alright let’s go make it.

We need dmsetup and cryptsetup installed for this.
$sudo aptitude install dmsetup cryptsetup

Once the installation process is finished we can start making our encrypted vitual disk.

1)
First we create a file with random data in it. You can chose a size that matches your needs. In this example I’m making a 20MB virtual disk so I will create a 20MB file in this step.

$ dd if=/dev/urandom of=~/sekret bs=1M count=20

Here, the dd command creates 20 1MB blocks and fill it with random data. ~/sekret means that we create the filee named sekret in your home directory. You can chose a file name you like and also a path you like.

2)
Next we need to create a block device from the file. For that find a free loop device with
$ sudo losetup -f

And use that loop device and create the block device. Let’s assume /dev/loop0 is free.
$ sudo losetup /dev/loop0 ~/sekret

3)
Now we need to luks format the device. FYI: LUKS stands for Linux Unified Key System.
$ sudo cryptsetup luksFormat -c aes-cbc-essiv:sha256 /dev/loop0

This will warn you that the data in /dev/loop0 are gonna be overwritten. Hope you are confident enough to say yes. Then you are required to enter a pass-phrase for this encrypted this. Chose a powerful pass-phrase here. And then confirm the pass-phrase. The process will report success if we are lucky.

4)

Map the crypto partition using

$ sudo cryptsetup luksOpen /dev/loop0 mycrypt

To be sure about the success run
$ sudo dmsetup ls

This will output something like mycrypt (252, 0).

5)
Now we create file system on the device we created.
$ sudo mkfs.ext3 /dev/mapper/mycrypt

This will create EXT3 file system on the device. You can format it with your choice of file system. At the successful finishing of formatting, we have our own encrypted disk ready to use.

6)
We can mount it with..
$ sudo mount /dev/mapper/mycrypt /media/sekret

7)
Once you are done adding juicy stuff on your device you should unmount it AND REMOVE THE DEVICE FILE.
$ sudo umount /mnt/sekret
$ sudo cryptsetup luksClose mycrypt
$ sudo losetup -d /dev/loop0

Once you have created an encrypted disk, to use next time you only have to follow the steps 2), 4) and 6). Once you are done using the device, unmount with step 7).

I have put an encrypted virtual disk in my Dropbox and it works pretty well. Maybe you’d like to try that too. To use it in Dropbox, copy the encrypted virtual disk file (~/sekret in our case) in to your Dropbox directory.

I have put together a bash script to automate the process and I named it crysp :). You have to run the script as root so use sudo when running it. I might be an evil bastard trying to destroy your data so take a look at the script before you run. With the script you can easily mount and unmount the encrypted devices similar to the usage of mount/umount commands. I have added a dirty hack to allow read/write access to the device from Nautilus. To use this, change chanux to your login name in line 08 in the script.

Find the source in it’s Google Code repository. There’s a version that prevents the existence of thumbnails related to the encrypted disk. check crysp-no-thumb branch for that.

Update: 27-01-2013 Updated the script and put it on a github gist.

It’s 2300 right now. I should finish this soon and go to sleep.

I wanted share something I use with you guys. It’s actually two Firefox features (probably on other browsers too) combined with some nifty web tools. So the two features are keyword bookmarking and %s variable. Check the following image.

Bookmark - Properties

You see the properties for a firefox bookmark. There you see %s pointed with number 1 and the keyword whois pointed with number 2. With these set, if you type ‘whois google.com’ in to your firefox location bar (awesomebar?) the keyword whois will refer to http://who.is/whois-com/ip-address/%s and the variable %s will be replaced with google.com. So you directly go to the whois page for google.com. Neat huh?

So I have quite a set of bookmarks setup this way and I’m gonna share them with you.
Bookmarks (right click > save link as..)
save the link to your machine and import the file in to your bookmarks. I’ll list the keywords I use and the purpose below.

gd linux – Performs Google search for keyword ‘linux’ for past 24 hours.
gw linux – Performs Google search for keyword ‘linux’ for past week.
time sri lanka – Googles for ‘time sri lanka’ so I can check time :D // try time new york :P
isdown sinhalenfoss.org – Checks whether sinhalenfoss.org is down using downforeveryoneorjustme.com

hostr friendssite.com – Find where friendssite.com is hosted using whoishostingthis.com.
whois kottu.org – Looks up for kottu.org whois record using who.is
myip – shows your IP as visible to the internet using whatismyip.com
roomatic #tweetupsl – Realtime twitter updates of #tweetupsl hastag with roomatic.com
pdf google.com – Gets a pdf of google home page using pdfmyurl.com
bimg hot chicks – Perorms Bing image search for ‘hot chicks’. // Added this when I heard bing image search is good
unu longurl.com – get a u.nu short url for your long urls

You can edit the keywords as you wish. Hope it’ll be usefull. Yawn!

PS: Oh BTW, got any cool tools to add?

PPS: Some lifehacker links.

I was using gnome-do as my application launcher through out last year with my ubuntu 9.04 installation. I installed it right after installing 10.04 recently too. But I kinda needed a change. I realized I wasn’t using the launcher THAT MUCH so it better be lightweight. So I found dmenu. A nifty tool coming with ‘dwm’ window manager. I also found yeganesh, a wrapper around dmenu which lists most used app first. Yeganesh is written in haskell. Not that I don’t like haskell but let’s go with python yeganesh clone called pydmenu since ubuntu has python installed by default.

First install dmenu which is in dwm-tools on Ubuntu repositories.

$sudo aptitude install dwm-tools

Then download pydmenu, extract it and copy it in to /usr/local/bin


$ wget http://www.codercpf.be/stuff/pydmenu.tar.bz2
$ tar xjfv pydmenu.tar.bz2
$ sudo cp pydmenu.py /usr/local/bin/

create a file named dmenu-bind.sh inside /usr/bin/local and put following code in it.


#!/bin/bash
exe=`pydmenu.py` && eval "exec $exe"'

Or just run following command and it’ll automatically do it for you.

$ echo -e '#!/bin/bash\nexe=`pydmenu.py` && eval "exec $exe"' | sudo tee /usr/local/bin/new.sh

You should change persmission of the file too


$ sudo chmod 755 /usr/local/bin/dmenu-bind.sh

OK enough playing in goofy command line. Let’s go on the surface and set up a shortcut key combination for our new launcher.

Go to System > Preferences > keyboard Shortcuts and press Add button to add a new shortcut. A dialog box called Custom Shortcut will show up. type in dmenu as the name and dmenu-bind.sh as the command and press Apply. Now you’ll see your new shortcut entry under Custom Shortcuts. We need to set the key combination now. For that click on Disabled (in ‘shortcut’ column) in the new entry. It’ll change to New Shortcut… Now press the key combination you prefer. (ex: press ctrl + space) Make sure the combination will not clash with others. I chose Super key (Some people call it windows key.)  and Space (Super Key + Space) which is the default for Gnome-Do. Close the keyboard shortcut window.

Now you can press the key combination you chose and see how it goes typing in few characters of your fave app’s name. Use arrow keys to move between suggested applications and Enter to run. You can dismiss dmenu with Esc.

PS: You can change the looks and orientation of dmenu editing dmenu command in pydmenu.py file (/usr/local/bin/pydmenu.py) with help of man dmenu.

And it obviosly is not sexy :D

dmenu in action. Click to enlarge.

I like Command Line Interface. Maybe I’ve been saying this earlier on my twitter if not on this blog. Since I started with GNU/Linux I was so fascinated with the CLI. The first reason was it’s something not everyone preferred. The next it’s the preferred way of all the hackers I read about in text files.

With time I learned why people called it’s easy and powerful. I was familiar with it to the point that I felt home in a text terminal with green text on black background. Then came the time I was looking for CLI tools for most of my day to day stuff. Ever since I found Amarok not doing well for me I didn’t use a GUI music player. Right now I’m using MoC and never had second thoughts.

And I recently had this moment I found GUI to be very confusing. And when I was thinking about it later it was very confusing for me to understand too. GUI are made to be easy to use right?.

It was the last semester and we were doing Prolog. There was a practical session in labs to get us familiar with the visual Prolog (I’m not certain though) interface. But as always I had a good reason to not go there which I can’t remember now. But there’s a limit even a student can push things off. And so came the day I do Prolog.

As you can imagine it was the last possible moment start with Prolog and I was in a hurry. I checked out the the IDE on a friends machine and I thought it’s the end.

What Visual Prolog presented me (thx @varunarl)

What I saw. cc public.resurce.org

If I found the software for GNU/Linux I would use it, somehow. But luckily I didn’t and found swi-prolog instead. I just wanted to write some code and see how it works. swi-prolog got me going in no time. I wanted to learn how to use consult and it was pretty much all about it. I learned how to do it in visual Prolog in order to help a friend. But it was still way too complicated.

Swi-prolog basic usage

I know that the fact I’m trying to convey is not really rational. But the point is, in the GUI environments all controls are visible and for a beginner that can be too much. But in the CLI I only chose what I want. I learned both swi-prolog and visual Prolog with guides found on internet but I’m sure I took more time to filter out the necessary details in visual Prolog guide.

I didn’t do any serious programming in Prolog so I can’t say how each tool would serve you in such a scenario. But in my situation the CLI tool saved me a lot of frustration and time which helped me achieve required knowledge level for the exam. And on a not so related side note, *surprise surprise* I have passed that module :D.

So Buzz came out with little buzz. I said little buzz because it didn’t buzz as much as wave did. I checked Buzz but it didn’t have anything special for me. So I disabled Buzz.

Google Buzz Logo

There was so much bad buzz about Buzz but I was not exposed to much when I first tried Buzz. I disabled solely because I didn’t see it making life better. Twitter is enough for me after all. Well I’m still me who deleted my Facebook account sometime back :).

Anyway, after the load of bad buzz Buzz received, Google people changed things for good. Apparently Google has good plans for Buzz and doesn’t want Buzz to die so soon. Or it’s the rebirth of good trend, ‘Listening to the user’.

So, with hope Google might find this (just kidding ;) ) I’d like to lay down some things I like to see in Buzz. I think it’s safe to say that these are the things that might take me back in Buzz.

Flawless Twitter integration.
Twitter is the most popular micro blogging platform to date. Everyone wants to build their own Twitter. Facebook and Google doesn’t seem to be any different. Buzz is Googles effort to enter Twitters space. I’d consider using Buzz if it allows good Twitter integration. Integration in the sense ‘me not having to leave Buzz to do my Twitter activities’.

When Google created Wave, one of the goals was to eliminate the data duplication happen in email forwarding. Likewise, if Buzz does Twitter integration without filling up the web with redundant data that will be great.

Comply with Twitter API
World needs a standard protocol for microblogging. This reminds me the days I was dreaming for an IM standard which allows adding buddies across networks. Jabber is doing lots of good for IM as a standard but my dreams are still dreams.

Opens source platform Laconica is doing for microblogging what Jabber did for IM . But still it’s far from dream come true.

Recently WordPress and Tumblr, famous blog clients implemented Twitter API. They are blogs but can you connect the dots? Twiiter is the de facto standard and there are so many Twitter clients out there. Why not allow things be more integrated in this small world? :) . It’d be nice if Buzz took another step forward.

Selective Buzzing is really needed.
I don’t know if it’s there but I didn’t find it in the short journey I had around Buzz. By selective Buzzing, I mean being able to Buzz to my friends, family colleagues etc. separately. I’m not sure that Twitter Lists implement this functionality and the similar feature Facebook had didn’t offer this functionality while I was around. So I believe one of the key features Buzz should have in order lead in the list is to allow communication channels insulated from each other.

Google have to be very serious about users privacy since they are playing Buzz inside Gmail, where most people need most privacy, after real life. Google messed up on this factor in Buzz release but they are really in to fixing it.

Finally, Buzz should be making managing information overload easy. Not adding on to the load. Because what they add might be the ‘last straw’.