Wednesday, December 17, 2008

Command to generate emacs TAGS file for a directory tree

find . -name '*.[chSs]' -print | etags -

The find command searches for files matching the specified criteria and prints those files to standard output. The '-' argument asks etags to read list of files from standard input.

The part -name '*.[chSs]' -print asks find to print files with extension c, h, S, or s. The first argument is the root of the directory tree in which to search for files.

Kermit Scripting

In embedded systems development, kermit is commonly used to communicate to boards through serial port. Many of interactive dialog sessions between user and board can be automated using kermit scripts. If kscript is a file containing a kermit script it can be run by the following command "kermit -y kscript"

Here are some very useful kermit scripting commands

Basic interaction



To wait for a particular prompt and then issue a command
input 1000 bash$
lineout ls
Will wait for the prompt "bash$" to appear and then issue the "ls" command to board through serial port
minput <timeout> <s1> <s2> ...
Used to Wait for any of the given string
Ex:
minput 1000 bash$ >

Variables



First, define some variables
define delay 1000
define prompt bash$
define command ls
And use it
input \m(delay) \m(prompt)
lineout \m(command)

And when finally you are finished use
exit 0 "Over and out"

To add timestamped logging to kermit


set session-log timestamped-text
log session kermit-log.txt

Saturday, November 29, 2008

Memory

Memory is a funny thing, it forgets everything that I should remember and
remembers everything I want to forget.

Monday, October 27, 2008

Some feature requests to god

A search function to search for things in this world.
A Makefile with target 'clean' so that we can do a 'make clean' to clean up everything (dishes, clothes..everything).

Thursday, October 2, 2008

quote from a mathematician!!!

This is a wonderful quote from a calculus text

Logical thinking is much more important than "epsilon" and "delta".

Friendship and the power of pigenhole principle

In a group of n friends (n >= 2), atleast 2 of them will have same no: of
friends.

Reformulating as a graph theory problem
In an undirected graph G (with no self-loops) with n = |V| >= 2, atleast 2
vertices will have same degree.

Proof. We use proof by cases
(case 1). G is connected
The degree of a vertex can be any of n-1 different values 1, 2,...,n-1(A
vertex with degree 0 will imply that G is not connected). There are n
vertices in the graph. So atleast 2 of them should have same degree by
pigeonhole principle.
(case 2). G is not connected
The degree of a vertex can be any of n-1 different values 0,1,...,n-2 (A
vertex with degree n-1 will imply that G is connected). A similar argument
as case 1 applies.

How many digits does 2 "raise to" 1000 have?

We have to find decimal (base 10) digits. So convert to base 10.

21000 = 10(log 2)1000

Now 101, 102, and 103 has 2, 3, and 4 digits respectively.

So 21000 should have approximately (log 2)1000 + 1 digits.