From the Canyon Edge -- :-Dustin

Wednesday, September 15, 2010

Learning to Wink, Learning to Code


My wife, Kim, isn't a hacker.

She's a kindergarten teacher. She likes to crochet, and she's pulling a needle and thread through some embroidery on the couch next to me right now.

And this is why I nearly choked on my tortilla chips at the Red Iguana in Salt Lake City a few days ago when she asked me, "When you say you're coding, what are you actually doing?", soon followed by, "So why do you hate on Java so much?"

Kim wasn't asking just to wind me up or kill time -- she was genuinely curious about my work, perhaps for the first time. Fortunately, we had a 3+ hour drive after dinner that night. In the passenger seat, she cracked open her Lenovo S10-2 netbook running Ubuntu 10.04 and wrote hello world in 5 different languages: C, Perl, Python, Shell, and Java. Kim particularly liked how Gedit color coded her syntax.

We worked through the difference between compiled and interpreted languages. Unsurprisingly, she found Perl, Python, and Shell straightforward, and C slightly more complicated.

Her favorite language after 30 minutes of experimentation was Shell, so we decided to try something slightly more interesting: input and output. Here's what she came up with:
#!/bin/sh
echo "what is your favorite color?"
color=$(head -n1)
echo "oh, $color is my favorite too"
Kim finally asked, "What is this Byobu thing you're always talking about?" Yep, I lit up like a light again. So I demonstrated Byobu for her, and she took to the status notifications at the bottom of the screen.

She suggested creating a plug in that would remind me to take a break from work periodically and have dinner :-) We shelved that one for now, and instead, she made a plug in that "winks" every few seconds. Here's her code:

/home/kim/.byobu/bin/2_wink
#!/bin/sh
if [ -f /tmp/wink ]; then
echo ":)"
rm /tmp/wink
else
echo ";)"
touch /tmp/wink
fi
She made it executable with:
chmod +x /home/kim/.byobu/bin/2_wink
And a few seconds later, Byobu is winking at her!

I'm extremely proud of Kim's keen curiosity about my work, and particularly her follow-through . I'm not sure I'll be crocheting a doily any time soon, but I am running her winky face notification in Byobu. It reminds me what a lucky guy I am. ;-)

:-Dustin