Wednesday, July 18, 2007

ParisDailyPhoto: Free Wi-Fi in Paris

ParisDailyPhoto: Free Wi-Fi in Paris

There are lots of hot spot to choose from if you are a FON member. Eric, I was thinking you would have kept the location as a secret and a question like the pilers of Madeleine for the viewers ;)

Thursday, May 18, 2006

load cpu & memory shell script c program for quick and dirty benchmark

This script is a simple empty while loop which will load or increase the usage of your cpu.
a good way to test your cpu check for different monitoring tool

while :
> do :
> done

/home/sanmisra>more memory.c
main ()
{
while ( 1 ) {
malloc (10240) ;
}
}

Thursday, May 04, 2006

add new administrator and management post for smartdashboard firewall-1

1.Add the user in the system password file for *nix it will be in /etc/passwd and /etc/shadow
2. Add his host(PC) to /etc/hosts
3. Use cpconfig ( /opt/CPshrd-53/bin/) in case of Solaris

Rest is menu driven

Thursday, November 03, 2005

part -2

create indivitual pages for each image dirty way with php
[code]
//$image_files=[] ;
$type = "jpg";
$abspath_folder = "/home/santm/public_html/PamelasCreation/images" ;
if ( is_dir ( $abspath_folder ) ) {
if ( $handle = opendir( $abspath_folder ) ) {
while (false !== ( $file = readdir($handle ) ) ) {
if ( $file != '.' && $file != '..' && $file != 'CVS' && $file != 'index.html' ) {
//santm echo "FILE is $file \n" ;
$the_array[] = $file;
}
}
}
}
closedir( $handle );
// end of reading the directory
// santm print_r ( $the_array );
// making sure the array only has our jpg image starting with a number
foreach ( $the_array as $img ) {
if ( !is_dir( $abspath_folder .'/'. $img ) ) {
if ( eregi( $type, $img ) && eregi ( "^[0-9]", $img)) {
$the_image[] = $img;
}
}
}
// the main part
if ( !$the_image ) {
echo "no image \n";
}
else {
$i = count ( $the_image);
echo "count $i\n";
// sort the array
rsort ($the_image) ;
//print_r ($the_image ) ;
for ($k = 0 ; $k < $i ; $k++) {
$bb = $k+1 ;
echo "santm $the_image[$k] \n" ;
$full_name = explode (".",$the_image[$k]);
$short_name = $full_name[0];
$foo_img = images .'/'. $short_name;
if ( $k != 0 ) {
$pre_name = explode (".",$the_image[$k - 1]);
$pre_short_name = $pre_name[0];
}
if ($bb != $i ){
$next_name = explode (".",$the_image[$k + 1]);
$next_short_name = $next_name[0];
}
echo " short $short_name \n";
//
// doing dirty way with system call for placing the header
//
$head_out = shell_exec ('cat /home/santm/head.pam.inc');
$write_handle = fopen ("/home/santm/public_html/PamelasCreation/$short_name.html","w+");
fwrite ($write_handle,$head_out);

fwrite ($write_handle," $bb of $i\n");
fwrite ($write_handle,"
\"big_photo\">\n");
fwrite ($write_handle,"
\n");
if ( $pre_short_name ) {
fwrite ($write_handle,"<
img src=\"images/previous.gif\" alt=\"next\" border=\"0\">
\n");
}

if ((!$pre_short_name) || (!$next_short_name)) {

fwrite ($write_handle,"/%\">\"home\"\n");
}
else {
fwrite ($write_handle,"\"images/home.gif\" alt=\"home\" border=\"0\">\n");
}

if ( $next_short_name ) {
fwrite ($write_handle,"
\"next\"
\n");
}
fwrite ($write_handle,"\n");
fwrite ($write_handle," \n");
fclose ($write_handle) ;
}
}


?>
[/code]

photo album : imagemagick (part -1)

Quick and dirty way of creating photo album

creating images with black border as it looks good for all

[code]
#!/bin/csh
set files = `echo [0-9]*.jpg`
echo $files
foreach file ( $files )
set w = `identify -format "%w" $file`
set h = `identify -format "%h" $file`
if ($w > $h) then
convert $file -thumbnail 500X -bordercolor black -border 1 /tmp/foo100/$file
else
convert $file -thumbnail X500 -bordercolor black -border 1 /tmp/foo100/$file
endif
end
[/code]

Tuesday, October 11, 2005

Migrating rrd database between different architecture

This script you run on the source host from the same directory where all those rrd files are there. I found this very helpful while migrating between Linux and Solaris.



#/bin/csh

set all_files=`echo *.rrd`
echo $all_files
foreach file ( $all_files )
set base = `basename $file .rrd`
/bin/rrdtool dump $file > /tmp/new1/$base.xml
end


The do a `tar` with `gzip` as that will save lots of space and time while transferring data between machines.


And on the destination machine you uncompress and untar the file to an empty directory.


#/bin/csh

set all_files=`echo *.xml`
echo $all_files
foreach file ($all_files)
set base = `basename $file .xml`
/opt/local/bin/rrdtool restore $file /opt/local/htdocs/cacti/rra/$base.rrd
end



Hope this helps.

Thursday, September 29, 2005

Gallery2

Well I am having lots of troubgle with a simple gallery2 installation with 15 pictures for my wife's hobby pictures. While I am running a 1600 picture gallery on the same server with out any problem touch wood. The back on the main one not there.

And i am having wonderful tech support from dot5 hosting to say the least. The guy does not even know what is Unix he replies it is FreeBSD.

A quick a dirty way to get around. Let's assme the site name is www.mysite.com Here the usernme for your webserver is not same as your account. So when you create a file ftp you see the owner/group as "joe/joe" and when web server creates it it is "web/web".

Connect via ftp create a gallery2 directory ; chmod 777 the same on the Top most Document root.
put this file in the same dirctory "gallery-2.0-full.tar.gz" makse sure binary more
also FTP this php file foobar.php with these lines in it
system ("tar -zxvf gallery-2.0-full.tar.gz") ;
?>
Now connect to this foobar.php via a web browser.

Follow the instruction from gallery2 installation when you point your browser to this location

http://www.mysite.com/gallery2/

Need to create the g2data directory and chmod 777 via ftp again .

to finish the same Gallery will ask you chmod 755 gallery2 directory.

Wednesday, August 10, 2005

banner with imagemgick convert

To create a banner with mirror effect!!

convert -size 600x130 xc:transparent -font forte -pointsize 72 -fill "#cccccc" -annotate 0x180+12+80 "Pamela's Gallery" -gaussian 0x2 -stroke black -strokewidth 1 -fill "#ff3600" -stroke black -strokewidth 1 -annotate 0x0+12+55 "Pamela's Gallery" -draw "line 0,68 570,68" banner.png

ssh and scp

Via tunnel

scp -P 2222 font_slewed.gif santm@localhost:/tmp/banner.gif
ssh -p 2222 santm@localhost

nomally :