Monday, December 3, 2007

centericq: Text messaging for the Gmail+Terminal freaks!

centericq: Text messaging for the Gmail+Terminal freaks!

How nice it is to just stay on the terminal with hands on the keyboard, staying away from that wierd mouse. I just configured centericq for that particular purpose. Its pretty simple.

Step 1. Install the centericq package :

$ sudo apt-get install centericq

Step 2. Configure it for the Google Talk:

$ centericq

Server :
Secured : yes
Login : ********
Password : ********
Priority : 4
Update user details
Set away message

Step 3. What are you waiting for now? Just chat!


Monday, November 5, 2007

Prism - Mozilla's new offering!

Prism - Mozilla's new offering!

If you have access to a computer and fortunately also have an Internet connection, then it is pretty sure that your first task will be to launch a Web Browser. You want every thing to be on the web browser to access it, be it email, chatting, watching video, playing games ( maybe 3D games in near future ) etcetra etcetra. Yes its true most of the times. Compaines like Google have done a pretty good job to bring Chating, Word processing, Videos, Spreadsheets etc., to bring just at your Web Browser.

So you know what, many of remaining applications you use NOT on the Web Browser, will soon be in `your` browser. Mozilla has just started to do that -- through Prism. What is Prism?

Prism is the best of both worlds -- stand alone applications and browser based applications. Wow! How is this possible?

"Prism is a simple XULRunner based browser that hosts web applications without the normal web browser interface. Prism is based on a concept called Site Specific Browsers (SSB). An SSB is an application with an embedded browser designed to work exclusively with a single web application. It doesn't have the menus, toolbars and accoutrements of a normal web browser", says

So what you gain from Prism is, a possibility to integrate your Web Appilcations better with the Desktop.

For more follow:

Sunday, September 30, 2007

Compiz - Debian ; Up and running!

This is just a plain simple way to have Compiz installed on your system ( i use Debian Etch ).

install compiz:

$ sudo apt-get install compiz

now edit the xorg.conf file: /etc/X11/xorg.conf, add the following lines at the bottom
Section "Extensions"
Option "Composite" "Enable"

create a .xinitrc in your home directoy i.e. ~/.xinitrc with following lines:
gnome-terminal &
exec compiz

Now, kill your current X server session by pressing Ctrl-Alt-BackSpace .

login onto a ( virtual ) terminal using your username and password, then just fire the following command:

$ startx

And here you go! All the nice effects of wobble etc. at your desk and a terminal window on your screen.

this is really a light way, without putting too much of memory on useless applications running along with GNOME/KDE.

Whatever you really need to use, just start from the terminal.


Tuesday, September 4, 2007

Ruby - The Programming Language

Here a few links that are good as a first look while learning Ruby.


:symbols in Ruby

writing daemons

more to come...

Finding duplicate files on your system?!

I ( and many others ) have a lot media files ( mp3, jpg, avi, etc. ) lying around in the system. I wondered that how shall I get the list of all the duplicate files lying in my computer. Writing a script in Ruby which identifies the duplicate files using the MD5 hash values of the files contents, was no difficult a task. Here is the script.


## This file finds all the duplicate files form a directory given
## at the command line.
## Released under the GPLv2
## Copyright (C) tuxdna(at)gmail(dot)com

require 'digest/md5'

## novice use of exceptions
throw nil if ARGV.length == 0
print "Usage: ", $0, " \n"
exit 1

directory = ARGV[0]
print "Name of directory given is :", directory, "\n"

## do not proceed if it is not a directory
exit 1 if File.file?(directory)

puts "Getting the list recursively, for all the files and sub-directories."
filelist = Dir[directory+"/**/*"]

puts "Now scanning the files: "
puts "Determining file size and Filtering the directories:"

sizehash = { |h,k| h[k] = [] }
filelist.each do |filename|
if File.file?(filename)

## prune those entries which do not have same size
sizehash.delete_if { |k,v| v.length<=1 }
duplicates_md5 = { |h,k| h[k] = [] }
sizehash.each do | size, files |
files.each do |filename|
md5sum = )
## Necessary to do this because md5sum is an object of class Digest::MD5
## and we need a string for a key!!
md5sum = md5sum.to_s

## prune those entries which do not have same md5 hash value
duplicates_md5.delete_if { |k, v| v.length <= 1 }
## print the files if we find duplicates now!
duplicates_md5.each do |h, files|
puts "Following files match: "
files.each { |f| puts f }
exit 0

Monday, August 20, 2007

Emacs: the GNU's editor

I have been using Vim editor for past ( almost ) four years, but now I have switched over to Emacs. I find it more intuitive ( just a personal opinion ). While I was learning Emacs I had few queries. So, I have prepared a small HOWTO which might help a new emacs user.

HowTo Colorize the syntax?

M-x font-lock-mode

Here M is the Meta key, which may be Alt or Esc (top-left corner of the keyboard). So the above is equivalent to "Alt+x font-lock-mode" or "Esc x font-lock-mode".

How do I add color themes to my Emacs editor?

Install the following package :


you will get a lot of color themes (for Emacs) installed onto your system. To select / apply a theme use M-x color-theme-select Theme-Name
I liked Hober and Euphoria.

I usually log onto a slow server (say, using SSH) and editing of files on the remote server has become a hated task, usually when I have to navigate a big text/program file up and down. Can Emacs help me?

Sure, Emacs can help you edit files on the remote system. Install the following package:
for emacs and go ahead.

While logging in onto a server for editing files, TRAMPS asks me a password each time I try to open a separate file. So, how do I create ( SSH ) login with no password required?

