Tuesday, November 22, 2011

Studio 60


The show reminds me of Saturday Night Live. Good show, actors and plot. Another great show written by Aaron Sorkin.

Monday, November 21, 2011

MAC Screenshot Command


  1. command+shift+3 // Full Screenshot

  2. command+shift+4 // Crosshair to allow selection of screenshot area

  3. command+shif+4(then spacebar) // Camera to capture specific screen object. Similar to Digital Camera

Chelsea Piers GYM (Pier 60)

Almost 3 years ago I stopped going to GYM and slowly gained weight. After some consideration I choose Chelsea Piers that is located 15 min walk from my work. I am planning to go to the gym at least 3 times per week (morning hours before work).

The gym would cost me $55 per paycheck.

I woke up at 5:45AM today and exercise for 45 minutes. I feel better and refreshed.

Tuesday, November 1, 2011

Import CSV file into MYSQL


LOAD DATA INFILE 'myfile' INTO TABLE table FIELDS TERMINATED BY ',';

Saturday, October 29, 2011

Usage of cat command

cat command functionality:
1. create
2. view
3. join files

cat is short for catenate (to join things together, end-to-end)
- Create file
cat > file1
enter text
more text
# press Enter, CTRL-d to exit

- View file(s)
cat -n filename # will number all lines
cat -b filename # will number all non-blank lines

cat -t filename # all tabs to be shown as ^I
cat -s filename # remove extra blank lines. 1 blank line is allowed.
cat -A filename # combine -t & -s options together

- Join Files
cat test1 test2 # join both files and show output in stdout
cat test1 test2 > test # Join both files and add to stdout

Tuesday, October 25, 2011

Bash Shortcuts


GNU Readline Library enable to edit the command line shortcuts. Readline uses emacs key binding. It means a lot of CTRL/ALT keys.

  1. Ctrl+C # Interrupt to exit, terminate the command

  2. Ctrl+D # disconnect from shell

  3. Ctrl+Z # suspend the process, suspend/stop the command

  4. Ctrl+l # clear screen

  5. Ctrl+s # stops the output to the screen

  6. Ctrl+q # allow output to the screen
    (If previously stopped using Ctrl+s)

  7. !! - run last command

  8. Ctrl+r # search the history backwards

  9. Ctrl+g # escape from history searching mode

  10. Ctrl+a # go to start of the command line

  11. Ctrl+e # go to end of the command line

  12. Ctrl+f # move forward one character (identical to VIM)

  13. Ctrl+b # move backward one character (identical to VIM)

  14. Ctrl+p # previous command in history

  15. Ctrl+n # next command in history


kill processes that match grep pattern

I open about 20 copies of the same file. I used the command below to kill them.
kill -9 `ps auwwwx | grep "vim /tmp/continuous_migration.log" | awk '{print $2}' | xargs

Sunday, October 23, 2011

diff


diff from_file to_file
diff from_dir to_dir

diff useful lags
-B (Ignore changes whose lines are all blank.)
-b (Ignore changes in the amount of white space)
-y (side by side ouput comparison)

useful alias:
diff -Bb alias

Saturday, October 22, 2011

Changing Linux Login Shell


Ways to change Linux shell
1. chsh (change login shell)
2. edit /etc/password
3. exec in .login file