some codes written by Roger in C or Python