2012年9月25日星期二

Find and replace a word in all the text document

So some day I need to replace a word to another one for all the XML file in a folder. I was like OK I'll write a C++ code. There goes another hour of my working time then.

Then I received this piece of code from a colleague:
find . -name "*.xml" -exec perl -pi.org -e 's/DICOMIO/CartoXP/' {} \;

Works like a charm.

Also, a linux command line to check how many cores do you have:
cat /proc/cpuinfo | grep processor | wc -l

2012年7月6日星期五

I just need to share this one....

So today I was browsing 9GAG, saw a post like: telnet this and enjoy, starwars fans :-)

So I tried:

telnet towel.blinkenlights.nl

Most epic ASCII stuff ever made.

2012年6月17日星期日

How to use nice colors in Matlab Plot

One major problem I always had in Matlab plotting is that other than the "default" 6-7 colors, it's hard to use different colors.

I just found a really nice solution:
http://scslin.blogspot.com/2011/09/matlab-plot-with-more-colors.html

Basically, you first download a small function "rgb" from:
http://www.mathworks.com/matlabcentral/fileexchange/24497-rgb-triple-of-color-name-version-2

Then, you can call:
plot(x,y,'color',rgb('olive'));


You will be able to draw a line using a "olive" color.
The available colors are as follows: