Code

I occasionally write code to make things less annoying. These are all free for you to use and modify, just drop me a note at along with the improvements you've made.

webping Java (July 20 2008)

Command-line tool that measures the response time, in milliseconds, of a url 45 times in a row, discarding the five worst and reporting the results. It does not parse the data or make secondary requests for css style sheets or images etc. It reports min, avg, max, and standard deviation.

>java webping google.com
Jul 20, 2008 2:43:54 PM
       min       avg       max       std      url
--------------------------------------------------------------------------------
     90.87     97.44    110.69      5.01      google.com
          
Windows ZIP
webping PHP (July 20 2008)

Same as above only better.

>php webping.php {google amazon}.com
Sunday 20th of July 2008 02:47:11 PM
       min       avg       max       std      url
--------------------------------------------------------------------------------
     64.73     67.54     74.75      2.14      google.com
     39.43     40.96     42.34      0.75      amazon.com
          
Windows ZIP
yuv psnr (May 9 2008)

Command-line tool that computes the Peak Signal to Noise Ratio for each Y, Cb and Cr component for each frame of two YUV 420 videos. 'total' is the psnr across all frames. 'Y' 'total' is the psnr for the whole Y component across all frames. 'Frame' is the psnr of all components (Y, Cb, Cr) for a frame. 'Frame' 'total' is the psnr for the whole sequence.

Update May 13: added GNU SSE3 inline assembly; run time is now 90% disk.

     Y : min=44.60214 avg=44.89237 max=47.56301 total=44.88548
    Cb : min=45.04994 avg=45.33798 max=48.08658 total=45.32969
    Cr : min=45.06935 avg=45.40971 max=48.11539 total=45.40051
 Frame : min=44.757   avg=45.04685 max=47.73503 total=45.03949
frames : 250
          
yuv_psnr.cpp
Windows ZIP of sse and nosse .exe
c .bmp write (May 9 2008)

In my video encoder research I frequently need to insert a "dumpBMP()" type of function in the middle of someone else's codec. It needs to be something I can just #include without having to link, or better yet, just something I can cut and paste. It had to be c and not c++. So I looked up the bmp format on wikipedia and wrote my own. It writes and reads only the V3 version of windows bmp. I prefixed everything with '_' and made everything static because I want to be able to insert this code anywhere and not have any conflicts. RGB() writes out 24 bit color BMP's. Gray() writes out grayscale, which is what I use far more often. Read() will consume either. A good c++ bmp library is EasyBMP.

Update May 21: all Write functions now process a specified rectangle from the input instead of the whole image. Added _ASCIIWriteGray() for debugging small portions of a bmp.

_bmp.h
test_bmp.c
where.bat (Apr 9 2008)

Yes, I know, "Boooo windows!" but I do use the cmd shell quite a bit and there is no equivalent to the unix 'whereis' or 'whence' in windows so I wrote my own little .bat to do the same thing.

@echo off
setlocal

rem This scans the path looking for any files matching the first argument.
rem Wildcards work beautifully!

for %%a in ("%path:;=" "%") do (
  if exist %%a\%1 (
    dir %%a\%1
  )
)
          
I put that file in "c:\bat\" and add that directory to my windows path. I call it "_where.bat" using the "_" to make it unique from anything that could be on the path. From the shell I just do "_where winmm*" to find all libaries or programs or anything on the path beginning with "winmm". This is the most awesome .bat I've ever written!
path.bat (Apr 9 2008)
I'm so sick of looking at endlessly long paths that wrap around the screen so I wrote a .bat to split it up and echo each dir, that's all.
@echo off
setlocal

rem all this does is split the path on ';' and displays each directory name
rem on a separate line
for %%a in ("%path:;=" "%") do (
  echo %%a
)
          
Binary File Compare (Mar 4 2008)

I just wanted a drag and drop utility to tell me if files are exactly the same or not, just like the old unix 'cmp'. Had to be drag and drop. I grew sick of all the idiots trying to charge money... like I'm going to pay $30 so I can do a diff on hex files... It's in Java because Java is awesome, so make sure Java's installed.

Update May 22: minor tweaks

Executable JAR file (6kb)
Source Code JAR (4kb)

Double click on compare.jar and drag files to the two input labels and click compare. I typically add 'c:\bin' to my PATH, copy compare.jar to 'c:\bin' and at a command prompt type: compare.jar

To build:

          > jar x CompareSource.jar
          > javac Compare.java
          > jar cvfe Compare.jar Compare *.class