Monday, April 6, 2009

Unix command to find size of the folder in human readable format

du -sh

For further options visit : http://www.linfo.org/du.html

Monday, March 9, 2009

Looping Through Numbers with Blocks and Iterators

5.times do puts "Test" end
1.upto(5) { ...code to loop here... }
10.downto(5) { ...code to loop here... }
0.step(50, 5) { ...code to loop here... }
The first example counts from 1 “up to” 5. The second example counts from 10 “down
to” 5. The last example counts up from 0 to 50 in steps of 5, because you’re using the step
method on the number 0.

Sunday, February 22, 2009

Unix/Linux find command tutorial

The Best tutorial and reference for Unix/Linux find command. Please follow the link :
http://content.hccfl.edu/pollock/Unix/FindCmd.htm

Friday, February 6, 2009

Read form data using Perl

#!/usr/bin/perluse strict;
my $formdata;

read(STDIN,$formdata,$ENV{CONTENT_LENGTH});
print "Content-type: text/html\n\n";

#Add html codes..
for( split(/&/,$formdata) )
{
$_ =~ tr/+/ /;
my ($n,$v) = split(/=/,$_,2);
$n =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$v =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
print "$n=$v\n";}
print 'add closing html codes';