Code Snippets and Miscellany

As of 3/01, this page was getting rather unwieldy, so I've broken it into a series of project-specific subpages. Hopefully this will make navigation easier for the impatient; feel free to mail me with your opinions.

Comment and Line counting in C

This is an Awk script that I wrote in 5/93, with the goal of counting lines of code and comments in a large C/C++ project I was working on. It produces three numbers: The number of code lines, the number of comments (note that multiline comments are counted as one!) and the number of raw lines, per file and overall. It also reports the percentage of comments, ie (comments / raw lines) * 100.

  • Line counting page
  • Poetry via 'fortune'

    While on BITNET, for many years, I got a daily poem from the [email protected] poetry server. (Kudos to Chris Hurlburt who wrote the VMS script to automate it) I've collected these, along with others, into a single text file and turned it into a fortune file.

    Meaning you can have a random poem any time your heart desires it. Cool, eh?

    There are (initially) 158 poems in the file, though there is almost certainly some duplication.

  • Random poetry page
  • Deadlock detection for POSIX threads

    I was working on this, and then a week later Dr. Dobbs published an article by John Mount, with complete code, to do just that. Drat!

    Anyway, for now I've shelved the project, please see the DDJ article.

  • Deadlock page
  • Parallel 3-coloring a Directed Cycle

    This problem arises in some graph theory applications, and Ja Ja proposed a parallel algorithm to solve it efficiently on shared-memory parallel systems. Implemention and results are presented.

  • 3-coloring page
  • Niggling Reminders of Mortality

    This has been one of my toy problems for many years. Write a program that will upon login print your age, in days. For Morbid Amusement Only. (tm).

  • Grim reaper page
  • Fibre Channel at Home Project

    This is a semi-related project, my use of Fibre Channel disks and so forth for the home computer. Doesn't count as a code project, but it's the most popular set of pages by far. Go figure.

  • FC at home page
  • New Disk Drive Abuse

    We needed a script to break in new disk drives, and molest.pl was born. This is designed to do a random walk over the entire disk, reading 4KB blocks, until interrupted. It can optionally run for a limited number of iterations.

    (The non-destructive write mode is broken, but won't do any damage if you try it.)

  • Molest page
  • HP Printer message programming

    Ever wondered how to set the display message of an HP printer?
  • Wonder no more.
  • Back to home page