Live Chat!

use time command as a simple benchmark tool

* * * * * 1 votos

October 20th, 2007 mysurface

Sometimes you need to track execution time for some apps for benchmarking, time command is a handy tool. Let say you have wrote few scripts trying to grep some info from some log files, each of the scripts uses different techniques or command combos. You can run your scripts along with time command, and compare [...]

Posted in Calculation, time | Hits: 10272 | 2 Comments »

units of measurement

* * * * * 1 votos

May 1st, 2007 mysurface

To measure a quantitative object, we usually use certain standard of units. To measure width or length of a piece of paper, we may use inches, centimeter or meter. Sometimes, the conversion between one system unit to another might not be straight forward. For examples convert inch to cm approximately, 1 inch is 2.54cm, 1 [...]

Posted in Common, Misc, bc, units | Hits: 14637 | 2 Comments »

linux alarm clock

* * * * * 1 votos

April 14th, 2007 mysurface

I have too used to alarm clock, to wake me up every early morning. I set my alarm on my cellphone every night before I going to sleep. But recently, a simple stupid idea of creating an alarm clock in Linux comes to my mind.
I usually turns on my laptop overnight for some downloads, system [...]

Posted in Misc, bc, xmms | Hits: 14090 | 6 Comments »

How to list all the prime factor?

          0 votos

November 2nd, 2006 mysurface

Are you thinking of using c/c++ or bash script to do that? Don’t do that, linux have ready made command. Its call factor.
Let say I want to list the prime factor for 232.
factor 232
The result will be
232: 2 2 2 29
What if I want only the factor with the “232:” ? We can use [...]

Posted in Calculation, cut, factor | Hits: 9192 | No Comments »

Command line calculator, bc

* * * * * 1 votos

September 4th, 2006 mysurface

How to do calculation if I only have command line? If you have BC you can, and you can do a very complicated calculation. To perform calculation, you can type bc and start to type your question, or passing question through pipeline, such as
echo “56.8 + 77.7″ | bc
Let say you want to convert decimal [...]

Posted in Calculation, bc, pipeline | Hits: 10674 | 7 Comments »