On remote system (server):
$ ssh-keygen -t rsa

On local system (localhost):
$ ssh-keygen -t rsa
$ cd .ssh
$ scp user@server :~/.ssh/id_rsa.user_at_localhost

On remote system ( server ):
$ cd ~/.ssh
$ cat id_rsa.user_at_localhost >> authorized_keys

Now you login from localhost to server.

How do I recover a file from the last session, which unfortunately crashed?

M-x recover-file

How do I indent a region?


How do I comment a region?


How do I AutoComplete a word which I have typed partially, but it is already present somewhere in the currrent file?


How do I delete all trailing whitespace from lines in the text ( or the selected region) ?

M-x delete-trailing-whitespace RET. (This command does not remove the form-feed characters.)

How do I use the Code Folding feature of Emacs?

To fold all the function bodies: M-1 C-x $ and magic happens!
As usual, it's white magic: C-x $ will bring your code back.

How do I Customize my EMACS using the .emacs configuration file?

This is a file I found somewhere on the Internet. Just copy paste the contents if you want to experiment.

(setq additional-paths '("/home/tuxdna" "/home/joe/misc/lisp"))
(setq load-path (append additional-paths load-path))

(setq font-lock-maximum-decoration t)
(setq visible-bell t)
(setq require-final-newline t)
(setq resize-minibuffer-frame t)
(setq column-number-mode t)
(setq-default transient-mark-mode t)
(setq next-line-add-newlines nil)
(setq blink-matching-paren nil)
(global-font-lock-mode 1 t)
(blink-cursor-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)

;;Customized syntax highlighting colors
(set-default-font "-misc-fixed-medium-r-normal-*-*-200-*-*-c-*-koi8-r")
(set-foreground-color "#dbdbdb")
(set-background-color "#000000")
(set-cursor-color "#ff0000")
(custom-set-variables '(load-home-init-file t t))

(if (> (display-color-cells) 20)
'(font-lock-builtin-face ((t (:foreground "deepskyblue"))))
'(font-lock-comment-face ((t (:foreground "gray60"))))
'(font-lock-doc-face ((t (:foreground "darkkhaki"))))
'(font-lock-keyword-face ((t (:foreground "magenta"))))
'(font-lock-function-name-face ((t (:foreground "green" :background "seagreen"))))
'(font-lock-string-face ((t (:foreground "gold"))))
'(font-lock-type-face ((t (:foreground "cyan" :background "slateblue"))))
'(font-lock-variable-name-face ((t (:foreground "yellow"))))
'(modeline ((t (:foreground "plum1" :background "navy"))))
'(region ((t (:background "sienna"))))
'(highlight ((t (:foreground "black" :background "darkseagreen2"))))
'(diff-added-face ((t (:foreground "green"))))
'(diff-changed-face ((t (:foreground "yellow"))))
'(diff-header-face ((t (:foreground "cyan"))))
'(diff-hunk-header-face ((t (:foreground "magenta"))))
'(diff-removed-face ((t (:foreground "red")))))


(setq suggest-key-bindings t)
(global-set-key [delete] 'delete-char)
(global-set-key [kp-delete] 'delete-char)
(global-set-key "\C-h" 'backward-delete-char)
(global-set-key "\C-x\ ?" 'help)
(global-set-key "\C-c\ l" 'goto-line)
(global-set-key "\C-x\ f" 'find-file-other-window)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
(global-set-key "\C-z" nil)


;; go right to an empty buffer
(setq inhibit-startup-message t)

;; translates ANSI colors into text-properties, for eshell
(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

;; cvs stuff
(setq vc-default-back-end 'CVS)
(autoload 'cvs-add "cvs-add" "CVS add" t)
(autoload 'cvs-commit "cvs-commit" "CVS commit" t)
(autoload 'cvs-diff "cvs-diff" "CVS diff" t)

;; recentf stuff
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 25)

;; mode stuff
(setq auto-mode-alist (cons '("\\.php$" . php-mode) auto-mode-alist))
(autoload 'ruby-mode "ruby-mode" nil t)
(setq auto-mode-alist (cons '("\\.rb$" . ruby-mode) auto-mode-alist))

;; autorevert stuff
(autoload 'auto-revert-mode "autorevert" nil t)
(autoload 'turn-on-auto-revert-mode "autorevert" nil nil)
(autoload 'global-auto-revert-mode "autorevert" nil t)
(global-auto-revert-mode 1)

(defalias 'yes-or-no-p 'y-or-n-p)
(setq auto-save-interval 50)
(setq list-matching-lines-default-context-lines 1) ;; for M-x occur

;; counting functions
(defalias 'lc 'count-lines-page)

(defun wc ()
"Count the words in the current buffer, show the result in the minibuffer"
(interactive) ; *** This is the line that you need to add
(goto-char (point-min))
(let ((count 0))
(while (forward-word 1)
(setq count(1+ count)))
(message "There are %d words in the buffer" count)))))

;; normally disabled by default
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)

;; Highlights the selected region
(transient-mark-mode t)

Tuesday, July 17, 2007

Virtual Machines for the modern programming languages.

The virtual machines are floating around for the popular languages of the present times. For instance look at the Parrot, YARVM, etc.

Parrot is the intperpretter for the Perl 6.
YARVM is probably going to be the virtual machine for Ruby2.

The topic of Virtual Machines is becoming hot day by day for the system and software engineers.

Friday, July 6, 2007


This is a test blog, the other way out.

First one.

This is just a test blog.