@shijitht

July 31, 2010

Facebook story to movie

Filed under: Others — Tags: — shijitht @ 10:57 am

The Facebook story

The Accidental Billionaires:

The Founding of Facebook: A Tale of Sex, Money, Genius and Betrayal

is about to release as a film this September.

The film entitled “The Social Network”.

Advertisements

Fork BOMB

Filed under: C — Tags: — shijitht @ 10:40 am

This bomb can take down system in seconds, causing unintended denial of service attack in our labs(mainly system lab). 🙂
We can avoid this by programming carefully and using sleep().
The fire powder is
while(1) {
fork();
}

su using ssh

Filed under: Commands — Tags: , , — shijitht @ 10:19 am

Use ssh-keygen to create privet and public keys for the user say guest.
Now change to root and add a new file in root home directory.
/root/.ssh/authorized_keys
Put public key of guest into it.
Now we can login as root from guest without typing root password.
$ ssh -l root localhost
Make sure ssh service is on.
Pretty handy if you need permission from administrator for each root access.

July 29, 2010

Open System Sounds : Installing and Configuring

Filed under: Tools — Tags: , — shijitht @ 10:01 pm

* install oss from the file obtained from its site

* osstest will test available sound devises in the system.

* /use/lib/oss/ -> a useful folder containing configuration mixer.oss etc.

* oss will add the detected devices in /dev/oss

* when we have configured the device, passed osstest and still having the problem we can configure the softwares(vlc etc).

* we need to select oss instead of alsa or whatever for the audio functioning of the software and this will demand an audio device path.As stated above the device will be in /dev/oss most likely by the name pcm0.

* ossxmix will allow us to adjust volume properties graphically

* ossdetect -v will show the detected devices

* soundon and soundoff could be used to load and unload oss.

* /etc/init.d/oss {start | stop | restart} could be used to manage oss service

* remove /usr/lib/oss/starting if insisted

* vmix is virtual mixing. This will allow us to adjust the volume of each application separate. Vlc would be added to vmix when the above conf done.

Unmount a busy device

Filed under: Commands — Tags: — shijitht @ 9:50 pm

problem : #umount device will show an error message device is busy
#fuser -m device will show the processes currently accessing the device.Kill those device (kill -9 if needed) to free the device and umount it.
Try #umount -l device for lazy unmount.

Create an offline command line dictionary using dict

Filed under: Perl — shijitht @ 9:35 pm

Most of the dictionary in our OS have online database and most of us don’t have a reliable internet connection. And the online database could be down when we need something urgent. A solution to it is to create an offline database from the online one you line. We need two things to start the process,

1) A file containing almost every English word (get online).
2) Application named dict which could be accessed from terminal as ” dict -d wn apple “.
It will show the meaning of apple from WordNet(wn) .So -d option is to select WordNet database (choose whatever meets your demand).

Now we are ready.
Connect to the net and run the following script


open(fr,"words");
open(fw,">>meanings");
@words = <fr> ;
$len = @words;
for($i=0;$i<$len;$i++) {
    $word = @words[$i];
    chop($word);
    system("dict -d wn $word > file 2>&1");
    open(fp,"file");
    my @file = <fp>;
    my @first = split(/ /,@file[0]);
    @first = split(//,@first[0]);
    if(@first[0] eq 'N') {
        print fw (">>".@words[$i]." - Meaning not present\n");
    } elsif(@first[0] eq 'C'){
        $i--;
    } else{
        $j = 4;
        print fw (">".@words[$i]."\n");
        while(@file[$j++]) {
            print fw (@file[$j]);
        }
    }
    undef @file;
    undef @first;
    close(fp);
}
close(fr);
close(fw);

This will create a file named meanings. It carries the meaning of all words in the file words.
So file meanings is our offline database. Copy the file meanings to a directory .dictionary in home.
The next script is to get the meaning of a word from the database we just created.


#! /usr/bin/perl
$file = "$ENV{'HOME'}/.dictionary/meanings";
$tmp =  "$ENV{'HOME'}/.dictionary/tmp";
open(fr,"$file");
@meaning = <fr>;
$word = lc($ARGV[0]);
$a = system("grep -n -w '>$word' $file > $tmp");
if($a == 0) {
	open(fw,"$tmp");
	$line = <fw>;
	@line = split(":",$line);
	$line_no = @line[0];
	while(@test[0] ne ">") {
		print @meaning[$line_no++];
		@test = @meaning[$line_no];
		@test = substr(@test[0],0,1);
	}
} else {
	print "Not present\n";
}
close(fr);
close(fw);

Make the script executable and run it by giving word as argument. Copy the above script to bin and make it command.
I give it the name d and use as “d apple” to show its meaning.
You can automate the above process using Makefile.

Blog at WordPress.com.