Monday, February 28, 2011

lsof is magical

Here is a link, which is kind of primer for lsof, since it has examples.

Here are some examples I have come across which are interesting and cool.

kill -9 `lsof -t -c sshd +f -- /dev/md2`
I want to kill all process which connects to my sshd, and are accessing raid /dev/md2. ensures no one is connected via ssh and is using the drive. I can then safely shut down sshd.


lsof -t -c java -a -u -a +f -- /dev/md2
this is a combination of
-c command
-a and
-u userid
-a and (another and)
+f file accessing raid disk.


lsof +f -- /var/log
everything accessing

you send a HUP to all process accessing /var/log, generally daemons accessing logs
kill -HUP `lsof +f -- /var/log`


lsof -i| grep LISTEN
all that your host is listening (-i is for tcp connections)

who is connected on port 6014
lsof -i:6014

lsof -i:22 -a -u
all those connected to port 22 and having remember if you do not specify -a, it becomes an or and that would mean any thing accessed by

# lsof -i:22 -a -u *uid* | wc -l
14

# lsof -i:22 -u *uid* | wc -l
1228

remeber -t is for terse, it understands, that you only are interested in the process id.

# lsof -t -i:22 -u *uid* | wc -l
100

even thoud *uid* user was accessing tons of files etc. he is running 100 process which are the handles to all those activity.

enjoy!




Friday, February 25, 2011

Finally scoll lock on mac (Mac book pro scroll lock)

I have often pressed the coveted emacs key stroke ctrl-x-s when running vi (dumb me). Unfortunately Mac terminal hangs from there.



Many thanks to Malcom's comment I was able to get it.




On real terminals Scroll Lock sends Control-S to pause text and Control-Q to resume. Try typing Control-S, then Control-Q.


Saturday, February 19, 2011

Worst Indian Bank (is it ICICI)


I do have some experience with a few banks - viz
Indian Bank
Allahabad Bank
State Bank of India
ICICI Bank
Deutsche Bank
Standard Chartered Bank
HDFC Bank
Union Bank of India
UCO Bank


Of all the interactions I have had wether it be loan/credit card/salary account/ etc I felt ICICI is the worst. The customer service is so pathetic that I decided to pen it here. Have any of you lately tried to put a complain? if not then do not even try, its virtually impossible.

I just wish like 'CIBIL', there should be a database of the banks how they operate. The highest complains etc. This central organization should be accessible to general public via multiple means.

I pray ICICI listens to the vows of its customers.


Ok Here comes again a shocker after 3 months :)

Adding a beneficiary and it says oops..


Thursday, February 17, 2011

Collection of links collected on monitoring/investigating memory on linux boxes

http://ktown.kde.org/~seli/memory/analysis.html
http://www.berthels.co.uk/exmap/doc.html
http://valgrind.org/docs/manual/QuickStart.html
http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html



http://stackoverflow.com/about
http://blekko.com/

Thursday, September 16, 2010

Perl Library bindings messed up in mac os x (Library not loaded - dyld: Library not loaded)

I was searching this info for the last 2 days stuck! I had 2 problems.

1. my cdrecord (installed via ports) failed to launch - giving me this error:

[09/16/10:18:31][phudi:~]$ cdrecord -scanbus
dyld: Library not loaded: /opt/local/lib/libgcc_s.1.dylib
  Referenced from: /opt/local/bin/cdrecord
  Reason: image not found
Trace/BPT trap

2. perl would give error on the SSLeasy

[09/16/10:18:31][phudi:~]$ perl ygrid_newnode.pl
Can't load '/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/auto/Net/SSLeay/SSLeay.bundle' for module Net::SSLeay: dlopen(/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/auto/Net/SSLeay/SSLeay.bundle, 1): Library not loaded: /opt/local/lib/libssl.0.9.8.dylib

Both of them was working!!

now #1 was solved via reinstalling cdrtools
why was the error? cdrtools was src installed and hence was referencing a ssl library which got upgraded with port selfupdate. So the lesson is not to src install, do a port install

#2 again the sslleasy libraries were built with system openssl library which is 0.9.8 while when I did a port selfupdate the ports openssl was upgraded to openssl-1.0.0 - which means running a 'perl -MCPAN -e shell' is a big no no. Install via ports :-)

delete /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level and reinstall via ports?
sudo port install p5-net-ssleay

hope this helps.

Sunday, August 22, 2010

Online media can be very misleading - however papaya leaves do help in blood platelet counts.

Hoax or truth: PAPAYA LEAVES NORMALIZES BLOOD PLATELET IN DENGUE PATIENTS

some links which debates/circulates this.
http://shine.yahoo.com/channel/health/papaya-leaf-juice-remedy-for-dengue-fever-252188/
http://voiceofsikkim.com/2010/08/19/dengue-fever-remedy-with-papaya-leaf-juice/
http://www.joewein.net/hoax/hoax-papaya-juice-dengue-fever-cure.htm
http://www.usefultipsforlife.com/papaya-juice-a-known-cure-for-dengue-fever
http://chibilicious.com/myworld/cure-for-dengue/
http://www.adaderana.lk/news.php?nid=9005
http://agrasen.blogspot.com/2009/01/papaya-leaf-juice-cure-for-dengue.html

It could be true also, so I tried digging in more for some scientific facts /research done on this.
Bingo! Here which you need to access via password lists the following:

Abstract
=====
Following up a popular use of crude leaf preparations from Carica papaya for the treatment of dengue infections, a suspension of powdered Carica papaya leaves in palm oil has been investigated for its effect on thrombocyte counts in mice, administering by gavage 15 mg of powdered leaves per kg body weight to 5 mice. Equal numbers of animals received corresponding volumes of either palm oil alone or physiological saline solution. Thrombocyte counts before and at 1, 2, 4, 8, 10, 12, 24, 48 and 72 hours after dosing revealed significantly higher mean counts at 1, 2, 4, 8, 10 and 12 after dosing with the C. papaya leaf formulation as compared to the mean count at hour 0. There was only a non-significant rise of thrombocyte counts in the group having received saline solution, possibly the expression of a normal circadian rhythm in mice. The group having received palm oil only showed a protracted increase of platelet counts that was significant at hours 8 and 48 and obviously the result of a hitherto unknown stimulation of thrombocyte release. The results call for a dose-response investigation and for extending the studies to the isolation and identification of the C. papaya substances responsible for the release and/or production of thrombocytes.


Now that does show, significant platelet count increase at least in mice. screen shot here.
the same paper is referred here and you can read without logging etc.


Saturday, August 21, 2010

Believe it or not - Assange is being hounded - will it be another sad ending to truth?

Not again. Whistle blower being hounded, how? read here. Assange is accused of rape. If there comes a day to stand up, its now. I do not know how but I feel very bitter by this sort of politics where the strong go away scot free and the innocent are punished.

VIM issues with powerline

What to do if you get this annoying issue - vi requirements.txt ...