Wednesday, December 22, 2010
Read File Names from ls -l
ls -l | while read a b c d e f g h i ; do echo $i; done
Saturday, October 02, 2010
Learn to Live
Learn to live, learn to let go & follow nature rule
I have always wondered at the almost robotic way we function. what’s the reason to continue a relationship or a venture when there is no emotion or heart in it? I see no reason to go on, if there is no emotion. One has to realise when to move on, when to let go. It’s best to live life as an honest free spirit and challenge those who infringe upon your joy. The conundrum of modern-day life has robbed us of compassion. We have been drained of love and humility. It’s good to remember that life is so easily destroyed, if we are not careful.
Dissatisfaction, sadness, hatred – these are the mind’s creations. You don’t need to serve your connection with the world, if you feel let down. To tackle that, it’s essential that you lead a normal life while trying to find out the root cause of dissatisfied mind. This approach is both realistic and practical and guarantees an answer to most of your deep-seated problems.
Being happy depends not so much on external circumstances as on your inner life. This means all your thoughts, perceptions, beliefs, emotions, desires, dreams – your entire mental and emotional scene. Happiness is about how you react inwardly to events, what you think and believe, how you feel, how problems affect you. It may sound obvious, but like many obvious things it’s something that is often forgotten when it matters most. We focus almost exclusively on or external lives, on getting and spending and having fun and then wonder why we are not happy. But it’s when our inner lives are tranquil that we are most happiest and we call this inner peace.
You can’t completely avoid problems, but you can change how you react to them by acquiring new habits that provoke peaceful inner responses. Training your inner life into different habits require learning skills of thinking, feeling and managing your beliefs and desires. These are very like the virtues many religions and philosophies advocate but if u think of them as skill rather than virtues, you benefit from an important and liberating shift. Instead of ‘ I must become a better person’ you can think ‘I would lie more happily if I work on my skills’. So the change in attitude becomes a choice, not a duty. This process is not something u can do overnight, it’s a whole new way of life but the reward is what we all want most – happiness. There are five main skills who need to cultivate.
Mindfulness:- this involves developing your ability to focus your thoughts in the present. The problem most of us have with thought is having too much of it – the working and non-stop mental chattering our minds are prone to. Mindfulness is a key in our skill because as it gets stronger, it lets you focus on your inner life and catch your habits in the act. Once you can see how u r rolled by them, the change u r seeking often happens of it’s own accord.
Compassion:- most religions rightly stress compassion. As well as being a virtue in its own right it is a practical skill that counter act negative emotions like anger and hatred, which are terrible wreckers of happiness. Tried the next time someone annoys you; put yourself what they might be thinking or feeling to behave like that. Even bad people, let alone people who just mildly annoy you, often have a mistaken view of the world which makes them do what they do.
Story skills:- these are very useful for problems with your inner belie system, as they let you stand back and explore alternative versions of reality. Believes have great power over your life because belief is something your take as fact. Start to think of your believes as stories and it is easier to accept that other things might be true as well. Even true stories only select a little bit of reality we are focusing on at the moment, no one story is the whole truth about any situation. From a different point of view we would see a different t story, sometimes a whole different world. This is not about make beliefs, its about reframing situations to look at them from a different perspective.
Letting – go techniques:- these are particularly helpful when we are unhappy not getting what we want. Generally, we are encouraged to keep wanting and to think that more will make us happier, whether its clothes or cars or even love. But wanting is a treadmill; as long as you have unsatisfied want and desires, or let go some of them. Letting-go skills also include forgiveness, which helps hugely with one of the things you think you want is revenge.
Enjoyment skills:- this last group includes skills such as patience humour and especially gratitude. You don’t have to be grateful to someone, it’s enough to cultivate gratitude or things. Our minds naturally scan the environment for dangers and resources, a useful mechanism when we were hunter-gathers. But it can make us unnecessarily pessimistic – focussing on 10% we lack rather than 90% we have cultivating enjoyment skills will help redress the balance.
Acquiring all his skills takes time and effort. The important thing is to practice them until they operate without you thinking about them. Your practice routine will be very individual because everyone needs to prioritise different skills depending on the specific issues that you are holding them back from being happy but keep the skills in mind and you will constantly find new ways to try them out.
Saturday, April 17, 2010
Skype automation
http://stevenjoseph.
Friday, November 13, 2009
Shell Standard I/O
$cmd >> $logFile 2>&1
And
$cmd 2>&1 >> $logFile
Answer:
The first one is right and second one is wrong.
first one redirects any output from the $cmd to the $logFile. The second one just redirects the output and not the STDERR to the $logFile.
Reference:
http://www.linux-mag.com/id/5103
Sunday, November 01, 2009
Moral Dilemma
1. Taking a personal prinout using office printer?
2. Making a phone call using office phone ?
3. Stealing salad from the salad bar at office canteen?
4. Keeping the IPOD nano 4 GB found on a street at halloween pary on franklin street with urself?
Ans: If you can tell all your friends and family members about the action then the action should be morally right.
1. Should be OK.
2. Should be OK.
3. WRONG.
4. Dicey.
Thursday, October 15, 2009
Finish it syndrome.
The syndrome is one in which the DIET conscious person end up eating more in following scenario:
1. Person end up taking more cereal as he wanted to finish the contents of the cereal box. Why not use it next item it is not going to get perished.
2. Person end up taking more serving as he did not wanted the food to be wasted. Why not use the zip- lock bags..:-)
Thursday, October 08, 2009
Motivation for fast running
I read somewhere that running fast makes your abs and who does not want to have six pack abs.
Six pack abs are enough reason for me to be motivated for fast running.
Sunday, July 05, 2009
GDB handy commands
info threads
Signals
info signals
// To pass the signal from GDB to the process.
handle SIGINT pass
To Debug a running process using GDB
gdb
Tuesday, May 19, 2009
VIM : Comments lines with a pattern in a file
:g command is used in following form
:g/[patern]
Example:
:g/JR/normal I //
explanation
Pattern : JR
Cmd : normal I //
"I" is used in VIM to start insert mode at the start of line and "//" is the comment character used in PHP.
Enjoy VIM. Check out the help :g if you have more questions.
Monday, March 30, 2009
Toggle Comment in VIM in one line using perl
try this mapping
:map
You can map Alt+C or Ctrl+T something which is faster than F2
This mapping will comment and uncomment the C-style comment. I have tried this on Ubuntu and VIM 7.1 and works fine for me
Note: The map command may not work on copying as the VIM may not recognize the Ctrl - M character. You have to Ctrl- V and then Enter to make it work
Friday, March 13, 2009
Singleton versus Static
- Control over construction. Timing issues.
- Polymorphism.
- One versus multiple instances.
Tuesday, March 10, 2009
Formatting XML in VIM - xmllint --format -
!xmllint --format -
Note the hyphen at the last.
Tried searching for sorter options for --format but did not found any.
Monday, March 09, 2009
VNC not working on locked PC
---------
I found that the VNC was not working on my PC(Windows XP) when it was locked using Ctrl+Alt+Del. Interestingly it did worked when the PC was not locked.
Solution:
---------
While installing VNC make sure that you select the option to install it as a service so it can be seen in services.msc
On installing VNC, it provides an option to install as a service. If it is not installed as an service, the VNC cannot be done on a locked PC.
Reason:
--------
This is what as told by one of my colleagues. Seems to be logical.
Windows uses API from gina.dll which provides the capabilities for locking/unlocking the workstation. API from gina.dll are accessible only by the windows services and not by other programs.
Saturday, October 11, 2008
timeout
timeout 5 tail -f /var/log/messages
If you do not have timeout package installed, perl can be used to perform the same:
perl -e "alarm shift @ARGV; exec @ARGV;" 5 tail -f /var/log/messages
Reference links:
http://michael.thegrebs.com/2008/05/27/most-awesome-command-ever/
http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/
Wednesday, September 17, 2008
Ethtool - Finding the NIC to which the LAN cable is connected
Sometimes the PCI slots are not properly numbered and we cannot rely on the normal naming convention. Linux ethtool comes handy at that time to find the NIC card.
Use
ethtool -p
This will glow the light on the NIC card. You can just see the glowing the NIC and guess the name.
Tuesday, September 16, 2008
Creating firefox extension
http://ted.mielczarek.org/code/mozilla/extensionwiz/
Tuesday, August 19, 2008
Get the last column from the ls command
awk '{ printf $NF;$NF = "" ;printf " "$0"\n" }' | sort
http://www.linuxfocus.org/English/September1999/article103.html
Here is one more trick I have learned from my colleague
ls -ltr | while read a b c d e f g h file; do echo $file; done
The second technique looks much easy to me
Friday, June 27, 2008
xargs command replace string
to scp files with spec pattern
ls file* | xargs -n1 -i{} scp {} root@
Friday, May 23, 2008
Petroff Defense Trap
2. Nf3 Nf6
3. Nxe5 Nxe4
4. Qe2 Nf6
5. Nc6
Now the black Queen is DEAD. Black king is in check by White Queen and his queen is in attack by knight.To save check and his queen he can 5. .. Qe7 but then white can take the queen with knight at d6
PHP Hacking 1 = 1
SELECT * FROM users
WHERE user='
AND passwd='
A simple hacker like me ;-) can use SQL injection attack by specifying
User: Any
Password: OR 1 =1
This will allow me to give access to the site. Depending on the query you may need to try other variations like
Password: ') OR ('1=1')
The idea is to inject 1 =1 (which is true) in SQL statement such that the WHERE clause returns TRUE.
Happy Hacking...