Since moved to MacOS Lion (10.7.x), the folder Library disappeared from my Finder window. It bothers me a lot. Apparently Apple hides it in this OS release. Here is the way to reveal it.
From console terminal, use this command.
$ chflags nohidden ~/Library/
Friday, January 13, 2012
Friday, December 30, 2011
Comment out multiple lines in vi
Press Ctrl-v to start a VISUAL BLOCK
Move the cursor (up/down arrow key) to expand the block
Press I (Shift-i) to start insert.
Type in the character(s) that you want to insert, such as #, or //.
Press ESC to leave the visual block.
Move the cursor (up/down arrow key) to expand the block
Press I (Shift-i) to start insert.
Type in the character(s) that you want to insert, such as #, or //.
Press ESC to leave the visual block.
Tuesday, December 6, 2011
Global search in vi and list results
We use the simple command to search a pattern (or a fragment of text),
:/{pattern}
Sometimes, there would be a few dozens of matches that you want to list and browse quickly. Use this command,
:g/{pattern}
It lists the search results in one buffer. If you want to search the pattern case insensitive, add \c in the command, like
:g/\c{pattern}
Tuesday, November 1, 2011
Monitor disk IO activities on a Linux host
1. Use df first to find all the devices
2. Use iostat
iostat -dx <device> <time-interval>
For example,
iostat -dx /dev/sdb 5
to display disk IO activities every 5 seconds.
2. Use iostat
iostat -dx <device> <time-interval>
For example,
iostat -dx /dev/sdb 5
to display disk IO activities every 5 seconds.
Thursday, October 27, 2011
Find CPU information on a Linux
A good tip for finding out CPU and 32/64 bit kernel information on a Linux host, at http://www.cyberciti.biz/faq/linux-how-to-find-if-processor-is-64-bit-or-not/
In short, use
uname -a
and
cat /proc/cpuinfo
In short, use
uname -a
and
cat /proc/cpuinfo
Friday, September 30, 2011
Find directory path of the current groovy script
Bash or PHP script has a function that returns the directory path of the current script file.
$my_dir=dirname(__FILE__);
Groovy script lacks such a capability but an alternative is available by calling
def my_dir = new File(getClass().protectionDomain.codeSource.location.path).parent
$my_dir=dirname(__FILE__);
Groovy script lacks such a capability but an alternative is available by calling
def my_dir = new File(getClass().protectionDomain.codeSource.location.path).parent
Tuesday, September 27, 2011
Skip download when groovy code annotated with Grapes
Grapes is a great utility to manage class path automation when coding with groovy.
http://groovy.codehaus.org/Grape
But it slows down the start-up if there are a lot of dependent jars to download. Even all the dependent jar files have been downloaded to local m2 and grapes store previously, the download process still takes place, which slow things down unnecessarily.
Use the following options to ask groovy look into local storage directly.
groovy -Dgroovy.grape.autoDownload=false [groovy file path] [arguments ......]
http://groovy.codehaus.org/Grape
But it slows down the start-up if there are a lot of dependent jars to download. Even all the dependent jar files have been downloaded to local m2 and grapes store previously, the download process still takes place, which slow things down unnecessarily.
Use the following options to ask groovy look into local storage directly.
groovy -Dgroovy.grape.autoDownload=false [groovy file path] [arguments ......]
Subscribe to:
Posts (Atom)