<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-18632947</id><updated>2012-02-03T18:10:18.131+05:30</updated><category term='C++'/><category term='Python'/><category term='Shell'/><category term='Vim'/><category term='sysadmin'/><category term='Hacks'/><category term='howto'/><category term='programming'/><category term='Links'/><category term='article'/><category term='Kernel'/><category term='Perl'/><category term='misc'/><category term='notes'/><title type='text'>Hacker's Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>46</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-18632947.post-7024751931438645155</id><published>2011-03-10T13:13:00.001+05:30</published><updated>2011-03-10T13:15:07.043+05:30</updated><title type='text'>End of Blog</title><content type='html'>&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-7024751931438645155?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/7024751931438645155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=7024751931438645155&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/7024751931438645155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/7024751931438645155'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2011/03/end-of-blog.html' title='End of Blog'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-6383741887748079863</id><published>2011-03-10T13:07:00.003+05:30</published><updated>2011-03-10T13:13:17.993+05:30</updated><title type='text'>Blog and site Migration</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;I am migrating all my contents to &lt;a href="http://guptav.com/"&gt;guptav.com&lt;/a&gt;&lt;br /&gt;Hopefully, the migration will be completed by 1st April 2011.&lt;br /&gt;The &lt;a href="http://guptav.com/"&gt;guptav.com&lt;/a&gt; has more content, rich content, and structured content.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Vaibhav.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-6383741887748079863?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/6383741887748079863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=6383741887748079863&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/6383741887748079863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/6383741887748079863'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2011/03/blog-and-site-migration.html' title='Blog and site Migration'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-5465707828204221638</id><published>2008-11-04T19:25:00.002+05:30</published><updated>2008-11-04T19:29:12.929+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='notes'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='sysadmin'/><title type='text'>How to : QEMU Networking</title><content type='html'>Well,&lt;br /&gt;        I have posted the original article &lt;a href="http://sbjoshi.blogspot.com/2008/11/how-to-qemu-networking_04.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Copying it here for readers.&lt;br /&gt;------------------------------------------------------&lt;br /&gt;Hi All,&lt;br /&gt;          It has been ages since I have written anything over here. One of the main reason is that I have started posting mathematical post at my &lt;a href="http://sbjoshi.wordpress.com/"&gt;wordpress&lt;/a&gt; blog.&lt;br /&gt;&lt;br /&gt;Anyways, &lt;a href="http://www.cse.iitk.ac.in/users/sameerag"&gt;Sameer&lt;/a&gt; and I were trying to get our hands dirty on &lt;a href="http://bellard.org/qemu/"&gt;Qemu&lt;/a&gt; networking. Although there is a fairly good description is given over &lt;a href="http://www.gnome.org/%7Emarkmc/qemu-networking.html"&gt;here&lt;/a&gt;, I am trying to fill in here a few missing bits.&lt;br /&gt;&lt;br /&gt;Okay, so here is the scenario we want to create.&lt;br /&gt;&lt;br /&gt;On one machine ( say host-A ) we want to create many guest machines ( guestA1, guestA2 ) etc. Similarly, there is another machine ( host-B ) having many guest machines ( guestB1, guestB2 ). We want to make guestA* communicate with guestB*.&lt;br /&gt;&lt;br /&gt;I am assuming that readers are aware of how to install a guest OS on a guest machine created by qemu.&lt;br /&gt;&lt;br /&gt;First we need to configure a ipv4-over-ipv4 tunnel for the host machines.&lt;br /&gt;&lt;br /&gt;--host-A configuration is as follows&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;ip : 172.27.16.1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;netmask : 255.255.255.0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;default gateway : 172.27.16.254&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;host-B configuration is &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;ip : 172.27.16.2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;netmask and gateway is the same as above.&lt;br /&gt;&lt;br /&gt;--In host-A ( as root ) do the following&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# ip tunnel add tunl1 mode ipip remote 172.27.16.2 dev eth0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- this command essentially create one endpoint of the tunnel in host-A. It says that the other end of the tunnel lies at ip 172.27.16.2. Also, the tunnel device will use eth0 as its physical device.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# ip link set tunl1 up&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- this command will bring up the tunnel interface&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA#ifconfig tunl1 10.0.1.1 pointopoint 172.27.16.2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- guestA network will be 10.0.1.0/24 network and tunnel device should be a part of it. This command gives the tunnel device an ip address and it says that other endpoint of the tunnel will be at 172.27.16.2&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# route&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--this will show you the current configuration of routing table. There might be an entry in the routing table&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;172.27.16.2    *   255.255.255.255  U 0 0 tunl1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--you need to delete this entry using following command :&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# route del -net 172.27.16.2 netmask 255.255.255.255 dev tunl1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--Also you need to tell routing table that guestB network ( 10.0.2.0/24) should be routed through the tunnel&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# route add -net 10.0.2.0 netmask 255.255.255.0 dev tunl1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--You need to repeat the same procedure for hostB with suitable ips ( use 10.0.1.* instead of  10.0.2.* and vice versa , replace 172.27.16.1 with 172.27.16.2 and vice versa )&lt;br /&gt;&lt;br /&gt;--By now, your tunnel should be working. To check, try&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# ping 10.0.2.1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostB# ping 10.0.1.1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--If it does not ping, it might be the case that your firewall is coming into the way. If you are expert enough, modify your firewall rules with iptables. If not, lets first save your firewall rules&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# iptables-save | cat &gt; iptablebackup.bak&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--flush the firewall rules now&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# iptables -F&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# iptables -t nat -F&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--Now, that firewall is completely disabled, the tunnel should work. (Of course, you need to disable your firewall at hostB as well! ) If it still does not work, then there might be some other problem or you might not have done things right.&lt;br /&gt;&lt;br /&gt;-- you can restore your firewall ( later ) with&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# cat iptablebackup.bak | iptables-restore&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--Okay, so the tunnel is working now!! Great news!! But what next??&lt;br /&gt;Next we create a tapping device - a virtual network interface - which will be visible to the guest OSes.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# tunctl -u username&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- provide a username here. This user will be able to use this tapping device while initializing qemu process. This command would have created a tapping device (tap0) in your system&lt;br /&gt;&lt;br /&gt;--assign an ip address of guestA network to tapping device&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# ip addr add 10.0.1.2 dev tap0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- bring the tapping device up&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# ip link set tap0 up&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- Also create a file /etc/qemu-ifup which can look like following :&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;#!/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;#echo "bringing up interface $1"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- Now start the first guestOS&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;username@hostA$ qemu -net nic,macaddr=macaddr1 -net tap,ifname=tap0  -net socket,mcast=230.0.0.1:9999 ....&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--second guestOS can be started with following&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;username@hostA$  qemu -net nic,macaddr=macaddr2 -net socket, mcast=230.0.0.1:9999 ...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- multicast socket is needed for mchines in guestA network to talk to each other&lt;br /&gt;&lt;br /&gt;--In the guestA1 do the following :&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@guestA1# ifconfig eth0 10.0.1.3 netmask 255.255.255.0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@guestA1# route add default gw 10.0.1.2 dev eth0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- Note that we have given the ip address of tapping device as the gateway fo guest OSes&lt;br /&gt;-- second, third etc guest machines can be configured with different ip addresses for their eth0&lt;br /&gt;&lt;br /&gt;-- Repeat this procedure on host-B as well with appropriate ip addresses.&lt;br /&gt;&lt;br /&gt;-- Now, you should be able to ping machines from guestA network to guestB network and vice versa.  However, this does not yet allow you to connect to host network. To do that, you need to enable ip forwardng&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# echo "1" &gt; /proc/sys/net/ipv4/ip_forward&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-- perform source NAT&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# iptables -t nat -I POSTROUTING 1 -o eth0 -j SNAT --to-source 172.27.16.1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--Now, from guestA network ( 10.0.1.0/24 ) you should be able to connect to ( 10.0.2.0/24 ) as well as host network ( 172.27.16.0/24 )&lt;br /&gt;&lt;br /&gt;-- To delete the tunnel&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# ip link set tunl1 down&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# ip tunnel del tunl1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--To delte the tapping device&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;root@hostA# tunctl -d tap0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;--Above mentioned setup is tested with host machines running fedora core 9 and guest machines running Arch Linux, Debian etc.&lt;br /&gt;&lt;br /&gt;If you have any queries post it as comments, I will be willing to answer if I can.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-5465707828204221638?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/5465707828204221638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=5465707828204221638&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/5465707828204221638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/5465707828204221638'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2008/11/how-to-qemu-networking.html' title='How to : QEMU Networking'/><author><name>Saurabh Joshi</name><uri>http://www.blogger.com/profile/08461791061004256871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos14.flickr.com/16098060_afc710c877.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-3215498586211258806</id><published>2008-06-25T17:33:00.001+05:30</published><updated>2008-06-25T17:33:54.845+05:30</updated><title type='text'>goosh.org - the unofficial google shell.</title><content type='html'>&lt;div id="output"&gt;    &lt;span class="less"&gt;&amp;lt;snip&amp;gt;&lt;br&gt;Goosh &lt;a href="http://goosh.org"&gt;goosh.org&lt;/a&gt; 0.5.0-beta #1 Mon, 23 Jun 08 12:32:53 UTC Google/Ajax&lt;/span&gt;&lt;br&gt;   &lt;br&gt; &lt;span class="info"&gt;Welcome to &lt;a href="http://goosh.org"&gt;goosh.org&lt;/a&gt; - the unofficial google shell.&lt;/span&gt;&lt;br&gt;  &lt;br&gt; This google-interface behaves similar to a unix-shell.&lt;br&gt; You type commands and the results are shown on this page.&lt;br&gt; &lt;br&gt; goosh is powered by &lt;a href="http://code.google.com/apis/ajax/" target="_blank"&gt;google&lt;/a&gt;. &lt;br&gt; &lt;br&gt; goosh is written by Stefan Grothkopp  &amp;lt;&lt;a href="mailto:grothkopp@gmail.com?subject=goosh.org" style="text-decoration: none; color: rgb(0, 0, 0);"&gt;grothkopp@gmail.com&lt;/a&gt;&amp;gt; &lt;br&gt; it is NOT an official google product!&lt;br&gt; &lt;br&gt;  Enter &lt;span class="info"&gt;help&lt;/span&gt; or &lt;span class="info"&gt;h&lt;/span&gt; for a list of commands. &lt;br&gt;  &lt;br&gt; &lt;div&gt;Loading local settings...&lt;br&gt;guest@goosh.org:/web&amp;gt; &lt;br&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;/snip&amp;gt;&lt;br&gt;Go to&amp;nbsp; &lt;a href="http://goosh.org/"&gt;http://goosh.org/&lt;/a&gt;&lt;br&gt;&lt;br&gt;Vaibhav.&lt;/div&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-3215498586211258806?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/3215498586211258806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=3215498586211258806&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/3215498586211258806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/3215498586211258806'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2008/06/gooshorg-unofficial-google-shell.html' title='goosh.org - the unofficial google shell.'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-4305395918813409879</id><published>2008-04-09T21:59:00.004+05:30</published><updated>2008-04-09T22:08:28.352+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Shell'/><title type='text'>Duplex printing script</title><content type='html'>Well,&lt;br /&gt;        I don't want to write the same thing again. So please refer to &lt;a href="http://sbjoshi.blogspot.com/2008/04/duplex-printing-script.html"&gt;this link&lt;/a&gt; to see what this article is about :-).&lt;br /&gt;It is basically about a script for duplex printing.&lt;br /&gt;&lt;br /&gt;--Saurabh&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-4305395918813409879?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://sbjoshi.blogspot.com/2008/04/duplex-printing-script.html' title='Duplex printing script'/><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/4305395918813409879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=4305395918813409879&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/4305395918813409879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/4305395918813409879'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2008/04/duplex-printing-script.html' title='Duplex printing script'/><author><name>Saurabh Joshi</name><uri>http://www.blogger.com/profile/08461791061004256871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos14.flickr.com/16098060_afc710c877.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-5723751762176964853</id><published>2008-02-09T22:09:00.000+05:30</published><updated>2008-02-09T22:10:43.476+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='article'/><category scheme='http://www.blogger.com/atom/ns#' term='Links'/><title type='text'>Programming Challenges</title><content type='html'>Today, I had a chat with ali on different online programming challenges as IOPC is going on write now and ali has taken part in it. I was remembering my glorious days when I won a jacket in bitwise.&lt;br /&gt;&lt;br /&gt;I am just going to enlist a few programming challenges. Obviously, the list is not exhaustive.&lt;br /&gt;&lt;br /&gt;1) &lt;a href="http://icpc.baylor.edu/icpc/"&gt;ACM ICPC&lt;/a&gt; : I believe it is one of the most prestigious programming challenges. It is an IBM sponsored annual event.&lt;br /&gt;&lt;br /&gt;2) &lt;a href="http://www.topcoder.com/"&gt;Top Coder&lt;/a&gt; : This too is one of the most prestigious programming challenges. General belief is that the emphasis is more on programming rather than algorithms.&lt;br /&gt;&lt;br /&gt;3) &lt;a href="http://www.ioccc.org/"&gt;IOCCC&lt;/a&gt; : Well, here one can find the weirdest C programs. Most of the time it will seem that the winning entry programs won't even compile. However, they do but it is difficult ( rather next to impossible ) to find out what they would do by merely reading the code. My favorite program is &lt;a href="http://sbjoshi.googlepages.com/phillipps.c"&gt;here&lt;/a&gt;. And yeah, it DOES compile and run.&lt;br /&gt;&lt;br /&gt;4) &lt;a href="http://www.bitwise.iitkgp.ernet.in/"&gt;Bitwise&lt;/a&gt; : One of the most prestigious INDIAN programming challenges. I used the word "Indian" because  it is held by &lt;a href="http://www.iitkgp.ernet.in/"&gt;Indian Institute of Technology, Kharagpur&lt;/a&gt;. The challenge however is open internationally. It is really a pity to see that since the inception of the event, only once an Indian team could grab the first prize. Ameya Karkare ( aka crack-kare ) and Navneet Lohiwal ( aka lollu ) from &lt;a href="http://www.iitb.ac.in/"&gt;Indian Institute of technology Bombay&lt;/a&gt; (my alma-matter :-) ) played with handle "AK47", undoubtedly shooting down all competing teams.&lt;br /&gt;&lt;br /&gt;5) &lt;a href="http://opc.cmi.ac.in/home/"&gt;OPC&lt;/a&gt; : Held annually by &lt;a href="http://www.cmi.ac.in/"&gt;Chennai Mathematical Institute&lt;/a&gt;. One of the toughest programming challenge I have ever faced.&lt;br /&gt;&lt;br /&gt;6) &lt;a href="http://felicity.iiit.ac.in/codecraft/"&gt;CodeCraft&lt;/a&gt; : Held annually by &lt;a href="http://www.iiit.ac.in/"&gt;International Institute of Information Technology, Hyderabad&lt;/a&gt; as part of their technology festival &lt;a href="http://felicity.iiit.ac.in/HTML/index.php"&gt;Felicity.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;7)&lt;a href="http://www2.techkriti.org/iopc/"&gt; IOPC&lt;/a&gt; : Hosted by &lt;a href="http://www.iitk.ac.in/"&gt;IIT Kanpur&lt;/a&gt; as part of its technology festival &lt;a href="http://www.techkriti.org/"&gt;techkriti.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-5723751762176964853?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://sbjoshi.blogspot.com/2008/02/programming-challenges.html' title='Programming Challenges'/><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/5723751762176964853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=5723751762176964853&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/5723751762176964853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/5723751762176964853'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2008/02/programming-challenges.html' title='Programming Challenges'/><author><name>Saurabh Joshi</name><uri>http://www.blogger.com/profile/08461791061004256871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos14.flickr.com/16098060_afc710c877.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-3144283712171514914</id><published>2008-01-11T14:43:00.001+05:30</published><updated>2008-01-11T17:08:11.816+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='article'/><title type='text'>Pune Innovation 2008 : Ideas in Practice</title><content type='html'>&lt;br&gt;Website: &lt;a href="http://www.innovations-pune.com/"&gt;http://www.innovations-pune.com/&lt;/a&gt;&lt;br&gt;Government : &lt;a href="http://www.dsir.gov.in"&gt;www.dsir.gov.in&lt;/a&gt; [Click TePP]&lt;br&gt;&lt;br&gt;1. Do the &lt;b&gt;innovation&lt;/b&gt;. It should be unique. It can be simple and obvious too. Think Beyond Imagination. &lt;br&gt;2. Find out a pricing model / &lt;b&gt;revenue model&lt;/b&gt;. Strategy/People.&lt;br&gt;3. Do the &lt;b&gt;market analysis&lt;/b&gt;. Compare with other products. Pros/Cons of your and others products.&lt;br&gt;4. What are the &lt;b&gt;pin points&lt;/b&gt; of your product? &lt;br&gt;5. Take care of &lt;b&gt;customers&lt;/b&gt; and their expectations. Think as if you are one of them. User experience. &lt;br&gt;6. Think not only for early bird advantage but in long terms. Think Fast. &lt;b&gt;Vision&lt;/b&gt;. &lt;br&gt;7. Do the &lt;b&gt; Risks&lt;/b&gt;/Liabilities. &lt;br&gt;8. How do you do marketing? Promote. &lt;b&gt;Om Shanti Om&lt;/b&gt;. &lt;br&gt;9. Always have the &lt;b&gt;exit plan&lt;/b&gt; ready. (Just like in sysadgiri where you should always have the backup plan ready.)&lt;br&gt;10. Blank. (You have to fill this by  &lt;b&gt;yourself&lt;/b&gt;.) &lt;br&gt;&amp;nbsp;&lt;br&gt;Vaibhav.&lt;br&gt;&lt;br&gt;ps: What your &lt;b&gt;Dreams&lt;/b&gt; really mean!&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-3144283712171514914?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/3144283712171514914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=3144283712171514914&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/3144283712171514914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/3144283712171514914'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2008/01/pune-innovation-2008-ideas-in-practice.html' title='Pune Innovation 2008 : Ideas in Practice'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-8995027262967824115</id><published>2008-01-11T00:14:00.001+05:30</published><updated>2008-01-11T17:06:27.781+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='notes'/><title type='text'>My AJAX Notes.</title><content type='html'>&lt;br&gt;&lt;b&gt;&lt;br&gt;My &lt;a href="http://vaibhav.gupta.googlepages.com/ajax.html"&gt;AJAX&lt;/a&gt; Notes.&lt;br&gt;&lt;br&gt;&lt;br&gt;Vaibhav.&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-8995027262967824115?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/8995027262967824115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=8995027262967824115&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/8995027262967824115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/8995027262967824115'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2008/01/my-ajax-notes.html' title='My AJAX Notes.'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-7195358242398607563</id><published>2007-09-25T12:44:00.001+05:30</published><updated>2008-01-11T17:06:05.450+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Links'/><title type='text'>Kool Linux Sites</title><content type='html'>&lt;a href="http://www.slax.org/"&gt;http://www.slax.org/&lt;/a&gt;&lt;p&gt;: Get the Software&lt;p&gt;&lt;a href="http://linuxhardware.org/"&gt;http://linuxhardware.org/&lt;/a&gt; : Find about Hardware&lt;p&gt;&lt;a href="http://www.linuxdevices.com/"&gt;http://www.linuxdevices.com/&lt;/a&gt; : The Device part&lt;p&gt;&lt;a href="http://tldp.org/LDP/sag/html/"&gt;http://tldp.org/LDP/sag/html/&lt;/a&gt; : Do sysad&lt;p&gt;&lt;a href="http://www.winehq.org/site/about"&gt;http://www.winehq.org/site/about&lt;/a&gt; : Want to plat games&lt;p&gt;&lt;a href="http://newdata.box.sk/bx/hacker/"&gt;http://newdata.box.sk/bx/hacker/&lt;/a&gt; : Do something.&lt;p&gt;Vaibhav.&lt;p&gt;&amp;quot;When you guys actually learn something, come to me&lt;br&gt;and say, &amp;#39;We learned something! We learned something!&amp;#39; and I&amp;#39;ll&lt;br&gt;show you some cool stuff.&amp;quot;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-7195358242398607563?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/7195358242398607563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=7195358242398607563&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/7195358242398607563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/7195358242398607563'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2007/09/kool-linux-sites.html' title='Kool Linux Sites'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-5757991374892395069</id><published>2007-09-19T12:02:00.001+05:30</published><updated>2008-01-11T17:07:02.683+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>Tiddlywiki</title><content type='html'>&lt;a href="http://www.tiddlywiki.com/"&gt;http://www.tiddlywiki.com/&lt;/a&gt;&lt;p&gt;To set up:&lt;p&gt;wget &lt;a href="http://www.tiddlywiki.com/empty.html"&gt;http://www.tiddlywiki.com/empty.html&lt;/a&gt;&lt;br&gt;firefox file:///`pwd`/empty.html&lt;p&gt;Done.&lt;br&gt;&amp;lt;snip&amp;gt;&lt;br&gt;The easiest way to learn about TiddlyWiki is to use it! Try clicking&lt;br&gt;on various links and see what happens - you cannot damage&lt;br&gt;tiddlywiki.com or your browser.&lt;br&gt;&amp;lt;/snip&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-5757991374892395069?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/5757991374892395069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=5757991374892395069&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/5757991374892395069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/5757991374892395069'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2007/09/tiddlywiki.html' title='Tiddlywiki'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-6536203938708412447</id><published>2007-07-26T18:39:00.001+05:30</published><updated>2007-07-26T18:46:10.954+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><title type='text'>VIM Tip</title><content type='html'>Convert any file to html file using vim from command prompt :&lt;br&gt;&lt;span style="font-weight: bold;"&gt;vim -c &amp;quot;:runtime! syntax/2html.vim | :wq | :q &amp;quot; &amp;lt;FILENAME&amp;gt;&lt;/span&gt;&lt;br&gt;File Created: &lt;span style="font-weight: bold;"&gt; &amp;lt;FILENAME&amp;gt;.html&lt;br&gt;&lt;br&gt;&lt;/span&gt;Example:&lt;br clear="all"&gt;vim -c &amp;quot;:runtime! syntax/2html.vim | :wq | :q &amp;quot; a.c&lt;br&gt;&lt;br&gt;will create a file &amp;quot;a.c.html&amp;quot;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-6536203938708412447?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/6536203938708412447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=6536203938708412447&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/6536203938708412447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/6536203938708412447'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2007/07/vim-tip.html' title='VIM Tip'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-6688260517081030500</id><published>2007-05-11T11:56:00.001+05:30</published><updated>2007-05-11T15:56:46.625+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>[Perl] Script to check stock</title><content type='html'>Script to check the stock and their graph :D&lt;br /&gt;Uses &lt;a href="http://finance.yahoo.com/"&gt;finance.yahoo.com&lt;/a&gt; to get the graphs.&lt;br /&gt;&lt;br /&gt;INPUT : stock.conf : contains stock symbol (one per line ) for each company.&lt;br /&gt;You can find the symbols on http://finance.yahoo.com/lookup, if you don't know.&lt;br /&gt;&lt;br /&gt;OUTPUT: Generates a html page that contains the information and graph for the given companies in stock.conf.&lt;br /&gt;&lt;br /&gt;Requires: lynx&lt;br /&gt;Usages: Put stocks.cgi and stock.conf in your cgi-bin directory. Open in firefox. Refresh to get latest info.&lt;br /&gt;Note: you can also run the script from shell prompt  and then redirect  the output  to a html file , then open this file in firefox :D But you need to run it every time you want the latest info.&lt;br /&gt;     # perl stock.cgi &gt; mystocks.html&lt;br /&gt;     #  firefox mystocks.html&lt;br /&gt;&lt;br /&gt;Here are the files:&lt;br /&gt;&lt;br /&gt;----- stocks.cgi ---&lt;br /&gt;#!/usr/bin/perl -w&lt;br /&gt;use strict;&lt;br /&gt;use CGI qw(:standard);&lt;br /&gt;#Written by Vaibhav Gupta&lt;br /&gt;################ Variables ######################&lt;br /&gt;my $stockfile = "stock.conf";&lt;br /&gt;my $tab_width = 3;&lt;br /&gt;################################################&lt;br /&gt;&lt;br /&gt;sub generatestockhtml () {&lt;br /&gt;   my @allfile = `cat $stockfile `;&lt;br /&gt;   my $toprint = "&amp;lt;table frame=box&amp;gt;&amp;lt;tr&amp;gt;\n";&lt;br /&gt;   my $count=0;&lt;br /&gt;&lt;br /&gt;   foreach my $line (@allfile) {&lt;br /&gt;       chomp $line;&lt;br /&gt;       my ($firstchar) = ($line =~ /(.)/ );&lt;br /&gt;       my $stock=`lynx -source " &lt;a href="http://finance.yahoo.com/d/quotes.csv?s=$line&amp;f=l1d1t1c6ohgn&amp;amp;e=.csv"&gt;http://finance.yahoo.com/d/quotes.csv?s=$line&amp;amp;amp;f=l1d1t1c6ohgn&amp;e=.csv&lt;/a&gt;"` ;&lt;br /&gt;       my ($lasttrade,$lasttradedate,$lasttradetime,$change,$open,$dayhigh,$daylow,$name) = split(/,/,$stock);&lt;br /&gt;       #Not Printing lasttradetime&lt;br /&gt;       $toprint .="&amp;lt;td&amp;gt;&lt;br /&gt;           &amp;lt;b&amp;gt;$name&amp;lt;/b&amp;gt; Trade Date = $lasttradedate &amp;lt;br&amp;gt;&lt;br /&gt;           Current: &amp;lt;font color=green&amp;gt;$lasttrade&amp;lt;/font&amp;gt; Change:&amp;lt;font color=red&amp;gt; $change&amp;lt;/font&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;           Open: &amp;lt;font color=green&amp;gt;$open&amp;lt;/font&amp;gt; High: &amp;lt;font color=green&amp;gt;$dayhigh&amp;lt;/font&amp;gt; Low: &amp;lt;font color=green&amp;gt;$daylow&amp;lt;/font&amp;gt;&lt;br /&gt;           &amp;lt;a href=\"&lt;a href="http://ichart.yahoo.com/v?s=$line%5C"&gt; http://ichart.yahoo.com/v?s=$line\&lt;/a&gt;"&amp;gt;&lt;br /&gt;           &amp;lt;img src=\"&lt;a href="http://chart.yahoo.com/c/0b/$firstchar/$line.gif%5C"&gt;http://chart.yahoo.com/c/0b/$firstchar/$line.gif\&lt;/a&gt;"&amp;gt;&lt;br /&gt;           &amp;lt;/a&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;           &amp;lt;a href=\"&lt;a href="http://finance.yahoo.com/q?s=$line&amp;d=b%5C"&gt;http://finance.yahoo.com/q?s=$line&amp;amp;d=b\&lt;/a&gt;"&amp;gt; More Info&amp;lt;/a&amp;gt;&lt;br /&gt;           &amp;lt;/td&amp;gt;&lt;br /&gt;           \n";&lt;br /&gt;       $count++;&lt;br /&gt;       if($count % $tab_width == 0) {&lt;br /&gt;           $toprint .= "&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;";&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;   $toprint .= "&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;";&lt;br /&gt;   print $toprint;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;print header("text/html"),&lt;br /&gt;     start_html("Vaibhav Gupta's Stock Page");&lt;br /&gt;my $cur = CGI-&amp;gt;new() ;&lt;br /&gt;&amp;generatestockhtml();&lt;br /&gt;print end_html;&lt;br /&gt;&lt;br /&gt;--- stock.conf --&lt;br /&gt;goog&lt;br /&gt;yhoo&lt;br /&gt;msft&lt;br /&gt;amzn&lt;br /&gt;emc&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-6688260517081030500?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/6688260517081030500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=6688260517081030500&amp;isPopup=true' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/6688260517081030500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/6688260517081030500'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2007/05/perl-script-to-check-stock.html' title='[Perl] Script to check stock'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-7782375252201671724</id><published>2007-04-19T16:41:00.001+05:30</published><updated>2007-04-19T16:42:04.509+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Shell'/><title type='text'>Trapping signals (^C and ^Z) in Bash</title><content type='html'>#!/bin/bash&lt;br&gt;#Script written by Vaibhav Gupta&lt;br&gt;#Trapping HUP TERM INT and ^Z in shell.&lt;br&gt;&lt;br&gt;echo &amp;quot;Process ID = $$&amp;quot;;&lt;br&gt;stty susp &amp;quot;&amp;quot; #Trapping CTRL-Z&lt;br&gt;trap &amp;#39;echo &amp;quot;Trapping CTRL-C, TERM and HUP&amp;quot;;&amp;#39; HUP TERM INT &lt;br&gt;echo&lt;br&gt;&lt;br&gt;echo &amp;quot;Sleeping for some time&amp;quot;&lt;br&gt;for i in `seq 1 20`; do&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sleep 1&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo -n &amp;quot;.&amp;quot;&lt;br&gt;done&lt;br&gt;echo&lt;br&gt;stty susp &amp;quot;^Z&amp;quot;&lt;br&gt;&lt;br clear="all"&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-7782375252201671724?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/7782375252201671724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=7782375252201671724&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/7782375252201671724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/7782375252201671724'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2007/04/trapping-signals-c-and-z-in-bash.html' title='Trapping signals (^C and ^Z) in Bash'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-2915933970959881999</id><published>2007-04-19T16:30:00.001+05:30</published><updated>2007-04-19T16:32:47.984+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Shell'/><title type='text'>Koool bash Functions</title><content type='html'>&lt;br clear="all"&gt;&lt;a href="http://www.novell.com/coolsolutions/tools/18639.html"&gt;http://www.novell.com/coolsolutions/tools/18639.html&lt;/a&gt;&lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-2915933970959881999?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/2915933970959881999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=2915933970959881999&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/2915933970959881999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/2915933970959881999'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2007/04/koool-bash-functions.html' title='Koool bash Functions'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-2155956249659899267</id><published>2007-04-17T20:48:00.001+05:30</published><updated>2007-04-17T20:51:13.450+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>Script to exchange ssh keys</title><content type='html'> &lt;pre&gt;&lt;font color="#ffff00"&gt; 1 &lt;/font&gt;&lt;font color="#ff40ff"&gt;#!/usr/bin/perl&lt;/font&gt;&lt;br&gt;&lt;font color="#ffff00"&gt; 2 &lt;/font&gt;&lt;font color="#ff40ff"&gt;use &lt;/font&gt;Expect;&lt;br&gt;&lt;font color="#ffff00"&gt; 3 &lt;/font&gt;&lt;font color="#8080ff"&gt;#USAGE:  ssh-key-exchange.pl &amp;lt;IP&amp;gt; &amp;lt;USERNAME&amp;gt; &amp;lt;PASSWORD&amp;gt;&lt;/font&gt;&lt;br&gt;&lt;font color="#ffff00"&gt; 4 &lt;/font&gt;&lt;br&gt;&lt;font color="#ffff00"&gt; 5 &lt;/font&gt;&lt;font color="#ffff00"&gt;my&lt;/font&gt; &lt;font color="#00ffff"&gt;$ip&lt;/font&gt; = &lt;font color="#00ffff"&gt; $ARGV[&lt;/font&gt;&lt;font color="#ff6060"&gt;0&lt;/font&gt;&lt;font color="#00ffff"&gt;]&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt; 6 &lt;/font&gt;&lt;font color="#ffff00"&gt;my&lt;/font&gt; &lt;font color="#00ffff"&gt;$login&lt;/font&gt; = &lt;font color="#00ffff"&gt;$ARGV[&lt;/font&gt;&lt;font color="#ff6060"&gt; 1&lt;/font&gt;&lt;font color="#00ffff"&gt;]&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt; 7 &lt;/font&gt;&lt;font color="#ffff00"&gt;my&lt;/font&gt; &lt;font color="#00ffff"&gt;$password&lt;/font&gt; = &lt;font color="#00ffff"&gt;$ARGV[&lt;/font&gt;&lt;font color="#ff6060"&gt;2&lt;/font&gt;&lt;font color="#00ffff"&gt; ]&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt; 8 &lt;/font&gt;&lt;font color="#ffff00"&gt;my&lt;/font&gt; &lt;font color="#00ffff"&gt;$private_key&lt;/font&gt;=&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;/root/.ssh/id_rsa&lt;/font&gt;&lt;font color="#ff6060"&gt; &amp;#39;&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt; 9 &lt;/font&gt;&lt;font color="#ffff00"&gt;my&lt;/font&gt; &lt;font color="#00ffff"&gt;$public_key&lt;/font&gt;=&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;/root/.ssh/id_rsa.pub&lt;/font&gt;&lt;font color="#ff6060"&gt; &amp;#39;&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt;10 &lt;/font&gt;&lt;font color="#ffff00"&gt;my&lt;/font&gt; &lt;font color="#00ffff"&gt;$authorisedkeyfile&lt;/font&gt;=&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;/root/.ssh/authorized_keys&lt;/font&gt;&lt;font color="#ff6060"&gt; &amp;#39;&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt;11 &lt;/font&gt;&lt;font color="#ffff00"&gt;my&lt;/font&gt; &lt;font color="#00ffff"&gt;$timeout&lt;/font&gt; = &lt;font color="#ff6060"&gt;10&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt;12 &lt;/font&gt;&lt;font color="#ffff00"&gt;my&lt;/font&gt;  &lt;font color="#00ffff"&gt;$aft&lt;/font&gt; = &lt;font color="#ffff00"&gt;new&lt;/font&gt; Expect;&lt;br&gt;&lt;font color="#ffff00"&gt;13 &lt;/font&gt;&lt;br&gt;&lt;font color="#ffff00"&gt;14 &lt;/font&gt;&lt;font color="#8080ff"&gt;#Generate the public and private key on the local m/c A &lt;/font&gt;&lt;br&gt;&lt;font color="#ffff00"&gt;15 &lt;/font&gt;&lt;font color="#ffff00"&gt;if&lt;/font&gt;(!(( &lt;font color="#ffff00"&gt;-e&lt;/font&gt; &lt;font color="#00ffff"&gt;$public_key&lt;/font&gt; ) &amp;amp;&amp;amp;( &lt;font color="#ffff00"&gt;-e&lt;/font&gt; &lt;font color="#00ffff"&gt;$private_key &lt;/font&gt;)))  {&lt;br&gt;&lt;font color="#ffff00"&gt;16 &lt;/font&gt;    &lt;font color="#ffff00"&gt;print&lt;/font&gt; &lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;Generating the Public and Private Key:&lt;/font&gt;&lt;font color="#ff40ff"&gt;\n&lt;/font&gt; &lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt;17 &lt;/font&gt;    &lt;font color="#00ffff"&gt;@result&lt;/font&gt;=&lt;font color="#ffff00"&gt;`&lt;/font&gt;&lt;font color="#ff6060"&gt;ssh-keygen -t rsa -f /root/.ssh/id_rsa -P &amp;quot;&amp;quot;&lt;/font&gt; &lt;font color="#ffff00"&gt;`&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt;18 &lt;/font&gt;    &lt;font color="#8080ff"&gt;#print @result;&lt;/font&gt;&lt;br&gt;&lt;font color="#ffff00"&gt;19 &lt;/font&gt;}&lt;br&gt;&lt;font color="#ffff00"&gt;20 &lt;/font&gt;&lt;font color="#8080ff"&gt;#Copy the file to m/c B &lt;/font&gt;&lt;br&gt;&lt;font color="#ffff00"&gt;21 &lt;/font&gt;&lt;font color="#ffff00"&gt;print&lt;/font&gt; &lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;Copying Public Key from A to B.&lt;/font&gt;&lt;font color="#ff40ff"&gt;\n&lt;/font&gt;&lt;font color="#ff6060"&gt; &amp;quot;&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt;22 &lt;/font&gt;&lt;font color="#00ffff"&gt;$aft&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;spawn&lt;/font&gt;(&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;scp &lt;/font&gt;&lt;font color="#00ffff"&gt;$public_key &lt;/font&gt;&lt;font color="#ff6060"&gt; &lt;/font&gt;&lt;font color="#00ffff"&gt;$login&lt;/font&gt;&lt;font color="#ff40ff"&gt;\@&lt;/font&gt;&lt;font color="#00ffff"&gt;$ip&lt;/font&gt;&lt;font color="#ff6060"&gt;:/tmp/&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;);&lt;br&gt;&lt;font color="#ffff00"&gt; 23 &lt;/font&gt;&lt;font color="#00ffff"&gt;$aft&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;expect&lt;/font&gt;(&lt;font color="#00ffff"&gt;$timeout&lt;/font&gt;,[ qr&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;\? $&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt; ,&lt;font color="#00ffff"&gt;     &lt;/font&gt;&lt;font color="#ffff00"&gt;sub&lt;/font&gt;&lt;font color="#00ffff"&gt; &lt;/font&gt;{ &lt;font color="#ffff00"&gt;my&lt;/font&gt; &lt;font color="#00ffff"&gt;$fh&lt;/font&gt;=&lt;font color="#ffff00"&gt;shift&lt;/font&gt;;&lt;font color="#00ffff"&gt; $fh&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;send&lt;/font&gt;(&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;yes&lt;/font&gt;&lt;font color="#ff40ff"&gt;\n&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;); exp_continue; } ],&lt;br&gt;&lt;font color="#ffff00"&gt; 24 &lt;/font&gt;                      [ &lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;Password: $&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;,&lt;font color="#ffff00"&gt;sub&lt;/font&gt;&lt;font color="#00ffff"&gt; &lt;/font&gt;{ &lt;font color="#ffff00"&gt; my&lt;/font&gt; &lt;font color="#00ffff"&gt;$fh&lt;/font&gt;=&lt;font color="#ffff00"&gt;shift&lt;/font&gt;;&lt;font color="#00ffff"&gt;$fh&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;send&lt;/font&gt;(&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#00ffff"&gt;$password&lt;/font&gt; &lt;font color="#ff40ff"&gt;\n&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;);exp_continue;}  ],&lt;br&gt;&lt;font color="#ffff00"&gt;25 &lt;/font&gt;&lt;font color="#8080ff"&gt;#                      &amp;#39;-re&amp;#39;,&amp;#39;\# $&amp;#39;     &lt;/font&gt;&lt;br&gt;&lt;font color="#ffff00"&gt; 26 &lt;/font&gt;                  );&lt;br&gt;&lt;font color="#ffff00"&gt;27 &lt;/font&gt;&lt;font color="#00ffff"&gt;$aft&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;do_soft_close&lt;/font&gt;();&lt;br&gt;&lt;font color="#ffff00"&gt;28 &lt;/font&gt;&lt;br&gt;&lt;font color="#ffff00"&gt;29 &lt;/font&gt; &lt;br&gt;&lt;font color="#ffff00"&gt;30 &lt;/font&gt;&lt;font color="#8080ff"&gt;#Add Keys to authorised keys in B&lt;/font&gt;&lt;br&gt;&lt;font color="#ffff00"&gt;31 &lt;/font&gt;&lt;font color="#ffff00"&gt;print&lt;/font&gt; &lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt; Adding Keys to authorised key in B with IP=&lt;/font&gt;&lt;font color="#00ffff"&gt;$ip&lt;/font&gt;&lt;font color="#ff6060"&gt;,[ &lt;/font&gt;&lt;font color="#00ffff"&gt;$login&lt;/font&gt;&lt;font color="#ff6060"&gt; &lt;/font&gt;&lt;font color="#00ffff"&gt;$password&lt;/font&gt;&lt;font color="#ff6060"&gt;  ] &lt;/font&gt;&lt;font color="#ff40ff"&gt;\n&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt;32 &lt;/font&gt;&lt;font color="#ffff00"&gt;my&lt;/font&gt; &lt;font color="#00ffff"&gt;$aft&lt;/font&gt; = &lt;font color="#ffff00"&gt;new&lt;/font&gt; Expect; &lt;br&gt;&lt;font color="#ffff00"&gt;33 &lt;/font&gt;&lt;font color="#00ffff"&gt;$aft&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;log_file&lt;/font&gt;(&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;/tmp/expect_log&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt; ,&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;w&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;);&lt;br&gt;&lt;font color="#ffff00"&gt;34 &lt;/font&gt;&lt;font color="#00ffff"&gt;$aft&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;spawn&lt;/font&gt;(&lt;font color="#ff6060"&gt; &amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;ssh &lt;/font&gt;&lt;font color="#00ffff"&gt;$login&lt;/font&gt;&lt;font color="#ff40ff"&gt;\@&lt;/font&gt;&lt;font color="#00ffff"&gt;$ip&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;) &lt;font color="#ffff00"&gt;or&lt;/font&gt; &lt;font color="#ffff00"&gt; die&lt;/font&gt; &lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;Cannot ssh to the machine &lt;/font&gt;&lt;font color="#ff40ff"&gt;\n&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;;&lt;br&gt;&lt;font color="#ffff00"&gt;35 &lt;/font&gt;&lt;font color="#00ffff"&gt; $aft&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;expect&lt;/font&gt;(&lt;font color="#00ffff"&gt;$timeout&lt;/font&gt;,[ qr&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;\? $&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;,&lt;font color="#00ffff"&gt;      &lt;/font&gt;&lt;font color="#ffff00"&gt;sub&lt;/font&gt;&lt;font color="#00ffff"&gt; &lt;/font&gt;{ &lt;font color="#ffff00"&gt;my&lt;/font&gt; &lt;font color="#00ffff"&gt;$fh&lt;/font&gt;=&lt;font color="#ffff00"&gt;shift&lt;/font&gt;;&lt;font color="#00ffff"&gt;$fh&lt;/font&gt;&lt;font color="#00ffff"&gt; -&amp;gt;send&lt;/font&gt;(&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;yes&lt;/font&gt;&lt;font color="#ff40ff"&gt;\n&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;); exp_continue; } ],&lt;br&gt;&lt;font color="#ffff00"&gt;36 &lt;/font&gt;                      [  &lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;Password: $&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;,&lt;font color="#ffff00"&gt;sub&lt;/font&gt;&lt;font color="#00ffff"&gt; &lt;/font&gt;{ &lt;font color="#ffff00"&gt;my&lt;/font&gt; &lt;font color="#00ffff"&gt; $fh&lt;/font&gt;=&lt;font color="#ffff00"&gt;shift&lt;/font&gt;;&lt;font color="#00ffff"&gt;$fh&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;send&lt;/font&gt;(&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#00ffff"&gt;$password&lt;/font&gt;&lt;font color="#ff40ff"&gt;\n&lt;/font&gt; &lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;);exp_continue;}  ],&lt;br&gt;&lt;font color="#ffff00"&gt;37 &lt;/font&gt;                       &lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;-re&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;,&lt;font color="#ff6060"&gt; &amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;\# $&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;br&gt;&lt;font color="#ffff00"&gt;38 &lt;/font&gt;                  );&lt;br&gt;&lt;font color="#ffff00"&gt;39 &lt;/font&gt;&lt;font color="#00ffff"&gt;$aft&lt;/font&gt;&lt;font color="#00ffff"&gt; -&amp;gt;send&lt;/font&gt;(&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;touch &lt;/font&gt;&lt;font color="#00ffff"&gt;$authorisedkeyfile&lt;/font&gt;&lt;font color="#ff40ff"&gt;\n&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;);&lt;br&gt;&lt;font color="#ffff00"&gt; 40 &lt;/font&gt;&lt;font color="#00ffff"&gt;$aft&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;expect&lt;/font&gt;(&lt;font color="#00ffff"&gt;$timeout&lt;/font&gt;,&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;-re&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt; ,&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;\# $&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;);&lt;br&gt;&lt;font color="#ffff00"&gt;41 &lt;/font&gt;&lt;font color="#00ffff"&gt;$aft&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;send&lt;/font&gt;(&lt;font color="#ff6060"&gt; &amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;cat /tmp/id_rsa.pub &amp;gt;&amp;gt; &lt;/font&gt;&lt;font color="#00ffff"&gt;$authorisedkeyfile&lt;/font&gt;&lt;font color="#ff40ff"&gt;\n&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;);&lt;br&gt;&lt;font color="#ffff00"&gt;42 &lt;/font&gt; &lt;font color="#00ffff"&gt;$aft&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;expect&lt;/font&gt;(&lt;font color="#00ffff"&gt;$timeout&lt;/font&gt;,&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;-re&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;,&lt;font color="#ff6060"&gt; &amp;#39;&lt;/font&gt;&lt;font color="#ff6060"&gt;\# $&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;#39;&lt;/font&gt;);&lt;br&gt;&lt;font color="#ffff00"&gt;43 &lt;/font&gt;&lt;font color="#00ffff"&gt;$aft&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;send&lt;/font&gt;(&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt; &lt;font color="#ff6060"&gt;exit&lt;/font&gt;&lt;font color="#ff40ff"&gt;\n&lt;/font&gt;&lt;font color="#ff6060"&gt;&amp;quot;&lt;/font&gt;);&lt;br&gt;&lt;font color="#ffff00"&gt;44 &lt;/font&gt;&lt;font color="#00ffff"&gt;$aft&lt;/font&gt;&lt;font color="#00ffff"&gt;-&amp;gt;do_soft_close&lt;/font&gt;();&lt;br&gt; &lt;font color="#ffff00"&gt;45 &lt;/font&gt; &lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-2155956249659899267?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/2155956249659899267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=2155956249659899267&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/2155956249659899267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/2155956249659899267'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2007/04/script-to-exchange-ssh-keys.html' title='Script to exchange ssh keys'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-116461344908250288</id><published>2006-11-27T13:14:00.000+05:30</published><updated>2007-04-17T20:58:24.779+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>My New Homepage.</title><content type='html'>&lt;br&gt;&lt;span style="font-weight: bold;"&gt;Check my new homepage at&amp;nbsp; &lt;/span&gt;&lt;a style="font-weight: bold;" href="http://vaibhav.gupta.googlepages.com/"&gt;http://vaibhav.gupta.googlepages.com/&lt;/a&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; You can download all the scripts from the given page.&lt;br&gt;&lt;span style="font-weight: bold;"&gt;My stumble page &lt;/span&gt;&lt;a href="http://vaibhav.stumbleupon.com/"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;http://vaibhav.stumbleupon.com/ &lt;/a&gt;&lt;br style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;Vaibhav.&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-116461344908250288?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/116461344908250288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=116461344908250288&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/116461344908250288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/116461344908250288'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/11/my-new-homepage.html' title='My New Homepage.'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-116436708860121614</id><published>2006-11-24T16:48:00.000+05:30</published><updated>2007-04-17T20:51:13.451+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>[perl] Create dir and links for a given dir.</title><content type='html'>&lt;font size="2"&gt;&lt;span style="font-weight: bold;"&gt;#!/usr/bin/perl&lt;br&gt;&lt;font size="4"&gt;&lt;span style="font-weight: bold; color: rgb(204, 0, 0);"&gt;&lt;span style="font-weight: bold;"&gt;#written by vaibhav gupta&lt;br&gt;#Creates a new directory for a given directory and creates links for files. &lt;br style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;$dir = $ARGV[0];&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;amp;usages unless $dir ;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;&amp;amp;copy;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;sub usages {&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print &amp;quot;Usages: &amp;lt;Dirname&amp;gt; \n&amp;quot;; &lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;}&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; sub copy {&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @result = `find $dir -type d`;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $dirname = `echo &amp;quot;$dir&amp;quot;&amp;nbsp; | rev | cut -d&amp;quot;/&amp;quot; -f 1 | rev`; &lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; chomp $dirname;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $desination = &amp;quot;$dirname&amp;quot;;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach $d(@result) {&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; chomp $d;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ($a,$b) = split(/$dirname/,$d);&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print &amp;quot;Creating $desination$b\n&amp;quot;;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; #&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print &amp;quot;[$a -- $b]&amp;quot;;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @res = `mkdir -p $desination$b`;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print @res;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @result = `find $dir -type f `;&lt;/span&gt; &lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach $d(@result) {&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; chomp $d;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ($a,$b) = split(/$dirname/,$d);&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print &amp;quot;Copying $d\n&amp;quot;;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @res = `ln -s&amp;nbsp; $d $desination$b`;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print @res;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;}&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;br style="font-weight: bold;"&gt;&lt;/font&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-116436708860121614?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/116436708860121614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=116436708860121614&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/116436708860121614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/116436708860121614'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/11/perl-create-dir-and-links-for-given.html' title='[perl] Create dir and links for a given dir.'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-116436674667903635</id><published>2006-11-24T16:42:00.000+05:30</published><updated>2007-04-17T20:51:13.451+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>[perl] Popup window</title><content type='html'>&lt;span style="font-weight: bold;"&gt;#!/usr/bin/perl&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;font size="4"&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);"&gt;# written by vaibhav gupta&lt;/span&gt;&lt;/font&gt;&lt;br style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;use Gtk2 '-init';&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;$x=100;$y=100; &lt;span style="color: rgb(204, 0, 0);"&gt;#default Cordinates&lt;/span&gt;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;$blue = 0xffff ;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;$label = &amp;quot;Hello there&amp;quot;;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; $label = $ARGV[0] if $ARGV[0];&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;$delay = 5 ;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;$delay = $ARGV[1] if $ARGV[1];&lt;/span&gt; &lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;$x = $ARGV[2] if $ARGV[2];&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;$y = $ARGV[3] if $ARGV[3];&lt;/span&gt;&lt;br style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;$blue = $ARGV[4] if $ARGV[4] ;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;sub usages {&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print &amp;quot;\n $ARGV[0] &amp;lt;label&amp;gt; &amp;lt;delay&amp;gt; &amp;lt;x&amp;gt; &amp;lt;y&amp;gt; &amp;lt;color&amp;gt;\n&amp;quot;;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;}&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;br style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;$window = Gtk2::Window-&amp;gt;new(&amp;quot;popup&amp;quot;);&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;$window-&amp;gt;set_title(&amp;quot;Hello&amp;quot;);&lt;/span&gt;&lt;br style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;$window-&amp;gt;signal_connect( destroy =&amp;gt; sub {Gtk2-&amp;gt;main_quit}) ;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;$label = Gtk2::Label-&amp;gt;new($label);&lt;/span&gt;&lt;br style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;$label-&amp;gt;modify_fg('normal',Gtk2::Gdk::Color-&amp;gt;new(0,0,$blue) );&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;$window-&amp;gt;add($label);&lt;/span&gt;&lt;br style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;$window-&amp;gt;move($x,$y);&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;#$window-&amp;gt;resize(300,30);&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; $window-&amp;gt;show_all();&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;Glib::Idle-&amp;gt;add( sub { Gtk2-&amp;gt;main_quit; 0 } );&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;#$window-&amp;gt;begin_move_drag(0,100,100,1); &lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;Gtk2-&amp;gt;main;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;print `sleep $delay`;&lt;/span&gt;&lt;br style="font-weight: bold;"&gt;&lt;br style="font-weight: bold;"&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-116436674667903635?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/116436674667903635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=116436674667903635&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/116436674667903635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/116436674667903635'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/11/perl-popup-window_24.html' title='[perl] Popup window'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-116436580716840168</id><published>2006-11-24T16:26:00.000+05:30</published><updated>2007-04-17T20:51:43.772+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>[python] Start Python</title><content type='html'>#!/usr/bin/python&lt;br&gt;import sys&lt;br&gt;import os&lt;br&gt;import __builtin__&lt;br&gt;&lt;br&gt;def helloworld():&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Dare to Challenge &lt;a href="http://www.pythonchallenge.com/"&gt;http://www.pythonchallenge.com/&lt;/a&gt;&amp;quot;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Hello World\n&amp;quot;; &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;This is system Path : &amp;quot;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print sys.path #this is search Path&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;sys.path.append(&amp;quot;this/is/test/path&amp;quot;);&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;This is system Path after appending test path &amp;quot;&lt;br&gt; &amp;nbsp;&amp;nbsp; &amp;nbsp;print sys.path&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;filename = os.environ.get('PYTHONSTARTUP')&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print filename&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if filename and os.path.isfile(filename):&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; execfile(filename)&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;li = []&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Method of list &amp;quot;, dir(li) # list all the method of list &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;info(__builtin__, 20) # gives the list of built in function&lt;br&gt;&lt;br&gt;#Factorial Function Start&lt;br&gt;def fact(n):&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if n &amp;gt; 1:&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return n * fact(n-1)&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;else:&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 1&lt;br&gt;def info(object, spacing=10, collapse=1): &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;quot;&amp;quot;&amp;quot;Print methods and doc strings.&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Takes module, class, list, dictionary, or string.&amp;quot;&amp;quot;&amp;quot;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# note &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;methodList = [e for e in dir(object) if callable(getattr(object, e))]  &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;processFunc = collapse and (lambda s: &amp;quot; &amp;quot;.join(s.split())) or (lambda s: s)&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;\n&amp;quot;.join([&amp;quot;%s %s&amp;quot; %&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; (method.ljust(spacing),&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; processFunc(str(getattr(object, method).__doc__))) &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; for method in methodList])&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br&gt;def datatypes():&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;str = &amp;quot;This is a string.&amp;quot;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print str&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dict = {&amp;quot;server&amp;quot;:&amp;quot;mpilgrim&amp;quot;, &amp;quot;database&amp;quot;:&amp;quot;this will be deleted&amp;quot;} &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Currnt Dictionary: &amp;quot;, dict # NOte that it printed in a sorted way.&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dict[&amp;quot;server&amp;quot;] = &amp;quot;CHANGED&amp;quot;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dict[&amp;quot;uid&amp;quot;] = &amp;quot;added&amp;quot;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dict[&amp;quot;Uid&amp;quot;] = &amp;quot;case sensitive&amp;quot; &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dict[2] = &amp;quot;mixed data&amp;quot; &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dict[&amp;quot;mixed&amp;quot;] = 123 &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;del dict[&amp;quot;database&amp;quot;]&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Now Dictionary&amp;nbsp;&amp;nbsp; : &amp;quot; , dict&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dict.clear() # To clear all the contents&lt;br&gt; &amp;nbsp;&amp;nbsp; &amp;nbsp;list = [&amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;mpilgrim&amp;quot;, &amp;quot;removethis&amp;quot;, &amp;quot;example&amp;quot;,&amp;quot;pop&amp;quot;]&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Current List&amp;nbsp;&amp;nbsp; :&amp;quot; , list &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Length of List : &amp;quot;, len(list) &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;list[-1]&amp;nbsp;&amp;nbsp; :&amp;quot;, list[-1] #&amp;quot;li[-n] == li[len(li) - n]&amp;quot; &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Slicing&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;quot;, list[1:-1]&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Pop Element: &amp;quot;, list.pop()&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;list.append(&amp;quot;append&amp;quot;) &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;list.extend([&amp;quot;extend1&amp;quot;,&amp;quot;extend2&amp;quot;]) #note the arg is a list.&amp;nbsp; Concatenates&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;list.insert(2,&amp;quot;inserthere&amp;quot;)&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;list.remove(&amp;quot;removethis&amp;quot;);&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;list += [&amp;quot;Operators&amp;quot;] &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Now List&amp;nbsp;&amp;nbsp; : &amp;quot;,list&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Searching extend1 (first occurence): Found at location &amp;quot;, list.index(&amp;quot;extend1&amp;quot;)&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;Found c in list:&amp;quot; , &amp;quot;c&amp;quot; in list &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;list = [&amp;quot;1&amp;quot;,&amp;quot;2&amp;quot;]&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;List Operator&amp;nbsp; : &amp;quot;, list * 10&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;tuple = (&amp;quot;son&amp;quot;,&amp;quot;mon&amp;quot;,&amp;quot;tue&amp;quot;,&amp;quot;wed&amp;quot;,&amp;quot;thu&amp;quot;,&amp;quot;fri&amp;quot;,&amp;quot;sat&amp;quot;) # Ordered, fast, But can not be modified &lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print tuple&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;(a,b,c,d,e,f,g) = range(7)&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print &amp;quot;rnage d = &amp;quot;, d&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;#3.6&lt;br&gt;&lt;br&gt;#Calling main Functions.&lt;br&gt;helloworld() &lt;br&gt;#print fact(500)&lt;br&gt;#datatypes();&lt;br&gt;#info(list)&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; &amp;quot;&amp;quot;&amp;quot;&amp;nbsp; Notes&lt;br&gt;---------- and-or Trick&amp;nbsp; ----------&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; a = &amp;quot;first&amp;quot;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; b = &amp;quot;second&amp;quot;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 1 and a or b&lt;br&gt;'first'&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 0 and a or b&lt;br&gt;'second' &lt;br&gt;---------- and-or Trick Safely ----------&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; a = &amp;quot;&amp;quot;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; b = &amp;quot;second&amp;quot;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; (1 and [a] or [b])[0]&lt;br&gt;---------- split With No Arguments ----------&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; s = &amp;quot;this&amp;nbsp;&amp;nbsp;&amp;nbsp; is\na\ttest&amp;quot; &lt;br&gt;&amp;gt;&amp;gt;&amp;gt; print s&lt;br&gt;this&amp;nbsp;&amp;nbsp; is&lt;br&gt;a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; print s.split()&lt;br&gt;['this', 'is', 'a', 'test']&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; print &amp;quot; &amp;quot;.join(s.split())&lt;br&gt;'this is a test'&lt;br&gt;&lt;br&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-116436580716840168?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/116436580716840168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=116436580716840168&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/116436580716840168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/116436580716840168'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/11/python-start-python.html' title='[python] Start Python'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-116436195923337272</id><published>2006-11-24T15:22:00.000+05:30</published><updated>2007-04-17T20:58:53.994+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='article'/><title type='text'>The Fastest Language</title><content type='html'>&lt;p class="mobile-post"&gt;Well,&lt;br /&gt;Though this post is a little digression from what this forum is meant&lt;br /&gt;for. It is really an interesting one because many a times we think&lt;/p&gt;&lt;p class="mobile-post"&gt;Which language is the fastest?&lt;/p&gt;&lt;p class="mobile-post"&gt;Considering the same hardware/environments are provided, it will all&lt;br /&gt;depend on how well a compiler/interpreter make use of underlying&lt;br /&gt;hardware/environment to generate native/interpreted code.&lt;/p&gt;&lt;p class="mobile-post"&gt;In a computer language shootout &lt;a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=recursive&amp;amp;lang=all"&gt;[Survey]&lt;/a&gt;&lt;br /&gt;differrent compiler for different languages tested against their&lt;br /&gt;ability to translate code for Ackermann Function&lt;br /&gt;[&lt;a href="http://en.wikipedia.org/wiki/Ackermann_function"&gt;Ackermann_function&lt;/a&gt;], Fibonacci numbers[&lt;a href="http://en.wikipedia.org/wiki/Fibonacci_number"&gt;Fibonacci_number&lt;/a&gt;] and&lt;br /&gt;Tak functions [&lt;a href="http://mathworld.wolfram.com/TAKFunction.html"&gt;TAKFunction.html&lt;/a&gt;].&lt;/p&gt;&lt;p class="mobile-post"&gt;I was really happy to see that my favourite compiler gcc rules :-)&lt;/p&gt;&lt;p class="mobile-post"&gt;-by sbjoshi&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-116436195923337272?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/116436195923337272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=116436195923337272&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/116436195923337272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/116436195923337272'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/11/fastest-language.html' title='The Fastest Language'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-115933824531812804</id><published>2006-09-27T11:54:00.000+05:30</published><updated>2007-04-17T20:51:13.451+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>[Perl] Script to take backups</title><content type='html'>&lt;p class="mobile-post"&gt;#!/usr/bin/perl&lt;br /&gt;# Written By Vaibhav Gupta&lt;br /&gt;# vaibhav.gupta@gmail.com&lt;br /&gt;# Modify @FILES_TO_BACKUP  @DIRS_TO_BACKUP  @FILES_PATH as per your need.&lt;/p&gt;&lt;p class="mobile-post"&gt;$Directory=`date +%Y%m%d%k%M`;&lt;br /&gt;chomp $Directory; # you know why ?&lt;br /&gt;$HOMEDIRECTORY="~guptav/";&lt;br /&gt;@FILES_TO_BACKUP=(".vimrc",".bashrc","public_html/cgi-bin/index.cgi");&lt;br /&gt;@DIRS_TO_BACKUP=( "cvsroot","public_html/","bin");&lt;br /&gt;@FILES_PATH=("/etc/httpd/conf/httpd.conf");&lt;/p&gt;&lt;p class="mobile-post"&gt;print "\nCreating directory $Directory\n";&lt;br /&gt;@message = `mkdir $Directory`;&lt;/p&gt;&lt;p class="mobile-post"&gt;foreach $filename (@FILES_TO_BACKUP) {&lt;br /&gt;        @message = `cp $HOMEDIRECTORY$filename $Directory`;&lt;br /&gt;}&lt;br /&gt;foreach $filename (@FILES_PATH) {  #Absolute Filename&lt;br /&gt;        @message = `cp $filename $Directory`;&lt;br /&gt;}&lt;br /&gt;foreach $dirname (@DIRS_TO_BACKUP) {&lt;br /&gt;        @message = `cp -r $HOMEDIRECTORY$dirname $Directory`;&lt;br /&gt;}&lt;br /&gt;@message = `tar -cvzf $Directory.tgz $Directory`;&lt;br /&gt;print @message;&lt;/p&gt;&lt;p class="mobile-post"&gt;#Vaibhav.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-115933824531812804?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/115933824531812804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=115933824531812804&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/115933824531812804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/115933824531812804'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/09/perl-script-to-take-backups.html' title='[Perl] Script to take backups'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-115797623784992050</id><published>2006-09-11T17:33:00.000+05:30</published><updated>2007-04-17T20:52:08.462+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Shell'/><title type='text'>[shell] To find the PPID of a PID and more.</title><content type='html'>&lt;p class="mobile-post"&gt;      1 #!/bin/bash&lt;br /&gt;      2 pid=$1&lt;br /&gt;      3 if [ -f "/proc/$pid/stat" ]; then&lt;br /&gt;      4         name=`cat /proc/$pid/stat | cut -d" " -f 2`&lt;br /&gt;      5 else&lt;br /&gt;      6         echo "Not a Valid pid $pid"&lt;br /&gt;      7         exit&lt;br /&gt;      8 fi&lt;br /&gt;      9&lt;br /&gt;     10&lt;br /&gt;     11 while [ "$pid" -gt "0" ]; do&lt;br /&gt;     12         echo -n $pid&lt;br /&gt;     13         echo -n [$name]&lt;br /&gt;     14         echo -n " --&amp;gt; "&lt;br /&gt;     15         name=`cat /proc/$pid/stat | cut -d" " -f 2`&lt;br /&gt;     16         pid=`cat /proc/$pid/stat | cut -d" " -f 4`&lt;br /&gt;     17 done&lt;br /&gt;     18&lt;br /&gt;     19 echo "0"&lt;br /&gt;     20&lt;/p&gt;&lt;p class="mobile-post"&gt;-Vaibhav&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-115797623784992050?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/115797623784992050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=115797623784992050&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/115797623784992050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/115797623784992050'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/09/shell-to-find-ppid-of-pid-and-more.html' title='[shell] To find the PPID of a PID and more.'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-115796082556724024</id><published>2006-09-11T13:17:00.000+05:30</published><updated>2007-04-17T20:59:51.518+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Kernel'/><title type='text'>Writing Kernel Modules for 2.6</title><content type='html'>&lt;p class="mobile-post"&gt;hello.c&lt;br /&gt;      1 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;      2 #include &amp;lt;linux/kernel.h&amp;gt;&lt;br /&gt;      3&lt;br /&gt;      4 int init_module(void)&lt;br /&gt;      5 {&lt;br /&gt;      6     printk(KERN_INFO "Hello world \n");&lt;br /&gt;      7     return 0;&lt;br /&gt;      8 }&lt;br /&gt;      9&lt;br /&gt;     10 void cleanup_module(void)&lt;br /&gt;     11 {&lt;br /&gt;     12     printk(KERN_INFO "Goodbye world \n");&lt;br /&gt;     13 }&lt;/p&gt;&lt;p class="mobile-post"&gt;Makefile&lt;br /&gt;      1 obj-m += hello.o&lt;br /&gt;      2&lt;br /&gt;      3 all:&lt;br /&gt;      4         make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules&lt;br /&gt;      5&lt;br /&gt;      6&lt;br /&gt;      7 clean:&lt;br /&gt;      8         make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean&lt;br /&gt;      9 fresh: clean all&lt;/p&gt;&lt;p class="mobile-post"&gt;Commands:&lt;/p&gt;&lt;p class="mobile-post"&gt;Install Module# insmod hello.ko&lt;br /&gt;Remove Module # rmmod hello.ko&lt;br /&gt;Module info   # modinfr hello.ko&lt;br /&gt;List Module   # lsmod&lt;br /&gt;Check Log     # tail  /var/log/messages&lt;/p&gt;&lt;p class="mobile-post"&gt;Files :&lt;br /&gt;/proc/modules       | List of modules |&lt;br /&gt;/proc/kallsyms      | List of Symbols |&lt;/p&gt;&lt;p class="mobile-post"&gt;Vaibhav.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-115796082556724024?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/115796082556724024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=115796082556724024&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/115796082556724024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/115796082556724024'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/09/writing-kernel-modules-for-26.html' title='Writing Kernel Modules for 2.6'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-115185559865265538</id><published>2006-07-02T21:23:00.000+05:30</published><updated>2007-04-17T20:59:31.970+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>[c++] Source code to find Prime numbers &lt; n+1</title><content type='html'>&lt;p class="mobile-post"&gt;/*Code is written by Vaibhav Gupta*/&lt;/p&gt;&lt;p class="mobile-post"&gt;int prime(int n){&lt;/p&gt;&lt;p class="mobile-post"&gt;	  bool *prime = new bool[n+1];&lt;br /&gt;	  int i;&lt;br /&gt;	  for(i=0;i&amp;lt;n+1;i++){&lt;br /&gt;			 prime[i] = true;&lt;br /&gt;	  }&lt;br /&gt;	  prime[0]=false;&lt;br /&gt;	  prime[1]=false;&lt;br /&gt;	  int m = (int)sqrt((float)n);&lt;/p&gt;&lt;p class="mobile-post"&gt;	  for (i=2; i&amp;lt;=m; i++)&lt;br /&gt;			 if (prime[i])&lt;br /&gt;				for (int k=i*i; k&amp;lt;=n; k+=i)&lt;br /&gt;					  prime[k]=false;&lt;/p&gt;&lt;p class="mobile-post"&gt;	  for (i=0; i&amp;lt;n+1; i++){&lt;br /&gt;			 if (prime[i]) cout &amp;lt;&amp;lt; i &amp;lt;&amp;lt; " ";&lt;br /&gt;	  }&lt;br /&gt;	  cout &amp;lt;&amp;lt; endl;&lt;br /&gt;	  return 0;&lt;br /&gt;}&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-115185559865265538?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/115185559865265538/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=115185559865265538&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/115185559865265538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/115185559865265538'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/07/c-source-code-to-find-prime-numbers-n1.html' title='[c++] Source code to find Prime numbers &lt; n+1'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-115078240967052511</id><published>2006-06-20T11:16:00.000+05:30</published><updated>2007-04-17T21:00:14.767+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Links'/><title type='text'>[ebooks] Over 1 billion ebooks.......</title><content type='html'>&lt;p class="mobile-post"&gt;Hi friends,&lt;/p&gt;&lt;p class="mobile-post"&gt;Some sites may not be working.....&lt;/p&gt;&lt;p class="mobile-post"&gt;http://www.freebookzone.com/&lt;br /&gt;http://en.wikipedia.org/wiki/E-book&lt;/p&gt;&lt;p class="mobile-post"&gt;ftp://194.105.193.56/pub/warez/books/os/&lt;br /&gt;ftp://194.85.35.67/BOOKS/&lt;br /&gt;ftp://193.231.20.1/pub/books/&lt;br /&gt;ftp://218.104.214.138/4tF/2003/Xmas/&lt;br /&gt;fxp://fxp.runnet.ru/BOOKS - flashget&lt;br /&gt;ftp://se-lab-server.ddns.comp.nus.edu.sg/ebooks/&lt;br /&gt;http://sleekfreak.ath.cx:81/books/&lt;br /&gt;http://preterhuman.net/texts/&lt;br /&gt;http://www.waneesoft.net/books/&lt;br /&gt;http://www.itcertifer.com - www.itcertifer.com&lt;br /&gt;http://cgdn.net/books/&lt;br /&gt;http://www.nerd-star.com/books/&lt;br /&gt;http://publib-b.boulder.ibm.com/Redbooks.nsf/redbooks/&lt;br /&gt;http://classics.mit.edu/Browse/index-Homer.html&lt;br /&gt;http://www.cybersecurity.com.br/Livros/&lt;br /&gt;http://amitmathur.8m.com/ebooks.html&lt;br /&gt;http://mail.stibanas.ac.id/ebooks/&lt;br /&gt;http://www.wolfgarten.com&lt;br /&gt;http://johnny.ihackstuff.com&lt;br /&gt;http://www.law.fsu.edu&lt;br /&gt;http://mail.stibanas.ac.id/ebooks&lt;br /&gt;http://www.comms.scitech.susx.ac.uk/fft/&lt;br /&gt;http://www.cadforum.cz/cadforum_en/default.asp http://en.fixdown.com/eall_1.htm&lt;br /&gt;http://en.fixdown.com/download.asp?id=1658...589&amp;amp;soft=sxdown&lt;br /&gt;http://en.fixdown.com/download.asp?id=1588...886&amp;amp;soft=kldown&lt;br /&gt;http://en.fixdown.com/download.asp?id=1588...886&amp;amp;soft=fjdown&lt;br /&gt;http://en.fixdown.com/download.asp?id=1588...886&amp;amp;soft=bjdown&lt;br /&gt;http://preterhuman.net/texts/&lt;br /&gt;http://www.eicage.org/eicage.asp&lt;br /&gt;http://bjxebook.myetang.com/pc.html&lt;br /&gt;http://www.about-flash.com/&lt;br /&gt;http://docs.rinet.ru:8080/DEFAULT.HTML&lt;br /&gt;http://www.bsmooth.de/BSolutions/&lt;br /&gt;http://newdata.box.sk/raven/books.html&lt;br /&gt;http://www.maththinking.com/boat/computerbooks.html&lt;br /&gt;http://dhruvaraj.150m.com/&lt;br /&gt;http://podgoretsky.pri.ee/ms.html&lt;br /&gt;http://www.comms.scitech.susx.ac.uk/fft/&lt;br /&gt;http://www.intelinfo.com/free_computer_books.html&lt;br /&gt;http://www.e-book.com.au/freebooks.htm&lt;br /&gt;http://www.mcsedirectory.com/books.shtml&lt;br /&gt;http://www.gorkhali.com/kamal/download.htm&lt;br /&gt;http://www.winnetmag.com/windowsnt20002003faq/&lt;br /&gt;http://www.2000trainers.com/&lt;br /&gt;http://www.w3schools.com/&lt;br /&gt;http://members.rogers.com/thekickman/ebooks.htm&lt;br /&gt;http://www.techtutorials.com/Applications/&lt;br /&gt;http://sunsite.iisc.ernet.in/virlib/&lt;br /&gt;http:// www.bdsoft.com/links.html&lt;br /&gt;http://www.python.org/doc/&lt;br /&gt;http://www.graphic-design.com/Photoshop/&lt;br /&gt;http://bjxebook.myetang.com/pc_ebooks/db.htm&lt;br /&gt;http://neworder.box.sk/box.php3?gfx=neword...0Unix%20systems&lt;br /&gt;http://www.exameware.com&lt;br /&gt;http://www.comms.scitech.susx.ac.uk/fft/&lt;br /&gt;http://rahmat.zikri.com/books.html&lt;br /&gt;http://freebooks.by.ru/&lt;br /&gt;http://www.mindview.net/Books/DownloadSites&lt;br /&gt;http://www.maththinking.com/boat/computerbooks.html&lt;br /&gt;http://docs.rinet.ru:8080/&lt;br /&gt;http://www.ebone.at/files.php?show=Books&lt;br /&gt;http://www.empowermentzone.com/#unix&lt;br /&gt;http://skaiste.elekta.lt/Books/&lt;br /&gt;http://content.443.ch/pub/&lt;br /&gt;http://www.ods.com.ua/index.phtml&lt;br /&gt;http://kavosh.irost.net/books/library.htm&lt;br /&gt;http://stommel.tamu.edu/~baum/programming.html&lt;br /&gt;http://digital.library.upenn.edu/books/&lt;br /&gt;http://zikri.indoglobal.com/books.html&lt;br /&gt;http://www.greylib.align.ru/index.html&lt;br /&gt;http://www.itcertifer.com/en/download/default.asp&lt;br /&gt;http://www.lib.ru&lt;br /&gt;http://lib.km.ru&lt;br /&gt;http://aldebaran.ru&lt;br /&gt;http://lib.bigmir.net&lt;br /&gt;http://books.myweb.ru&lt;br /&gt;http://book.pp.ru&lt;br /&gt;http://www.biglib.com.ua/&lt;br /&gt;http://www.lib.com.ua/&lt;br /&gt;http://www.bestlibrary.ru/&lt;br /&gt;http://www.citforum.ru/&lt;br /&gt;http://i2r.rusfund.ru/&lt;br /&gt;http://www.yaxoo.com/books/&lt;br /&gt;http://docs.gets.ru/&lt;br /&gt;http://bookz.ru/&lt;br /&gt;http://www.bestbooks.ru/&lt;br /&gt;http://leoslibrary.on.to/&lt;br /&gt;http://www.bomanuar.ru/&lt;br /&gt;http://molbiol.ru/review/index.html&lt;br /&gt;http://lib.rin.ru/&lt;br /&gt;http://www.bomanuar.ru/&lt;br /&gt;http://www.voronezh.net/library/&lt;br /&gt;http://www.xnt.info/category.php?all=44&amp;amp;start=5&amp;amp;id=9&lt;br /&gt;http://www.emc.maricopa.edu/faculty/farabe...BioBookTOC.html&lt;br /&gt;http://netfoo.net/unix_iso/unixbook.iso&lt;br /&gt;http://maui.fornex.net/e-book/pdf-books/&lt;br /&gt;http://books.dimka.ee/ - HUGE COLLECTION&lt;br /&gt;http://cgdn.net/books/ - Game Programming&lt;br /&gt;http://www.whitefreespeech.com/sub/TurnerDiaries.pdf&lt;br /&gt;http://www.solargeneral.com/library&lt;br /&gt;http://classics.mit.edu/Browse&lt;br /&gt;http://www.nerd-star.com/books/&lt;br /&gt;http://web.starman.ee/winxp/Windows%20XP%2...nside%20Out.rar&lt;br /&gt;http://www.comms.engg.susx.ac.uk/fft/&lt;br /&gt;http://www.vdr-era.cjb.net/documentos/&lt;br /&gt;http://devsaa.narod.ru/books&lt;br /&gt;http://www.ibiblio.org/obp/electricCircuits&lt;br /&gt;http://www.highend3d.com/artists/artist.3d...=yinako&amp;amp;iid=197&lt;/p&gt;&lt;p class="mobile-post"&gt;http://narod.yandex.ru/cgi-bin/yandmarkup?...og=0x2757571A&amp;amp;H&lt;br /&gt;ndlQuery=757312448&amp;amp;PageNum=0&amp;amp;g=0&amp;amp;d=0&amp;amp;ag=host&amp;amp;tg=1&amp;amp;q0=54598832&amp;amp;p=&lt;/p&gt;&lt;p class="mobile-post"&gt;http://onlinebooks.library.upenn.edu/webbi...le=&amp;amp;tmode=words&lt;/p&gt;&lt;p class="mobile-post"&gt;http://macbeht.narod.ru/bucher.htm&lt;br /&gt;http://www.pcworld.com/resource/PDF/circ_2.asp&lt;br /&gt;http://www.emc.maricopa.edu/faculty/farabe...BioBookTOC.html&lt;br /&gt;http://netfoo.net/unix_iso/unixbook.iso&lt;br /&gt;http://maui.fornex.net/e-book/pdf-books/&lt;br /&gt;http://books.dimka.ee/&lt;br /&gt;http://www.click-now.net/ebooks.htm&lt;br /&gt;http://www.baen.com/&lt;br /&gt;http://www.ebookmall.com/ebook/5613-ebook.htm&lt;br /&gt;http://etext.library.adelaide.edu.au/&lt;br /&gt;http://www.freebooks4doctors.com&lt;br /&gt;http://gutenberg.net/cgi-bin/search/t9.cgi&lt;br /&gt;http://gutenberg.net/gutenberg/find.shtml&lt;br /&gt;http://freetechstuff.netfirms.com/dotnet/books.htm&lt;br /&gt;http://www.soldierx.com/books/ACTIVEX_PROG...SHED/index.html&lt;/p&gt;&lt;p class="mobile-post"&gt;http://www.soldierx.com/books/CHARLIE_CALV...SHED/index.html&lt;/p&gt;&lt;p class="mobile-post"&gt;http://www.strath.ac.uk/IT/Docs/Ccourse/&lt;br /&gt;http://www.brpreiss.com/books/opus4/html/book.html&lt;/p&gt;&lt;p class="mobile-post"&gt;http://onlinebooks.library.upenn.edu/webbi...le=&amp;amp;tmode=words&lt;/p&gt;&lt;p class="mobile-post"&gt;http://www.xatrix.org/index.php&lt;br /&gt;http://www.fintech.ru/Library/prog/Getstrt...DB/getstart.htm&lt;br /&gt;http://www.commandprompt.com/ppbook/&lt;br /&gt;http://www.vijaymukhi.com/documents/books/...oap/xmlsoap.htm&lt;br /&gt;http://www.vijaymukhi.com/documents/books/wap/wap.html&lt;br /&gt;http://www.vijaymukhi.com/documents/books/...sp/javajsp.html&lt;br /&gt;http://www.vijaymukhi.com/documents/books/...s/j2me/j2me.htm&lt;br /&gt;http://www.vijaymukhi.com/documents/books/...s/j2me/j2me.htm&lt;br /&gt;http://www.vijaymukhi.com/documents/books/...cs/csharp1.html&lt;br /&gt;http://www.vijaymukhi.com/documents/books/...dv/csharp2.html&lt;br /&gt;http://www.vijaymukhi.com/documents/books/...vbnet/vbnet.htm&lt;br /&gt;http://www.vijaymukhi.com/documents/books/...ta/metadata.htm&lt;br /&gt;http://www.vijaymukhi.com/documents/books/...net/content.htm&lt;br /&gt;http://www.vijaymukhi.com/documents/books/...2net/vs2net.htm&lt;br /&gt;http://www.vijaymukhi.com/documents/books/...et1/aspnet.html&lt;br /&gt;http://docs.rinet.ru/Cold/&lt;br /&gt;http://www.syncfusion.com/FAQ/WinForms/default.asp#86&lt;/p&gt;&lt;p class="mobile-post"&gt;http://www.ssuet.edu.pk/~amkhan/cisco/(ebo...ching/Table.htm&lt;/p&gt;&lt;p class="mobile-post"&gt;http://www.blindprogramming.com/&lt;br /&gt;http://ssuet.edu.pk/taimoor/books/1-57521-...163-7/index.htm&lt;br /&gt;http://www.manastungare.com&lt;br /&gt;http://world.std.com/obi/&lt;br /&gt;http://www.itebooks.net/onlineebooks/Networking.html&lt;br /&gt;http://www.itebooks.net/onlineebooks/Certi...tification.html&lt;br /&gt;http://www.itebooks.net/onlineebooks/Opera...ingSystems.html&lt;br /&gt;http://www.itebooks.net/onlineebooks/Enterprise.html&lt;br /&gt;http://www.itebooks.net/onlineebooks/Internet.html&lt;br /&gt;http://www.itebooks.net/onlineebooks/Programming.html&lt;br /&gt;http://www.itebooks.net/onlineebooks/Database.html&lt;br /&gt;http://www.itebooks.net/onlineebooks/Graphics.html&lt;br /&gt;http://www.itebooks.net/onlineebooks/DesktopApps.html&lt;br /&gt;http://www.itebooks.net/onlineebooks/Hardware.html&lt;br /&gt;http://freebooks.boom.ru&lt;br /&gt;http://the-tech.mit.edu/Shakespeare/&lt;br /&gt;http://www.vecpix.com/&lt;br /&gt;http://kristi.erdves.lt/books/&lt;br /&gt;http://www.zionwap.net/books/main.html&lt;br /&gt;http://www.nopayweb.com/computerbook/&lt;br /&gt;http://leon83.com/download/book/FreeBookList.htm&lt;br /&gt;http://www.mslit.com&lt;br /&gt;http://www.python.org/doc/current/tut/tut.html&lt;br /&gt;http://esspc-ebooks.com&lt;br /&gt;http://en.fixdown.com/eall_3.htm&lt;br /&gt;http://www.xnt.info/category.php?id=9&lt;br /&gt;http://www.bluesfear.com/v5.php&lt;br /&gt;http://www.teamphotoshop.com/photoshop/tut...ials/ps_tut.php&lt;br /&gt;http://www.80four.co.uk/tutorials/photoshop.html&lt;br /&gt;http://www.eyesondesign.net/pshop/tuts.htm&lt;br /&gt;http://www.good-tutorials.com/&lt;br /&gt;http://www.grafx-design.com/tutorials.html&lt;br /&gt;http://myjanee.home.insightbb.com/tutorials.htm&lt;br /&gt;http://www.photoshoproadmap.com/photoshop- ...rials-tips.html&lt;br /&gt;http://rainworld.com/psworkshop/&lt;/p&gt;&lt;p class="mobile-post"&gt;http://131.128.51.37/se-lab-server.ddns.....edu.sg/ebooks/&lt;br /&gt;http://www.et.utt.ro/public/Docs/&lt;br /&gt;http://www.docs.rinet.ru&lt;br /&gt;http://www.tutorialized.com&lt;br /&gt;http://books.malonus.com/ebooks/computer_science/&lt;br /&gt;http://www.intersoftlb.com/blog4.aspx (mcsd books)&lt;br /&gt;http://131.128.51.37/se-lab-server.ddns.....edu.sg/ebooks/&lt;br /&gt;(nice)(electronic...computer)&lt;br /&gt;http://www.et.utt.ro/public/Docs/&lt;br /&gt;http://www.docs.rinet.ru&lt;br /&gt;http://www.tutorialized.com&lt;br /&gt;http://books.malonus.com/ebooks/computer_science/ (nice)&lt;br /&gt;http://cip.uni-trier.de/jia/links/weball.htm&lt;br /&gt;http://www.gorkhali.com/kamal/download.htm&lt;br /&gt;ftp://ftp.runnet.ru/BOOKS/&lt;/p&gt;&lt;p class="mobile-post"&gt;Happy reading.......&lt;/p&gt;&lt;p class="mobile-post"&gt;Bye&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-115078240967052511?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/115078240967052511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=115078240967052511&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/115078240967052511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/115078240967052511'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/06/ebooks-over-1-billion-ebooks.html' title='[ebooks] Over 1 billion ebooks.......'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114899863067663752</id><published>2006-05-30T19:47:00.000+05:30</published><updated>2007-04-17T21:01:45.135+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='notes'/><title type='text'>How to set up thinclient in Linux</title><content type='html'>&lt;p class="mobile-post"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="mobile-post"&gt;Thin Client How to by Vaibhav Gupta&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="font-weight: bold; color: rgb(51, 204, 0);font-size:180%;" &gt;How to set up Thintux Server&lt;/span&gt;&lt;br /&gt;You need to setup dhcp server and copy thintux folder on the server.&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);font-size:130%;" &gt;Setting up dhcp server&lt;/span&gt;&lt;br /&gt;a. Make  dhcpd configuration file  :-&amp;gt;  /etc/dhcpd.conf&lt;br /&gt;b. Starting dhcpd    :-&amp;gt;  /etc/init.d/dhcpd start&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="color: rgb(255, 204, 51);font-size:130%;" &gt;    Configuring dhcpd.conf Manually:-&lt;/span&gt;&lt;br /&gt;1. Set subnet,netmask,router and range of IPs.&lt;br /&gt;2. Set Thintux session server address, resolution and color depth.&lt;br /&gt;3. Detailed Information man dhcpd, man dhcpd.conf&lt;br /&gt;4. Get Sample Configuration dhcpd.conf (For Linux)&amp;lt;a&lt;br /&gt;href="thintux/dhcpd.conf" &amp;gt;[dhcpd.conf] &amp;lt;/a&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 51);font-size:130%;" &gt;    Format of dhcp.conf  :-&lt;/span&gt;&lt;br /&gt;[code]&lt;br /&gt;#global parameters...&lt;br /&gt;subnet 10.105.0.0 netmask 255.255.128.0 {&lt;br /&gt;# subnet-specific parameters...&lt;br /&gt;    range 10.105.13.101 10.105.13.210;&lt;br /&gt;    option routers 10.105.1.250;&lt;br /&gt;    option THINTUX_SESSION_SERVER "10.105.11.23";&lt;br /&gt;    option THINTUX_SCREEN_RESOLUTION "800x600";&lt;br /&gt;    option THINTUX_SCREEN_COLOR_DEPTH "8";&lt;br /&gt;}&lt;br /&gt;group {&lt;br /&gt;#group-specific parameters...&lt;br /&gt;    host abc.iitb.ac.in {&lt;br /&gt; #host-specific parameters...&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;[/code]  &lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;  Configuring using config-dhcpd :-&lt;/span&gt;&lt;br /&gt; 1. http://config-dhcpd.sourceforge.net/ &lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="color: rgb(255, 204, 0);font-size:130%;" &gt;Start X Display Manager&lt;/span&gt;&lt;br /&gt;1. vim /usr/X11R6/lib/X11/xdm/xdm-config&lt;br /&gt;2. Comment the last line as below :-&lt;br /&gt; !DisplayManager.requestPort:    0&lt;br /&gt;3. Save and Exit&lt;br /&gt;4. vim /usr/X11R6/lib/X11/xdm/Xaccess&lt;br /&gt;5. uncomment the following line (By removing #)&lt;br /&gt; #*                 #any host can get a login window&lt;br /&gt;6. Save and Exit&lt;br /&gt;7. Start xdm    :-&amp;gt; xdm&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;   Help and Debug :-  &lt;/span&gt;&lt;br /&gt;1. man xdm&lt;br /&gt;2. Error Logs  :-&amp;gt;  /var/log/xdm-errors&lt;br /&gt; or  :-&amp;gt;  /usr/X11R6/lib/X11/xdm/xdm-errors&lt;br /&gt;3. X -query 10.105.11.23&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 51);"&gt;Check tftp is enable on server&lt;/span&gt;&lt;br /&gt;1. vim /etc/xinetd.d/tftp&lt;br /&gt;2. Change the disable option to "no" as Below.&lt;br /&gt; disable                 = no&lt;br /&gt;3. Save file and exit&lt;br /&gt;4. Restart xinitd&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;Copy /thintux folder in /tftboot on server&lt;/span&gt;&lt;br /&gt;&amp;lt;a href="thintux/thintux.tgz" &amp;gt;[thintux][tgz] &amp;lt;/a&amp;gt;&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;a href="http://thintux.sourceforge.net/"&gt;http://thintux.sourceforge.net/&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="color: rgb(51, 204, 0);font-size:180%;" &gt;How to setup thinclient&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 51);font-size:130%;" &gt;Client already contaning Linux OS&lt;/span&gt;&lt;br /&gt;1. Copy "localdsk" as /root/thinlinux on Client &amp;lt;a&lt;br /&gt;href="thintux/localdsk" &amp;gt;[localdsk][x86 boot sector] &amp;lt;/a&amp;gt;&lt;br /&gt;2. Modify /etc/lilo.conf&lt;br /&gt;3. Run lilo&lt;br /&gt;4. Restart the PC&lt;br /&gt;&lt;br /&gt; Add following Entries to lilo.conf:-&lt;/p&gt;&lt;p class="mobile-post"&gt;   default=thin-linux # Add or Modify this line for default Booting from N/w&lt;br /&gt; image=/root/thinlinux&lt;br /&gt;  label=thin-linux&lt;br /&gt;read-only&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);font-size:130%;" &gt;Client that doesnot contain Linux OS&lt;/span&gt;&lt;br /&gt;For all the following steps you have to use Dos Bootable Floopy&lt;br /&gt;containg fdisk, format, syslinux.com and linux image(thintux) [as&lt;br /&gt;downloaded above].&lt;br /&gt;&lt;br /&gt;1. Delete all partitions on Hard Drive using fdisk.&lt;br /&gt;2. Execute :-&amp;gt; fdisk /mbr&lt;br /&gt;3. Create 20MB Dos Partion and Make active&lt;br /&gt;4. Reboot&lt;br /&gt;5. Execute:-&amp;gt; Format C:&lt;br /&gt;6. Execute:-&amp;gt; syslinux c:&lt;br /&gt;7. Execute:-&amp;gt; copy linux c:  The above file "linux" is same as "localdsk". Only the name is&lt;br /&gt; changed in this case.&lt;br /&gt;8. Remove Floppy and Reboot&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;For Debugging&lt;/span&gt;&lt;br /&gt;1. Use tcpdump as&lt;br /&gt; tcpdump -n port 7100&lt;br /&gt; tcpdump -n port tftp&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="color: rgb(51, 204, 0);font-size:130%;" &gt;Links&lt;/span&gt;&lt;br /&gt;&lt;a href="http://thintux.sourceforge.net"&gt;http://thintux.sourceforge.net&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.dhcp.org"&gt;http://www.dhcp.org&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.dhcp-handbook.com/dhcp_faq.html"&gt;http://www.dhcp-handbook.com/dhcp_faq.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://syslinux.zytor.com"&gt;http://syslinux.zytor.com&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.vlug.org/vlug/meetings/X-terminal_presentation/overview.html"&gt;http://www.vlug.org/vlug/meetings/X-terminal_presentation/overview.html&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114899863067663752?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/114899863067663752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=114899863067663752&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114899863067663752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114899863067663752'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/how-to-set-up-thinclient-in-linux.html' title='How to set up thinclient in Linux'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114898056960314421</id><published>2006-05-30T14:46:00.000+05:30</published><updated>2007-04-17T21:00:30.738+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>C++ Programs [Interview]</title><content type='html'>&lt;p class="mobile-post"&gt;&lt;span style="font-weight: bold; color: rgb(51, 204, 0);"&gt;Find the number which is odd number of times? [Interview] &lt;/span&gt;&lt;br /&gt;Dated: Wed Dec 28 22:44:42 IST 2005&lt;/p&gt;&lt;p class="mobile-post"&gt;14  int findodd(int *n,int len)&lt;br /&gt;15  {&lt;br /&gt;16          int num=0;&lt;br /&gt;17          for(int i=0;i&amp;lt;len;i++)&lt;br /&gt;18                  num^=n[i];&lt;br /&gt;19          return num;&lt;br /&gt;20  }&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="font-weight: bold; color: rgb(51, 204, 0);"&gt;How would u sort of 0s and 1s in just single pass? [Interview]&lt;/span&gt;&lt;br /&gt;Dated: Wed Dec 28 22:27:42 IST 2005&lt;/p&gt;&lt;p class="mobile-post"&gt; 1  void sort_01 (int *n,int len)&lt;br /&gt;2  {&lt;br /&gt;3          int i=0,j=len-1;&lt;br /&gt;4          while(1){&lt;br /&gt;5                  while((!n[i])&amp;&amp;amp;(i&amp;lt;len))   i++;&lt;br /&gt;6                  while((n[j])&amp;&amp;amp;(j&amp;gt;-1))     j--;&lt;br /&gt;7                  if(i&amp;gt;=j) break;&lt;br /&gt;8                  n[i]=~n[i]&amp;amp;1;&lt;br /&gt;9                  n[j]=~n[j]&amp;1;&lt;br /&gt;10                  i++;j--;&lt;br /&gt;11          }&lt;br /&gt;12  }&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="font-weight: bold; color: rgb(51, 204, 0);"&gt;Find all possible splits for any given number n. [Interview]&lt;/span&gt;&lt;br /&gt;Dated: Wed Dec 28 21:33:48 IST 2005&lt;/p&gt;&lt;p class="mobile-post"&gt;Init   : int array[5]={0,0,0,0,0};&lt;br /&gt;Function Call  : split(array,5,0);&lt;/p&gt;&lt;p class="mobile-post"&gt; 1  void split(int *n,int count,int len)&lt;br /&gt;2  {&lt;br /&gt;3     if(count==1) {&lt;br /&gt;4             int i;&lt;br /&gt;5             for(i=0;i&amp;lt;len;i++)&lt;br /&gt;6                     printf("%d+",n[i]);&lt;br /&gt;7             printf("%d\n",n[i]+1);&lt;br /&gt;8             return;&lt;br /&gt;9     }&lt;br /&gt;10     else {&lt;br /&gt;11             n[len]+=1;&lt;br /&gt;12             split(n,count-1,len);&lt;br /&gt;13             split(n,count-1,len+1);&lt;br /&gt;14             n[len]-=1;&lt;br /&gt;15     }&lt;br /&gt;16     return ;&lt;br /&gt;17  }&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="font-weight: bold; color: rgb(51, 204, 0);"&gt;WAP to check a integer (as binary string) is pallindrome? [Interview]&lt;/span&gt;&lt;br /&gt;Dated: Wed Dec 28 18:27:43 IST 2005&lt;/p&gt;&lt;p class="mobile-post"&gt; 1  bool panlindrome(unsigned long i)&lt;br /&gt;2  {&lt;br /&gt;3          if(!(i&amp;1)) return false;&lt;br /&gt;4          unsigned long t=i,rev=1;&lt;br /&gt;5          t&amp;gt;&amp;gt;=1;&lt;br /&gt;6          while(t) {&lt;br /&gt;7                  rev&amp;lt;&amp;lt;=1;&lt;br /&gt;8                  if(t&amp;amp;1) rev |=1;&lt;br /&gt;9                  t &amp;gt;&amp;gt;=1;&lt;br /&gt;10          }&lt;br /&gt;11          if(rev==i) return true;&lt;br /&gt;12          return false;&lt;br /&gt;13  }&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="font-weight: bold; color: rgb(51, 204, 0);"&gt;Find the number of ones in an integer? [Interview]&lt;/span&gt;&lt;br /&gt;Dated: Wed Dec 28 18:17:14 IST 2005&lt;/p&gt;&lt;p class="mobile-post"&gt;1  unsigned noofone(unsigned long i)&lt;br /&gt;2  {&lt;br /&gt;3          int count=0;&lt;br /&gt;4          while(i) i=i&amp;amp;(~(i&amp;(~i+1))),count++;&lt;br /&gt;5          return count;&lt;br /&gt;6  }&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="font-weight: bold; color: rgb(51, 204, 0);"&gt;WAP to convert a given integer to octal number? [Interview]&lt;/span&gt;&lt;br /&gt;Dated: Wed Dec 28 17:45:04 IST 2005&lt;/p&gt;&lt;p class="mobile-post"&gt; 1  #include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;2  void int2octal (unsigned long i)&lt;br /&gt;3  {&lt;br /&gt;4          if(i) {&lt;br /&gt;5                  unsigned long o = i&amp;amp;7;&lt;br /&gt;6                  i&amp;gt;&amp;gt;=3;&lt;br /&gt;7                  int2octal(i);&lt;br /&gt;8                  printf("%d",o);&lt;br /&gt;9          }&lt;br /&gt;10          else printf("0");&lt;br /&gt;11  }&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;span style="font-weight: bold; color: rgb(51, 204, 0);"&gt;How to reverse a singly-linked list? [Interview]&lt;/span&gt;&lt;br /&gt;Dated: Tue Dec 27 06:49:35 IST 2005&lt;/p&gt;&lt;p class="mobile-post"&gt; 1  node* reverse_list(node *list)&lt;br /&gt;2  {&lt;br /&gt;3      node *rev=NULL;&lt;br /&gt;4      while(list !=NULL) {&lt;br /&gt;5          node *t = list-&amp;gt;next;&lt;br /&gt;6          list-&amp;gt;next = rev;&lt;br /&gt;7          rev = list;&lt;br /&gt;8          list = t;&lt;br /&gt;9      }&lt;br /&gt;10     return rev;&lt;br /&gt;11  }&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114898056960314421?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/114898056960314421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=114898056960314421&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114898056960314421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114898056960314421'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/c-programs-interview.html' title='C++ Programs [Interview]'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114898037795123968</id><published>2006-05-30T14:42:00.000+05:30</published><updated>2007-04-17T20:57:20.233+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>How To Speed Up Firefox [Howto]</title><content type='html'>&lt;p class="mobile-post"&gt;Here's something for broadband people that will really speed Firefox up:&lt;/p&gt;&lt;p class="mobile-post"&gt;1.Type "about:config" into the address bar and hit return. Scroll down and&lt;br /&gt;look for the following entries:&lt;/p&gt;&lt;p class="mobile-post"&gt;network.http.pipelining network.http.proxy.pipelining&lt;br /&gt;network.http.pipelining.maxrequests&lt;/p&gt;&lt;p class="mobile-post"&gt;Normally the browser will make one request to a web page at a time. When you&lt;br /&gt;enable pipelining it will make several at once, which really speeds up page&lt;br /&gt;loading.&lt;/p&gt;&lt;p class="mobile-post"&gt;2. Alter the entries as follows:&lt;/p&gt;&lt;p class="mobile-post"&gt;Set "network.http.pipelining" to "true"&lt;/p&gt;&lt;p class="mobile-post"&gt;Set "network.http.proxy.pipelining" to "true"&lt;/p&gt;&lt;p class="mobile-post"&gt;Set "network.http.pipelining.maxrequests" to some number like 30. This means&lt;br /&gt;it will make 30 requests at once.&lt;/p&gt;&lt;p class="mobile-post"&gt;3. Lastly right-click anywhere and select New-&amp;gt; Integer. Name it&lt;br /&gt;"nglayout.initialpaint.delay" and set its value to "0". This value is the&lt;br /&gt;amount of time the browser waits before it acts on information it recieves.&lt;/p&gt;&lt;p class="mobile-post"&gt;If you're using a broadband connection you'll load pages MUCH faster now!&lt;/p&gt;&lt;p class="mobile-post"&gt;Vaibhav.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114898037795123968?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/114898037795123968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=114898037795123968&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114898037795123968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114898037795123968'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/how-to-speed-up-firefox-howto.html' title='How To Speed Up Firefox [Howto]'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114898030570688489</id><published>2006-05-30T14:41:00.000+05:30</published><updated>2007-04-17T20:57:20.234+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>How to Export sound in Linux [Howto]</title><content type='html'>&lt;p class="mobile-post"&gt;Exporting sound :-&lt;/p&gt;&lt;p class="mobile-post"&gt;Run 'artsd -n -u -p 5001' on system on which u want to hear sound.&lt;br /&gt;Run 'export ARTS_SERVER=ip_of_system_on_which_sound_it_to_be_heard:5001'&lt;br /&gt;          on system where sound application will be run (like mplayer)&lt;br /&gt;Run 'mplayer -ao arts soundfile.mp3'&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114898030570688489?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/114898030570688489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=114898030570688489&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114898030570688489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114898030570688489'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/how-to-export-sound-in-linux-howto.html' title='How to Export sound in Linux [Howto]'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114891264890937665</id><published>2006-05-29T19:54:00.000+05:30</published><updated>2007-04-17T20:52:38.949+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><title type='text'>Vim Movements</title><content type='html'>&lt;p class="mobile-post"&gt;Moving Around&lt;br /&gt; 	 k (up),&lt;br /&gt; h(left)	 l (right).&lt;br /&gt;	j (down)&lt;br /&gt;(Ex 5k,j,3l )&lt;/p&gt;&lt;p class="mobile-post"&gt;Word Movement&lt;br /&gt;w  (Forward Word Movement Ex. f,5f )&lt;br /&gt;b  (Backword Word Movement Ex. b,2b)&lt;br /&gt;e  (Forward Word Movement at the end of word Ex. e,3e  )	&lt;br /&gt;ge (Backword Word Movement at the end of word Ex. ge,3ge )&lt;/p&gt;&lt;p class="mobile-post"&gt;Moving to the Start or End of a Line&lt;br /&gt;$(End Of Line Ex. $,2$)&lt;br /&gt;^(Start Of Line Ex. ^,3^)&lt;/p&gt;&lt;p class="mobile-post"&gt;Searching Along a Single Line&lt;br /&gt;f&amp;lt;Charcter&amp;gt; (Searching Charcter Forward Ex. fa, 2fv)&lt;br /&gt;F&amp;lt;Charcter&amp;gt; (Searching Charcter Backword Ex. Fg,2Ft)&lt;br /&gt;t&amp;lt;Charcter&amp;gt; (Search till Forward )&lt;br /&gt;T&amp;lt;Charcter&amp;gt; (Search till Backword)&lt;/p&gt;&lt;p class="mobile-post"&gt;Moving to a Specific Line&lt;br /&gt;&amp;lt;Line No.&amp;gt;G  (Go to Line No.)&lt;br /&gt;CTRL-G   	(Where I am in the File)&lt;br /&gt;g CTRL-G 	(Count col, line, words and bytes)&lt;br /&gt;CTRL-O       Jump to previous location.&lt;br /&gt;&amp;lt;TAB&amp;gt;        Jump to next location (line 10).&lt;/p&gt;&lt;p class="mobile-post"&gt;Where are you in File&lt;br /&gt;:set number&lt;br /&gt;:set nonumber&lt;/p&gt;&lt;p class="mobile-post"&gt;Scrolling Up and Down&lt;br /&gt;CTRL-U   (scrolls up half a screen of text.)&lt;br /&gt;CTRL-Y   (scrolls up a line of text.)&lt;br /&gt;CTRL-B   (scrolls up a entire screen at a time.)&lt;br /&gt;CTRL-D   (scrolls down half a screen of text.)&lt;br /&gt;CTRL-E   (scrolls down one line.)&lt;br /&gt;CTRL-F   (scrolls down one screen of text.)&lt;br /&gt;z&amp;lt;Enter&amp;gt; (screen line on the top)&lt;br /&gt;88z&amp;lt;Enter&amp;gt; positions line 88 at the top.&lt;br /&gt;zt       (Leaves the cursor where it is.)&lt;br /&gt;z-       (scrolls line to the end of the screen)&lt;br /&gt;zb       (Leaves the cursor where it is)&lt;br /&gt;z.       (Center of the screen)&lt;br /&gt;zz       (Leaves the cursor where it is .)&lt;/p&gt;&lt;p class="mobile-post"&gt;:set scroll=10&lt;br /&gt;:set scrolljump=5&lt;br /&gt;:set scrolloff=3&lt;/p&gt;&lt;p class="mobile-post"&gt;Deleting&lt;br /&gt;x  delete character under the cursor (short for "dl")&lt;br /&gt;X  delete character before the cursor (short for "dh")&lt;br /&gt;dw (Delete Word Ex. dw,3dw,d3w,3d2w,d$,d^,df&amp;gt; )&lt;br /&gt;dd (Delete Line Ex. dd,3dd)&lt;br /&gt;D  (Delete up to end of line. )(short for "d$")&lt;br /&gt;diw     delete word under the cursor (excluding white space)&lt;br /&gt;daw     delete word under the cursor (including white space)&lt;br /&gt;dG      delete until the end of the file&lt;br /&gt;dgg     delete until the start of the file&lt;/p&gt;&lt;p class="mobile-post"&gt;Arthemetic&lt;br /&gt;CTRL-A  Incrmenting Number (123, 0177, 0x1f,-98)&lt;br /&gt;CTRL-X  Decrementing Number&lt;/p&gt;&lt;p class="mobile-post"&gt;:set nrformats=""&lt;/p&gt;&lt;p class="mobile-post"&gt;Changing Text&lt;br /&gt;cw (Change Word Ex cw,c2w)&lt;br /&gt;C  stands for  c$  (change to end of the line)&lt;br /&gt;s  stands for  cl  (change one character)&lt;br /&gt;S  stands for  cc  (change a whole line)&lt;/p&gt;&lt;p class="mobile-post"&gt;The . Command&lt;br /&gt;It repeats the last delete or change command.&lt;/p&gt;&lt;p class="mobile-post"&gt;Joining Lines&lt;br /&gt;J       (Join Lines to One. Ex J,3J)&lt;br /&gt;gJ      (Join Lines without Spaces)&lt;/p&gt;&lt;p class="mobile-post"&gt;Replacing Charcter&lt;br /&gt;r&amp;lt;Charcter&amp;gt; (Replace Charater Under Cursour. Ex. ru,5ra,3r&amp;lt;Enter&amp;gt; )&lt;br /&gt;R&amp;lt;Charcter&amp;gt;&lt;/p&gt;&lt;p class="mobile-post"&gt;Changing Case&lt;br /&gt;~               (Change Case of Character Ex. ~,12~,~fq)&lt;br /&gt;U       	(Make the text Uppercase)&lt;br /&gt;u       	(Make the text Lowercase)&lt;br /&gt;g~motion        (It does not depend on tildeop)&lt;br /&gt;g~~ or g~g~     (Changes case of whole line)&lt;br /&gt;gUmotion        (All uppercase)&lt;br /&gt;gUU             (Changes to uppercase for whole line)&lt;br /&gt;gUw		(Changes to uppercase for word)&lt;br /&gt;guw		(Changes to lowercase for word)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114891264890937665?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891264890937665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891264890937665'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/vim-movements.html' title='Vim Movements'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114891196456621303</id><published>2006-05-29T19:42:00.000+05:30</published><updated>2007-04-17T20:58:01.795+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>How to set up ssh keys for Linux</title><content type='html'>&lt;p class="mobile-post"&gt;How to set up ssh keys for Linux&lt;/p&gt;&lt;p class="mobile-post"&gt;1. Run "ssh-keygen -t dsa" on the machine which is the client.&lt;br /&gt;   Files Generated : 	&lt;br /&gt;	$(HOME)/.ssh/id_dsa     : Your private Key&lt;br /&gt;	$(HOME)/.ssh/id_dsa.pub : Your public Key&lt;br /&gt;   You can enter empty passphrase.&lt;br /&gt;   Type can rsa and dsa for version 2 and rsa1 for version 1.&lt;br /&gt;2. Now ssh into the server.You need to type password this time.&lt;br /&gt;   you have to transfer the publickey to server.	&lt;br /&gt;   cd $(HOME)/.ssh&lt;br /&gt;   cat $(HOME)/.ssh/id_dsa.pub &amp;gt;&amp;gt; authorized_keys2&lt;/p&gt;&lt;p class="mobile-post"&gt;   Note : Don't introduce any extra spaces, slashes or any other characters&lt;br /&gt;   If the file already exists, append the output of id_dsa.pub to EOF.&lt;/p&gt;&lt;p class="mobile-post"&gt;3. Repeat for Other machine if you want.&lt;br /&gt;4. Now you can login without entering passwords.&lt;br /&gt;   On some machines, it might ask you to verify the host key,&lt;br /&gt;   but will happen only for the first time.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114891196456621303?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891196456621303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891196456621303'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/how-to-set-up-ssh-keys-for-linux.html' title='How to set up ssh keys for Linux'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114891187335028730</id><published>2006-05-29T19:41:00.000+05:30</published><updated>2007-04-17T20:58:01.795+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>Changing MySQL root password</title><content type='html'>&lt;p class="mobile-post"&gt;Changing MySQL root password&lt;/p&gt;&lt;p class="mobile-post"&gt;Sometimes you forget the root password, or something went wrong&lt;br /&gt;modifying it. Here's how to reset the root password for mysql on a&lt;br /&gt;Redhat Linux box:&lt;/p&gt;&lt;p class="mobile-post"&gt;[root@host root]#killall mysqld&lt;br /&gt;[root@host root]#/usr/libexec/mysqld -Sg --user=root &amp;amp;&lt;br /&gt;[root@host root]# mysql&lt;br /&gt;Welcome to the MySQL monitor. Commands end with ; or g.&lt;br /&gt;Your MySQL connection id is 1 to server version: 3.xx.xx&lt;br /&gt;Type 'help;' or 'h' for help. Type 'c' to clear the buffer.&lt;br /&gt;mysql&amp;gt; USE mysql&lt;/p&gt;&lt;p class="mobile-post"&gt;Reading table information for completion of table and column names&lt;br /&gt;You can turn off this feature to get a quicker startup with -A&lt;/p&gt;&lt;p class="mobile-post"&gt;Database changed&lt;br /&gt;mysql&amp;gt; UPDATE user&lt;br /&gt;-&amp;gt; SET password=password("newpassword")&lt;br /&gt;-&amp;gt; WHERE user="root";&lt;br /&gt;Query OK, 2 rows affected (0.03 sec)&lt;br /&gt;Rows matched: 2 Changed: 2 Warnings: 0&lt;br /&gt;mysql&amp;gt; flush privileges;&lt;br /&gt;Query OK, 0 rows affected (0.02 sec)&lt;br /&gt;mysql&amp;gt; exit;&lt;br /&gt;[root@host root]#killall mysqld&lt;/p&gt;&lt;p class="mobile-post"&gt;Then start MySQL again:&lt;/p&gt;&lt;p class="mobile-post"&gt;/etc/init.d/mysqld start&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114891187335028730?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891187335028730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891187335028730'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/changing-mysql-root-password.html' title='Changing MySQL root password'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114891180041356584</id><published>2006-05-29T19:40:00.000+05:30</published><updated>2007-04-17T21:00:58.851+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>Makefile for c++ project</title><content type='html'>&lt;p class="mobile-post"&gt;#---------------------------------------------------------------#&lt;br /&gt;# Written By Vaibhav Gupta&lt;br /&gt;#---------------------------------------------------------------#&lt;br /&gt;# TARGETS:&lt;br /&gt;#        wire        - default target&lt;br /&gt;#        dwire       - debug target&lt;br /&gt;#        tag         - For generating tag file&lt;br /&gt;#        clean/fresh - clean obj files.&lt;br /&gt;#---------------------------------------------------------------#&lt;br /&gt;#-- Customized variables&lt;br /&gt;BINDIR=bin&lt;br /&gt;OBJDIR=obj&lt;br /&gt;SRCDIR=src&lt;br /&gt;INCDIR=include&lt;/p&gt;&lt;p class="mobile-post"&gt;CC     = g++&lt;br /&gt;CWARN  =  -W -Wall -Wshadow -Wimplicit -Wreturn-type           -Wcomment -Wtrigraphs -Wformat -Wparentheses           -Wpointer-arith -Wuninitialized -O&lt;/p&gt;&lt;p class="mobile-post"&gt;CDBG   = -g $(CWARN) -fno-inline&lt;br /&gt;CFLAGS = -I$(INCDIR) $(CDBG)&lt;br /&gt;DFLAGS = -I$(INCDIR) -g $(CWARN) -fno-inline -DDEBUG=1&lt;/p&gt;&lt;p class="mobile-post"&gt;CTAG    = ctags&lt;br /&gt;CTAGFILE = filelist&lt;br /&gt;# src, object and bin files&lt;br /&gt;TGT=wire&lt;br /&gt;#Debug Target&lt;br /&gt;DBGTGT=dwire&lt;/p&gt;&lt;p class="mobile-post"&gt;HEADERS = $(INCDIR)/global.h&lt;/p&gt;&lt;p class="mobile-post"&gt;COMMONOBJS = $(OBJDIR)/BaseStation.o $(OBJDIR)/SubscriberStation.o&lt;br /&gt;$(OBJDIR)/Packet.o 		$(OBJDIR)/Queue.o $(OBJDIR)/Global.o $(OBJDIR)/Simulate.o&lt;/p&gt;&lt;p class="mobile-post"&gt;OBJS = $(COMMONOBJS)  $(OBJDIR)/main.o&lt;br /&gt;DBGOBJS =  $(COMMONOBJS) $(OBJDIR)/main.dbg.o&lt;/p&gt;&lt;p class="mobile-post"&gt;#-- Rules&lt;br /&gt;all: $(TGT)&lt;br /&gt;dbg: $(DBGTGT)&lt;/p&gt;&lt;p class="mobile-post"&gt;$(TGT): $(BINDIR)/$(TGT)&lt;br /&gt;	@echo "$@ uptodate"&lt;/p&gt;&lt;p class="mobile-post"&gt;$(DBGTGT): $(BINDIR)/$(DBGTGT)&lt;br /&gt;	@echo "$@ uptodate"&lt;/p&gt;&lt;p class="mobile-post"&gt;$(BINDIR)/$(DBGTGT): $(DBGOBJS)&lt;br /&gt;	$(CC) $(CFLAGS) -o $@ $(DBGOBJS)&lt;/p&gt;&lt;p class="mobile-post"&gt;$(OBJDIR)/%.dbg.o: $(SRCDIR)/%.cpp&lt;br /&gt;	$(CC) $(CFLAGS) -DDEBUG=1 -c -o $@ $?&lt;/p&gt;&lt;p class="mobile-post"&gt;$(BINDIR)/$(TGT): $(OBJS)&lt;br /&gt;	$(CC) $(CFLAGS) -o $@ $(OBJS)&lt;/p&gt;&lt;p class="mobile-post"&gt;$(OBJDIR)/%.o: $(SRCDIR)/%.cpp&lt;br /&gt;	$(CC) $(CFLAGS) -c -o $@ $?&lt;/p&gt;&lt;p class="mobile-post"&gt;.PHONY : clean depend fresh&lt;br /&gt;tag :&lt;br /&gt;	find src/*.cpp include/*.h &amp;gt; filelist&lt;br /&gt;	$(CTAG) -L $(CTAGFILE)&lt;/p&gt;&lt;p class="mobile-post"&gt;clean :&lt;br /&gt;	-rm -f $(OBJDIR)/*.o $(PARSE_C) $(PARSE_H)&lt;br /&gt;	-rm -f $(SRCDIR)/*.output $(LEX_C)&lt;br /&gt;	-rm -f */*~ *~ core&lt;br /&gt;	-rm -f $(BINDIR)/$(TGT) $(BINDIR)/$(DBGTGT)&lt;/p&gt;&lt;p class="mobile-post"&gt;fresh : clean all&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114891180041356584?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891180041356584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891180041356584'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/makefile-for-c-project.html' title='Makefile for c++ project'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114891155548493672</id><published>2006-05-29T19:35:00.000+05:30</published><updated>2007-04-17T20:57:37.910+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>Picking a random quote or signature from a file [perl]</title><content type='html'>&lt;p class="mobile-post"&gt;Generates a Random  Signature from a signature file&lt;/p&gt;&lt;p class="mobile-post"&gt;script&lt;br /&gt;--------&lt;/p&gt;&lt;p class="mobile-post"&gt;#!/usr/bin/perl&lt;br /&gt;&amp;amp;pick_quote;&lt;br /&gt;sub pick_quote {&lt;br /&gt;    my $path = "/usr/signature/";&lt;br /&gt;    my $sigfile = "$path/signature.txt"; # Signature FILE&lt;br /&gt;    open (SIGS, "&amp;lt; $sigfile" )		or die "can't open $sigfile";&lt;br /&gt;    local $/  = "%%\n";&lt;br /&gt;    local $_;&lt;br /&gt;    my $quip;&lt;br /&gt;    rand($.) &amp;lt; 1 &amp;amp;&amp;amp; ($quip = $_) while &amp;lt;SIGS&amp;gt;;&lt;br /&gt;    close SIGS;&lt;br /&gt;    chomp $quip;&lt;br /&gt;    print $quip || "ENOSIG: This signature file is empty.\n";&lt;br /&gt;}&lt;/p&gt;&lt;p class="mobile-post"&gt;Sample Signature File&lt;br /&gt;---------------------------------&lt;/p&gt;&lt;p class="mobile-post"&gt;Signatures are a waste of bandwidth.&lt;br /&gt;%%&lt;br /&gt;Help stamp out signatures.&lt;br /&gt;%%&lt;br /&gt;'Calm down -- it's only ones and zeros.'&lt;br /&gt;%%&lt;br /&gt;According to my calculations the problem doesn't exist.&lt;br /&gt;%%&lt;br /&gt;A day for firm decisions!!!!!  Or is it?&lt;br /&gt;%%&lt;br /&gt;A few hours grace before the madness begins again.&lt;br /&gt;%%&lt;br /&gt;A gift of a flower will soon be made to you.&lt;br /&gt;%%&lt;br /&gt;A long-forgotten loved one will appear soon.&lt;/p&gt;&lt;p class="mobile-post"&gt;Buy the negatives at any price.&lt;br /&gt;%%&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114891155548493672?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891155548493672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891155548493672'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/picking-random-quote-or-signature-from.html' title='Picking a random quote or signature from a file [perl]'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114891087042332767</id><published>2006-05-29T19:24:00.000+05:30</published><updated>2007-04-17T20:57:20.234+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>Linux Tips</title><content type='html'>&lt;p class="mobile-post"&gt;------------------------------------------------------------------------------------&lt;br /&gt;Who is SUPER USER in linux&lt;/p&gt;&lt;p class="mobile-post"&gt;awk -F: '$3 == 0{print $1,"superuser!"}' /etc/passwd&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;How to get Environment for a process&lt;br /&gt;If the process id is 920.&lt;/p&gt;&lt;p class="mobile-post"&gt;(cat /proc/920/environ; echo) : tr "\000" "\n"&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;How to list files with their complete path&lt;br /&gt;If 'childdir' is the name of directory.&lt;/p&gt;&lt;p class="mobile-post"&gt;find childdir -type f -printf "%AY%Am%Ad%AH%AM %p\n" : sort -r : gawk&lt;br /&gt;'{print $2}'&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;How to find open files in linux&lt;/p&gt;&lt;p class="mobile-post"&gt;find /proc -regex "/proc/[0-9]*/fd/.*" -ls&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;Formatting man pages&lt;/p&gt;&lt;p class="mobile-post"&gt;man ls : col -bx &amp;gt; myfile.txt&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;Finding the biggest files&lt;/p&gt;&lt;p class="mobile-post"&gt;ls -l : sort +4n&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;Searching files for content&lt;/p&gt;&lt;p class="mobile-post"&gt;find / -name "filename" : xargs grep -n content&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;Largest Directories&lt;/p&gt;&lt;p class="mobile-post"&gt;du -kx : egrep -v "\./.+/" : sort -n&lt;br /&gt;-----------------------------------------------------------------------------------&lt;br /&gt;List today's files only&lt;/p&gt;&lt;p class="mobile-post"&gt;ls -al --time-style +%D : grep `date +%D`&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;Encrypt some plain text&lt;/p&gt;&lt;p class="mobile-post"&gt;perl -e 'print crypt("ke", "password");'&lt;br /&gt;-----------------------------------------------------------------------------------&lt;br /&gt;Look for unusual SUID root files&lt;/p&gt;&lt;p class="mobile-post"&gt;find / -uid 0 -perm -4000 -print&lt;br /&gt;-----------------------------------------------------------------------------------&lt;br /&gt;Look for unusual large files (&amp;gt; 10 Mb)&lt;/p&gt;&lt;p class="mobile-post"&gt;find / -size +10000k -print&lt;br /&gt;-----------------------------------------------------------------------------------&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114891087042332767?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891087042332767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891087042332767'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/linux-tips.html' title='Linux Tips'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114891046315678010</id><published>2006-05-29T19:17:00.000+05:30</published><updated>2007-04-17T20:57:20.235+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>Linux Command Line Tips</title><content type='html'>&lt;a href="http://www.pixelbeat.org/cmdline.html"&gt;Linux Command Line Tips&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.pixelbeat.org/timeline.html"&gt;http://www.pixelbeat.org/timeline.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114891046315678010?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891046315678010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114891046315678010'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/linux-command-line-tips.html' title='Linux Command Line Tips'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114890868813363884</id><published>2006-05-29T18:48:00.000+05:30</published><updated>2007-04-17T20:52:38.949+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><title type='text'>Vim Folding Tips</title><content type='html'>&lt;p class="mobile-post"&gt;# folding : hide sections to allow easier comparisons&lt;/p&gt;&lt;p class="mobile-post"&gt;zf{motion} or {Visual}zf :Operator to create a fold.&lt;br /&gt;zf'a : fold to mark&lt;br /&gt;zF :Create a fold for N lines.&lt;br /&gt;zd :Delete one fold at the cursor.&lt;br /&gt;zD :Delete folds recursively at the cursor.&lt;br /&gt;zE :Eliminate all folds in the window.&lt;br /&gt;zo :Open one fold.&lt;br /&gt;zO :Open all folds recursively.&lt;br /&gt;zc :Close one fold.&lt;br /&gt;zC :Close all folds recursively.&lt;br /&gt;za :When on a closed fold: open it.and vice-versa.&lt;br /&gt;zA :When on a closed fold: open it recursively.and vice-versa.&lt;br /&gt;zR :Open all folds.&lt;br /&gt;zM :Close all folds:&lt;br /&gt;zn :Fold none: reset 'foldenable'. All folds will be open.&lt;br /&gt;zN :Fold normal: set 'foldenable'. All folds will be as they were before.&lt;br /&gt;zi :Invert 'foldenable'.&lt;/p&gt;&lt;p class="mobile-post"&gt;[z :Move to the start of the current open fold.&lt;br /&gt;]z :Move to the end of the current open fold.&lt;br /&gt;zj :Move downwards. to the start of the next fold.&lt;br /&gt;zk :Move upwards to the end of the previous fold.&lt;/p&gt;&lt;p class="mobile-post"&gt;My vimrc: Open a c/cpp/java/perl programm. Press &amp;lt;F6&amp;gt; and see the power of&lt;br /&gt;vim :-)&lt;/p&gt;&lt;p class="mobile-post"&gt;nmap &amp;lt;F6&amp;gt; /}&amp;lt;CR&amp;gt;zf%&amp;lt;ESC&amp;gt;:nohlsearch&amp;lt;CR&amp;gt;&lt;/p&gt;&lt;p class="mobile-post"&gt;Vaibhav.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114890868813363884?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890868813363884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890868813363884'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/vim-folding-tips.html' title='Vim Folding Tips'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114890864018003282</id><published>2006-05-29T18:47:00.000+05:30</published><updated>2007-04-17T20:57:20.235+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>How to Search in Google</title><content type='html'>&lt;p class="mobile-post"&gt;How to Search in Google&lt;/p&gt;&lt;p class="mobile-post"&gt;1. allintitle: graph partition triangle&lt;br /&gt;2. +("index of") +("/ebooks":"/book") +(chm:pdf:zip:rar) +apache&lt;br /&gt;3. allinurl: +(rar:chm:zip:pdf:tgz) TheTitle&lt;br /&gt;4. allinurl:config.txt site:.jp&lt;br /&gt;5. allinurl:admin.txt site:.edu&lt;br /&gt;6. "Index of /something"&lt;br /&gt;7. filetype:doc site:edu&lt;span class="" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="mobile-post"&gt;Links:-&lt;/p&gt;&lt;p class="mobile-post"&gt;&lt;a href="http://www.googleguide.com/advanced_operators_reference.html"&gt;http://www.googleguide.com/advanced_operators_reference.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.google.com/help/operators.html"&gt;http://www.google.com/help/operators.html&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114890864018003282?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890864018003282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890864018003282'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/how-to-search-in-google.html' title='How to Search in Google'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114890855943582559</id><published>2006-05-29T18:45:00.001+05:30</published><updated>2007-04-17T20:54:41.385+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><title type='text'>Vim and HTML</title><content type='html'>&lt;p class="mobile-post"&gt;HTML and vim Tips:&lt;/p&gt;&lt;p class="mobile-post"&gt;:runtime! syntax/2html.vim :convert txt to html&lt;br /&gt;:%s#&amp;lt;[^&amp;gt;]\+&amp;gt;##g : delete html tags, leave text&lt;/p&gt;&lt;p class="mobile-post"&gt;My vim.rc : Type a word and press ",," without quote&lt;/p&gt;&lt;p class="mobile-post"&gt;imap &amp;lt;silent&amp;gt; ,, &amp;lt;ESC&amp;gt;"_yiw:s/\(\%#\w\+\)/&amp;lt;\1&amp;gt; &amp;lt;\\\1&amp;gt;/&amp;lt;cr&amp;gt;&amp;lt;c-o&amp;gt;&amp;lt;c-l&amp;gt;f&amp;gt;a&lt;/p&gt;&lt;p class="mobile-post"&gt;Vaibhav.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114890855943582559?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890855943582559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890855943582559'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/vim-and-html.html' title='Vim and HTML'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114890852784818088</id><published>2006-05-29T18:45:00.000+05:30</published><updated>2007-04-17T20:55:51.487+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>Extract links from a file [perl]</title><content type='html'>&lt;p class="mobile-post"&gt;How to extractlinks from a file&lt;/p&gt;&lt;p class="mobile-post"&gt;#!/usr/bin/perl&lt;br /&gt;use HTML::SimpleLinkExtor;&lt;br /&gt;my $file = new HTML::SimpleLinkExtor();&lt;/p&gt;&lt;p class="mobile-post"&gt;# Extracts Links from a HTML File&lt;br /&gt;# Written by Vaibhav Gupta guptav@cse.iitb.ac.in&lt;br /&gt;$filename = $ARGV[0];&lt;br /&gt;$url = $ARGV[1]; #base url else empty string&lt;/p&gt;&lt;p class="mobile-post"&gt;if($filename eq "" ) {&lt;br /&gt;print "\nUsages: ./extractlink.pl filename.html\n";&lt;br /&gt;exit ;&lt;br /&gt;}&lt;/p&gt;&lt;p class="mobile-post"&gt;$file-&amp;gt;parse_file($filename);&lt;br /&gt;my @links= $file-&amp;gt;a;&lt;br /&gt;foreach $link (@links){&lt;br /&gt;chomp;&lt;br /&gt;print "$url$link\n";&lt;br /&gt;}&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114890852784818088?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890852784818088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890852784818088'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/extract-links-from-file-perl.html' title='Extract links from a file [perl]'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114890836548748306</id><published>2006-05-29T18:42:00.000+05:30</published><updated>2007-04-17T20:55:34.900+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>Networking Hacks</title><content type='html'>&lt;p style="color: rgb(51, 204, 0); font-weight: bold;" class="mobile-post"&gt;&lt;span style="font-size:130%;"&gt;How to chat without using talk&lt;/span&gt;&lt;/p&gt;&lt;p class="mobile-post"&gt;At Server side:&lt;br /&gt;nc -l -p 5600 -vv&lt;br /&gt;At client Side:&lt;br /&gt;nc 10.100.116.37 5600&lt;/p&gt;&lt;p class="mobile-post"&gt;Here 10.100.116.37 is the ip of server. 5600 is the port.&lt;/p&gt;&lt;p style="color: rgb(51, 204, 0); font-weight: bold;" class="mobile-post"&gt;&lt;span style="font-size:130%;"&gt;How to transfer file with out using ftp&lt;/span&gt;&lt;/p&gt;&lt;p class="mobile-post"&gt;At Server Side:&lt;br /&gt;nc -v -w 30 -p 5600 -l &amp;gt; filename.back&lt;br /&gt;At Client Side:&lt;br /&gt;nc -v -w 2 10.100.116.37 5600 &amp;lt; filename&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114890836548748306?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890836548748306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890836548748306'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/networking-hacks.html' title='Networking Hacks'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114890830834438605</id><published>2006-05-29T18:41:00.000+05:30</published><updated>2007-04-17T20:55:34.900+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>How to mail using telnet</title><content type='html'>&lt;p class="mobile-post"&gt;C: client&lt;br /&gt;S: Server&lt;/p&gt;&lt;p class="mobile-post"&gt;C:telnet smtp.iitb.ac.in 25&lt;br /&gt;S:220 smtp2.iitb.ac.in ESMTP&lt;br /&gt;C:helo&lt;br /&gt;S:250 smtp2.iitb.ac.in&lt;br /&gt;C:mail from:&amp;lt;root@10.100.106.50&amp;gt;&lt;br /&gt;S:250 ok&lt;br /&gt;C:rcpt to:&amp;lt;guptav@cse.iitb.ac.in&amp;gt;&lt;br /&gt;S:250 ok&lt;br /&gt;C:data&lt;br /&gt;S:354 go ahead&lt;br /&gt;C:Subject: This is subject line.&lt;br /&gt;C:hi vaibhav,&lt;br /&gt;C:how r u? i m fine.&lt;br /&gt;C:bye for now&lt;br /&gt;C:vaibhav&lt;br /&gt;C:.&lt;br /&gt;S:250 ok 1095622024 qp 2471&lt;br /&gt;S:502 unimplemented (#5.5.1)&lt;br /&gt;C:quit&lt;br /&gt;S:221 smtp2.iitb.ac.in&lt;br /&gt;S:Connection closed by foreign host.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114890830834438605?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890830834438605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890830834438605'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/how-to-mail-using-telnet.html' title='How to mail using telnet'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114890818596769951</id><published>2006-05-29T18:39:00.000+05:30</published><updated>2007-04-17T20:55:34.901+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>SMTP Commands</title><content type='html'>&lt;p class="mobile-post"&gt;SMTP commands are ASCII messages sent between SMTP hosts.&lt;/p&gt;&lt;p class="mobile-post"&gt;*Command: Description&lt;br /&gt;*DATA: Begins message composition.&lt;br /&gt;*EXPN &amp;lt;string&amp;gt; : Returns names on the specified mail list.&lt;br /&gt;*HELO &amp;lt;domain&amp;gt; : Returns identity of mail server.&lt;br /&gt;*HELP &amp;lt;command&amp;gt;: Returns information on the specified command.&lt;br /&gt;*MAIL FROM &amp;lt;host&amp;gt; : Initiates a mail session from host.&lt;br /&gt;*NOOP : Causes no action, except acknowledgement from server.&lt;br /&gt;*QUIT : Terminates the mail session.&lt;br /&gt;*RCPT TO &amp;lt;user&amp;gt;: Designates who receives mail.&lt;br /&gt;*RSET : Resets mail connection.&lt;br /&gt;*SAML FROM &amp;lt;host&amp;gt; : Sends mail to user terminal and mailbox.&lt;br /&gt;*SEND FROM &amp;lt;host&amp;gt; : Sends mail to user terminal.&lt;br /&gt;*SOML FROM &amp;lt;host&amp;gt; : Sends mail to user terminal or mailbox.&lt;br /&gt;*TURN : Switches role of receiver and sender.&lt;br /&gt;*VRFY &amp;lt;user&amp;gt; : Verifies the identity of a user.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114890818596769951?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890818596769951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114890818596769951'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/05/smtp-commands.html' title='SMTP Commands'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114535959559129207</id><published>2006-04-18T16:54:00.000+05:30</published><updated>2007-04-17T20:56:10.491+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hacks'/><title type='text'>Forgot password for Windows 2000?</title><content type='html'>Hi,&lt;br /&gt;   well, this trick can work only if you have got a dual boot machine with linux as one of the os. Also, either you should be a root or the windows partition should be mounten with appropriate permission.&lt;br /&gt;&lt;br /&gt;   just delete the file &lt;br /&gt;"winnt/system32/config/sam"&lt;br /&gt;and you are done. you can boot your machine in windows and can get entry with&lt;br /&gt;user : administrator&lt;br /&gt;passwd : &lt;br /&gt;&lt;br /&gt;leave the password field null.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114535959559129207?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114535959559129207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114535959559129207'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/04/forgot-password-for-windows-2000.html' title='Forgot password for Windows 2000?'/><author><name>Saurabh Joshi</name><uri>http://www.blogger.com/profile/08461791061004256871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos14.flickr.com/16098060_afc710c877.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-114512563527168982</id><published>2006-04-15T23:57:00.000+05:30</published><updated>2007-04-17T20:54:15.159+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>Running commands using script</title><content type='html'>&lt;code&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;#Written by Vaibhav.&lt;br /&gt;#guptav[at]cse[dot]iitb[dot]ac[dot]in on Mon Mar 7&lt;br /&gt;&lt;br /&gt;use Expect;&lt;br /&gt;#List of IPs in file 'IPS'&lt;br /&gt;open(IP,"&amp;lt;IPS");&lt;br /&gt;@IPS=&amp;lt;IP&amp;gt;;&lt;br /&gt;close IP;&lt;br /&gt;my $newpassword = "yourpassword";&lt;br /&gt;&lt;br /&gt;foreach $ip(@IPS) {&lt;br /&gt;       chomp $ip;&lt;br /&gt;       print "-------$ip-------\n";&lt;br /&gt;       my $timeout = 50;&lt;br /&gt;       my $aft = new Expect;&lt;br /&gt;       $aft-&amp;gt;spawn("ssh $ip")&lt;br /&gt;               or die "Cannot ssh to the machine \n";&lt;br /&gt;       $aft-&amp;gt;log_file("/tmp/expect_log");&lt;br /&gt;       $aft-&amp;gt;expect($timeout,'-re','\? $');&lt;br /&gt;       $aft-&amp;gt;send("yes\n");&lt;br /&gt;       $aft-&amp;gt;expect($timeout,'-re','password: $');&lt;br /&gt;       $aft-&amp;gt;send("$newpassword\n");&lt;br /&gt;       $aft-&amp;gt;expect($timeout,'-re','# $');&lt;br /&gt;       $aft-&amp;gt;send("ls\n"); # OR LIST OF COMMANDS&lt;br /&gt;       $aft-&amp;gt;expect($timeout,'-re','# $');&lt;br /&gt;       $aft-&amp;gt;send("exit\n");&lt;br /&gt;} &lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-114512563527168982?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114512563527168982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/114512563527168982'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2006/04/running-commands-using-script.html' title='Running commands using script'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-18632947.post-113108297115806323</id><published>2005-11-04T11:12:00.000+05:30</published><updated>2007-04-17T20:56:32.855+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Welcome</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Welcome to my blog. Happy Hacking.&lt;br /&gt;Check &lt;a href="http://www.cse.iitb.ac.in/%7Eguptav/blog/index.php"&gt;my current blog&lt;/a&gt;.&lt;br /&gt;Vaibhav.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18632947-113108297115806323?l=nerd-hacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nerd-hacking.blogspot.com/feeds/113108297115806323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18632947&amp;postID=113108297115806323&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/113108297115806323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18632947/posts/default/113108297115806323'/><link rel='alternate' type='text/html' href='http://nerd-hacking.blogspot.com/2005/11/welcome.html' title='Welcome'/><author><name>guptav</name><uri>http://www.blogger.com/profile/07479116614946155446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
