The Log of Hal Canary


Some progress, but not enough.


It's a girl!

Margaret (Peggy) Rose Canary was born at 1:16 p.m on Thursday, August 28, after a little more than four hours of intervention-free, unmedicated labor (three and a half hours at home and a half hour in the hospital). She weighed six pounds and fifteen ounces and was nineteen and three quarters inches long.

Optimal Region Projection

I am published again!

Hal Canary, Russell M. Taylor II, Cory Quammen, Scott Pratt, Facundo A. Gómez, Brian O'Shea, Christopher G. Healey. “Visualizing Likelihood Density Functions via Optimal Region Projection.” Computers & Graphics 41 (2014): 62-71.


When I started this site around ten years ago, I wanted something more reliable than a computer sitting in my bedroom, but still affordable. I ended up going with a service that provided a LAMP stack (Linux, Apache, MySQL, PHP). I blogged with Movable Type until Wordpress came along.

Now, I've simply uploaded the site to cloud storage and wrote some scripts to generate the site and automate uploads.

Current Location

Updated Contact Info



  • 4499ECF1
    fingerprint: B4E9 52DA 192C 4632 D772 0200 0670 403E 4499 ECF1


Personal email

  • mailto: halcanary at gmail dot com

Alternate email

  • mailto: hal at cs dot unc dot edu
  • mailto: canary at unc dot edu
  • mailto: halcanary at yahoo dot com

Expired email

  • mailto: h3 at halcanary dot org
  • mailto: [*] at halcanary dot org
  • mailto: canary at email dot unc dot edu
  • mailto: big_geek at halcanary dot org
  • mailto: hwcanary at eagle dot fgcu dot edu
  • mailto: hal at ups dot physics dot wisc dot edu
  • mailto: hwcanary at students dot wisc dot edu


  • skype: hal.canary


Obviously, current fiscal and monitary policy isn't working:


I propose: a larger deficit and a higher inflation target.

Color in shell scripts (not prompts)



# ANSI Color -- use these variables to easily have
# different color and format output. Make sure to
# output the reset sequence after colors (f =
# foreground, b = background), and use the 'off'
# feature for anything you turn on.
# This function is: Copyright 2004 Dave Taylor
# from book _Wicked_Cool_Shell_Scripts_,
# ISBN 1593270127.
# http://www.intuitive.com/wicked/showscript.cgi?011-colors.sh
initializeANSI() {
    esc=$(printf '\033')

    blackf="${esc}[30m"; redf="${esc}[31m";
    yellowf="${esc}[33m" bluef="${esc}[34m";
    cyanf="${esc}[36m"; whitef="${esc}[37m";
    greenf="${esc}[32m"; purplef="${esc}[35m";

    blackb="${esc}[40m"; redb="${esc}[41m";
    yellowb="${esc}[43m" blueb="${esc}[44m";
    cyanb="${esc}[46m"; whiteb="${esc}[47m";
    greenb="${esc}[42m"; purpleb="${esc}[45m";

    boldon="${esc}[1m"; boldoff="${esc}[22m";
    italicson="${esc}[3m"; italicsoff="${esc}[23m";
    ulon="${esc}[4m"; uloff="${esc}[24m";
    invon="${esc}[7m"; invoff="${esc}[27m";

## The rest of the program is:
## Copyright 2007 Hal Canary
## Dedicated to the public domain.
COLORS="red green yellow blue purple cyan white black"
for B in $COLORS; do
    for F in $COLORS; do
        eval FC=\${${F}f}
        eval BC=\${${B}b}
        echo -en "${FC}${BC}${F}f ${B}b${reset} \t"
        echo -en "${boldon}${FC}${BC}${F}f ${B}b bold${reset} \t"
        echo -e "${FC}${BC}${italicson}${F}f ${B}b italics${reset}"
        echo -en "${ulon}${FC}${BC}${F}f ${B}b ul${reset} \t"
        echo -en "${boldon}${ulon}${FC}${BC}${F}f ${B}b bol ul${reset}\t"
        echo -en "${boldon}${ulon}${italicson}${FC}${BC}"
        echo -e "${F}f ${B}b bold ul italics${reset}"
    echo ""
exit 0

or just use xdg-open

How to ask the desktop to open a file from a shell script? Define this function:

getopencmd() {
    case "$(uname -s)" in
        *WIN*|*W32*) command -v "start";;
        Darwin) command -v "open";;
        *)  command -v "xdg-open" || \
            command -v "gvfs-open" || \
            command -v "kde-open" || \
            command -v "exo-open" ; esac; }


Your challenge: make a pretty postscript picture as one tweet. "%!\n" is not necessary (tweet)

300 300 translate newpath 3 0 2 copy moveto 604 { 5 add
exch 1.01 mul exch 2 copy cos mul 3 copy pop sin mul
lineto } repeat stroke showpage


/n 90 def 150 150 translate newpath n n moveto 36 { 170
rotate n n lineto} repeat stroke showpage


/box { newpath moveto 72 0 rlineto 0 72 rlineto -72 0
rlineto closepath stroke } def 99 99 translate 0 1 5{60
rotate -20 0 box}for showpage


/Courier findfont 50 scalefont setfont 150 250 moveto
(#postscriptchallenge) { 1 string dup 0 4 3 roll put
show -18 rotate} forall

Note: to display these,m I used this command:

gs -sDEVICE=png16m -g500x500 -sOutputFile=out.png <<EOF
300 300 translate newpath 3 0 2 copy moveto 604 { 5 add
exch 1.01 mul exch 2 copy cos mul 3 copy pop sin mul
lineto } repeat stroke showpage