Wednesday, February 24, 2010

Another Cool Bash Trick!!!


Process Substitution


This trick allows you to use a process *almost* anywhere you can use a file. To illustrate, let's consider the 
diff command. Most versions of diff require you to pass exactly two file names as arguments. But what if we want to diff something, like the contents of a directory, that doesn't necessarily exist in a file? This is where we can use process substitution. For example, to diff the contents of two directories, you could use:

diff <(find dir1) <(find dir2)

The syntax 
<(command) creates a named pipe, and attaches command's STDOUT to the pipe. So, anything that reads from the pipe will actually be reading the output of command. To prove this to yourself, try the following:

$ echo <(/bin/true)
/dev/fd/63
$ ls -l <(/bin/true)
lr-x------  1 jgm eng 64 Jul 13 21:50 /dev/fd/63 -> pipe:[31340331]
$ file <(/bin/true)
/dev/fd/63: broken symbolic link to pipe:[31340360]

Similarly, you can use the syntax 
>(command) to have the command read from the pipe. An example is:

tar cvf >(gzip -c > dir.tar.gz) dir

Obviously, there are better ways to accomplish taring and compressing, but the point was to use process substitution.

Cool Bash Trick!!!


The "/dev/tcp" trick


Bash does some super-cool magic when you access 
/dev/tcp/hostname/port. It will create a TCP socket that is connected to the named host on the given port. This lets you easily use network sockets with regular shell IO redirection. For example, the following simply prints the time from NIST:

cat < /dev/tcp/time.nist.gov/13

And YES, you can read AND write to these sockets. Here's how. The following example fetches the source for the www.google.com homepage.

exec 5<> /dev/tcp/www.google.com/80
printf "GET / HTTP/1.0\n\n" >&5
cat <&5
exec 5>&-

New Integrated Chat

Hello To All!!!
Now we have integrated chat in our blog so that u can share new tips and tricks effectively!!!

Thursday, February 18, 2010

Tips to recover scratched CD's

1. Spread a cloth on a flat surface and place the CD on it.
2. Then, hold the disc with one hand, use the other to wipe the polish into the affected area with a soft cloth.
3. Wait for it to dry and buff using short, brisk strokes along the scratch, not across it.
4. A cloth sold to wipe spectacles or camera lenses will work super m8's.
5. When you can no longersee the scratch,, wash the disc with water and let it dry before playing. Intersting isnt it? Try it right now
I have used toothpaste with good effects before Ive also used car paint cutting compound on deeper scratches. It does leave lots of smaller scratches (as it is a cutting compound after all) but it will remove the worst scratches in most cases.
ya u r gng to b surely befinited by this Operation

* Fingermarks/prints cause 43% of disc problems!
* General wear & tear causes 25% of disc problems!
* Player-related issues cause 15% of disc problems!
* Remaining Others

Add Your Name (or) Application to right click Of My Computer

Caution ..
As it is related to Windows regisrty it can be dangerous
so,Try This at ur own risk 


To write your name on right click application
please follow the steps.
1.Copy/Paste the following code in Notepad And then Save it as .reg 

Windows Registry Editor Version 5.00 
[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Registry Editor] 
@="Your Name Or Name of the Application" 
[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Registry Editor\command] 
@="Location Of The Application"

2.
Now edit it and then Type your name In 

Eg:

[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Registry Editor] 
@="Rajesh" 

3. If u want to get any application, once you click Your name or name of application
Then , Type the location Of the application Which u want to open In: 

[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Registry Editor\command] 
@="Location Of The Application"

For eg.C:\Program Files\Yahoo!\Messenger\messenger.exe
Thats It finally save it And then Run it .


------------------------------------------------------------
To add Application Control Panel

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Control Panel\command]
@="rundll32.exe shell32.dll,Control_RunDLL"

To add Application Add/Remove 

[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Add/Remove\command]
@="control appwiz.cpl"

To add Application Reboot

[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\[Reboot]\command]
@="shutdown -r -f -t 5"

To add Application Shutdown

[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\[Shutdown]\command]
@="shutdown -s -f -t 5"

Wednesday, February 17, 2010

Linux Basic Commands

Ok this time m back with some programmer stuff!!!Here is a list of basic Linux commands Very usefull i suppose!!!

