DNS domain expiration checker

I just released version 1.0 of domain-check to my website. domain-check queries WHOIS data and prints domain expiration dates, and works very similar to ssl-cert-check. Since seeing is believing, I will provide several examples to show just what domain-check can do.

The first example shows how domain-check can be used to print the expiration date for the domain prefetch.net:

$ domain-check -d prefetch.net

Domain                              Registrar         Status   Expires     Days Left
----------------------------------- ----------------- -------- ----------- ---------
prefetch.net                         INTERCOSMOS MEDIA Valid    13-feb-2006   64   

The next example show how domain-check can be used to print the expiration date for the domains listed in the file “domains”:

$ domain-check -f domains

Domain                              Registrar         Status   Expires     Days Left
----------------------------------- ----------------- -------- ----------- ---------
sun.com                             NETWORK SOLUTIONS Valid    20-mar-2010   1560 
google.com                          EMARKMONITOR INC. Valid    14-sep-2011   2103 
prefetch.net                         INTERCOSMOS MEDIA Valid    13-feb-2006   64   
spotch.com                          GANDI             Valid    03-dec-2006   357  

And the final example shows how domain-check can be used to e-mail admin@prefetch.net if a domain listed in the file “domains” will expire in 60-days or less:

$ domain-check -a -f domains -q -x 60 -e admin@prefetch.net

Send me an E-mail if you have comments or suggestions.

Finding memory leaks with OS X

The UNIX standard library provides the malloc() and free() routines to dynamically allocate and free memory. These routines allow developers to increase and decrease memory (the programs heap) as needed, which allows the process to increase or decrease memory consumption as demand increases or decreases. This works great when care is taken to free memory that is no longer needed, but issues (e.g., memory leaks) can occur if memory is allocated and never free()’ed. If you are using OS X, you can use the leaks(1) command to check a program or process for memory leaks:

$ cat test.c

#include

int main(int argc, char**argv)
{
void *foo;
char *bar = “this is a string”;

foo = (void *)malloc(128);

foo = bar;

sleep(60);
return 0;
}

$ test &

$ leaks test
Process 262: 8 nodes malloced for 2 KB
Process 262: 1 leak for 128 total leaked bytes.
Leak: 0x00500120 size=128
0x00000000 0x00000000 0x00000000 0x00000000 …………….
0x00000000 0x00000000 0x00000000 0x00000000 …………….
0x00000000 0x00000000 0x00000000 0x00000000 …………….
0x00000000 0x00000000 0x00000000 0x00000000 …………….
0x00000000 0x00000000 0x00000000 0x00000000 …………….
0x00000000 0x00000000 0x00000000 0x00000000 …………….
0x00000000 0x00000000 0x00000000 0x00000000 …………….
0x00000000 0x00000000 0x00000000 0x00000000 …………….

I digs me some OS X!

Saving CPP processed files

My friend Clay sent me a cool tip this week. If you would like to save files that have been processed with cpp, you can set the CFLAGS “-save-temps” option:

$ export CFLAGS=-save-temps

$ make

This will cause a bunch of .i files to be created, which can simplify the process of figuring out how applications work (going macro hunting is no fun at all!).