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/8Bj/1mMWh39NMKpYr9VN37RiCzAyShfDPiF6L7LMkOSN5Ks
Hq6kfmHZFR1LIBfP8p1WSm6QPDRYyFVuGiG0YxlMpMcRoTMWWayREaR/Y7olVp9o
faYbSqwrD6DJHSLC7DI4xwADBQf7BSzdqriS3rmntwlQcP9tCNtSOjeMuE4QK8IK
6DZ+Z5DjjOgUjGb5FUlmJhrPIqjbYe7xxcOuA1GdxAU3gJ8q9FQqssdk3edVK2qr
6MMq9YW1bGyUjUSA1FfqFzzzHMa3B7DCkgu+4DG7HYMvD707rPQ5TpH1nf8Wukfm
aUaPiwn+912uHekEArSTxI0IVOyvkkVMX2Q8fX6FlRVRBB0/o0We1eqRw2If0PM1
adfGnmBvFYR9B1jFSGDYfmYRb5KF2huZkvJkmguxm0dyZBNiNjA/ndF/YOXstR/G
gCbeX2hFdMx1D4wEPSJvVqB8+H3rhpzHuj5mvwKUgk4hK02uvYhJBBgRAgAJBQJJ
7b6GAhsMAAoJELY8A7D98XSTLS4An2AhkKX2NDdzYuwtK54DpmdHzE5uAJ9GIsER
GzVmoRTky1axSTPUJloZCQ==
=R/Ug
-----END PGP PUBLIC KEY BLOCK-----

Tuesday, April 14, 2009

linux screen command

Common screen commands

screen command Task
Ctrl+a c Create new window
Ctrl+a k Kill the current window / session
Ctrl+a w List all windows
Ctrl+a 0-9 Go to a window numbered 0 9, use Ctrl+a w to see number
Ctrl+a Ctrl+a Toggle / switch between the current and previous window
Ctrl+a S Split terminal horizontally into regions and press Ctrl+a c to create new window there
Ctrl+a :resize Resize region
Ctrl+a :fit Fit screen size to new terminal size. You can also hit Ctrl+a F for the the same task
Ctrl+a :remove Remove / delete region. You can also hit Ctrl+a X for the same taks
Ctrl+a tab Move to next region
Ctrl+a D (Shift-d) Power detach and logout
Ctrl+a d Detach but keep shell window open
Ctrl-a Ctrl-\ Quit screen
Ctrl-a ? Display help screen i.e. display a list of commands


configure:

harry@ubuntu:~$ cat .screenrc
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'
# Default screens
screen -t root        0
# screen -t minicom       1 minicom
screen -t src1          1
screen -t src2          2
screen -t src3          3
screen -t shell1      4
screen -t shell2      5
screen -t telnet      6

Saturday, April 04, 2009

what's wrong with whois server today?

almost can not get result from all the whois servers i tried.

Wednesday, April 01, 2009

Linux inotify example

1. inotify_init() - get a fd
2. inotify_add_watch() - need to specify the directory and event(s) want to monitor
3. read() - to check if there is any changes

need to verify: is it possible to get the event when a input device is active by monitoring /dev/input/eventX

The Darke Side: Linux inotify example: "void get_event (int fd, const char * target)
{
ssize_t len, i = 0;
char action[81+FILENAME_MAX] = {0};
char buff[BUFF_SIZE] = {0};

len = read (fd, buff, BUFF_SIZE);

while (i < len) {
struct inotify_event *pevent = (struct inotify_event *)&buff[i];
char action[81+FILENAME_MAX] = {0};

if (pevent->len)
strcpy (action, pevent->name);
else
strcpy (action, target);

if (pevent->mask & IN_ACCESS)
strcat(action, ' was read');
if (pevent->mask & IN_ATTRIB)
strcat(action, ' Metadata changed');
if (pevent->mask & IN_CLOSE_WRITE)"