Friday, August 19, 2016

read of 0 byte file



What will happen if you read a file with 0 bytes?

say cat /dev/null > file

do a read on the file - what it should return -
So you expect error ??

nope!!


It returns zero, which is success for read but no buffer is stored.



I had some tough time debugging this one.

So, Aware & Beware of this :)

color chooser website



color chooser :)

Getting hex codes for colors:

http://www.huecode.com/


samba - verify correctness of samba conf file



// check an smb.conf configuration file for internal correctness

#testparm




google calendar get remainder on same day


Usually while setting a google calendar notification, I wish to get a reminder
on the same day(birthday for example).

But, it pops up a day before :)

Then, figured out that using "0" day before while setting notification will help my case :))

Sharing a command output with others


wanna share a command output to others?

Answer: use netcat

 How?
First install netcat. package name is
nmap-ncat.x86_64

Then, you can get the output of a command to a browser liike below:

===========================
$ service smb status | nc termbin.com 9999
Redirecting to /bin/systemctl status  smb.service
http://termbin.com/4bpd
===========================

So, open the link in browser:
http://termbin.com/4bpd

Its contents are as below:
===================
● smb.service - Samba SMB Daemon
   Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2016-08-17 21:04:42 IST; 1 day 17h ago
 Main PID: 2055 (smbd)
   Status: "smbd: ready to serve connections..."
   CGroup: /system.slice/smb.service
           ├─2055 /usr/sbin/smbd
           └─2057 /usr/sbin/smbd
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
=================================

You can share this link with others.

Sunday, August 14, 2016

debugging using gstack


       gstack - print a stack trace of a running process

       gstack <pid of the process>

       gstack  attaches  to the active process named by the pid on the command
       line, and prints out an execution stack trace.

       If the process is part of a thread group, then gstack will print out  a
       stack trace for each of the threads in the group.

       Ensure it is not stripped of symbols to get trace.