use time command as a simple benchmark tool

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: 93746 | 13 Comments »

units of measurement

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 bc, Common, Misc, units | Hits: 46349 | 3 Comments »

linux alarm clock

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, […]

Posted in bc, Misc, xmms | Hits: 96496 | 14 Comments »

How to list all the prime factor?

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:” […]

Posted in Calculation, cut, factor | Hits: 85822 | 1 Comment »

Command line calculator, bc

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 […]

Posted in bc, Calculation, pipeline | Hits: 210960 | 24 Comments »