For changing directory / to /etc
[root@pc1 /]# cd /etc
 
One step back /etc to /
[root@pc1 etc]# cd ..
 
Go to previous working directory
[root@pc1 /]# cd -
 
Go to current login user home directory
[root@pc1 etc]# cd ~
 
Show the contents of /etc in single color
[root@pc1 ~]# dir /etc
 
Show the contents of /etc in different colors with nature of contents
[root@pc1 ~]# Ls /etc
 
create a folder on root partition
[root@pc1 ~]# mkdir /disk
 
Create a folder in /disk
[root@pc1 ~]# mkdir /disk/dir
 
Create multiple folder in multiple directories with single command
[root@pc1 ~]# mkdir /etc/dir1 /var/dir2 /usr/dir3
 
Create multiple folder in same directory
[root@pc1 ~]# mkdir dir1 dir2 dir3
 
Copy a file in directory
[root@pc1 disk]# cp file dir
 
Copy a file from /disk/file and paste it in /disk/dir/
[root@pc1 disk]# cp /disk/file /disk/dir
 
Copy a directory with –r option
[root@pc1 disk]# cp -r dir dir2
 
Copy a file from /disk/file and paste it in /etc with myfile name
[root@pc1 disk]# cp /disk/file /etc/myfile
 
Remove a file
[root@pc1 disk]# rm file
 
Remove a file with forcefully option
[root@pc1 disk]# rm –f file
 
Remove a directory with out –r option and you face will an error
[root@pc1 disk]# rm dir
 
Remove a directory with –r option
[root@pc1 disk]# rm -r /disk
 
Remove a directory with forcefully option
[root@pc1 disk]# rm -rf dir
 
Move /etc/dir1 to /disk/ with different name
[root@pc1 disk]# mv /etc/dir1 /disk/mydir
 
Rename the folder name mydir to dir
[root@pc1 disk]# mv /disk/mydir /disk/dir
 
Rename the file name with myfile
[root@pc1 disk]# mv file myfile
 
Read a file page by page with less command
[root@pc1 disk]# less /etc/grub.conf
 
Read a file page by page with more command
[root@pc1 disk]# more /etc/qrub.conf
 
Read first ten lines of grub.conf
[root@pc1 disk]# head /etc/grub.conf
 
Read last ten lings of grub.conf
[root@pc1 disk]# tail /etc/grub.conf
 
Read first 12 lines with –n option
[root@pc1 disk]# head -n 12 /etc/grub.conf
 
Read last 11 lines with –n option
[root@pc1 disk]# tail -n 11 /etc/grub.conf
 
Copy the contents of /etc/grub.conf in /disk/file
[root@pc1 disk]# cat /etc/grub.conf > /disk/file
 
Append the contents /etc/mtab in /etc/file
[root@pc1 disk]# cat /etc/mtab >> /disk/file
 
Merging tow commands with pipe sign output of the first command is input of second command
[root@pc1 disk]# cat /etc/squid/squid.conf I more
 
Count the total lines of squid.conf
[root@pc1 disk]# cat /etc/squid/squid.conf I wc -L
 
Show only spool words in squid.conf
[root@pc1 disk]# cat /etc/squid/squid.conf I grep spool
 
Flush the contents of file
[root@pc1 disk]# cat /dev/null > /var/log/messages

Monday, December 28, 2009

Some Useful Microsoft Internet Explorer Shortcut Keys


F5Refresh current page, frame, or tab.
F11Display the current website in full screen mode. Pressing F11 again will exit this mode.
BackspaceBack a page.
Alt + Left ArrowBack a page.
Alt + Right ArrowForward a page.
Ctrl + IDisplay the saved favorites.
Ctrl + NOpen New browser window.
Ctrl + PPrint current page / frame.
SpacebarMoves down a page at a time.
Shift + SpacebarMoves up a page at a time.
TabMoves from one link to another.
Shift + TabMoves backward from one link to another.
EscStop page or download from loading.
Ctrl + (- or +)Increase or decrease the font size, pressing '-' will decrease and '+' will increase.
Ctrl + EnterAuto complete a url address. For example, type thecomputricks in the address bar and press CTRL + ENTER to get http://www.thecomputricks.com.
Ctrl + DAdd the current page to favorite.
Alt + Down arrowDisplay all previous text entered in a text box.