September 30, 2011

vim paste and indent

If you use "dd" to cut a line in vim and want to use "p" to paste it to another place. The original indent will remain. To make the intent fit with the destination indent, use ]p.

List unused C/C++ functions

You have a C/C++ project. It is more than a few files, including some libraries. Now you want to know whether you can get rid of / comment out some of the functions that are never used.

There is no well-known FREE and OPEN SOURCE tools that can do this for you as of 2011, but a not-very-well-known tool called "callcatcher" created by Caolan does the job beautifully.

First, to download the callcatcher, go to the official website:

It is written in Python. So you may want to install it by becoming a root or use sudo.

To use the tool, you need to change ALL your make files to prepend "callcatcher" to your "gcc/g++" command. For example, in your original Makefile, you have


Now change it to

CC=callcatcher gcc
AR=callarchive ar

When you are done compiling, to see which functions is not used, do:

callanalyse MY-EXE-FILE

Another caveat is that you cannot compile multiple times at the same time, like this

$(CC) -o main main.c lib1.c lib2.c  (This is bad for callcatcher)

Instead you need to change it to something like this, so that you only compile one file at a time, then link it:

   $(CC) $(CFLAGS) -c $^
main: $(OBJS)
    $(CC) -o $@ $(OBJS)

September 1, 2011

Setup your own (small / tiny) Certificate Authority (CA)

For more than 100 certificates, you could use: NewPKI, OpenCA, IDX PKI which
are opensource projects.

A smaller solution is TinyCA ( Note that this is just a GUI front-end to openssl.

From Wikipedia:

  • EJBCA (java-based)
  • OpenCA (the most popular one)
  • OpenSSL, which is really an SSL/TLS library, but comes with tools allowing its use as a simple certificate authority.
  • gnoMint
  • DogTag (This looks really good)
  • XCA