Fizzbuzz in bash

I’ve been able to get by in bash for a long time. I could read it just fine, but if I wanted to write it, I needed a cheat sheet by my side. I’ve decided that that wasn’t good enough–I should be actively practicing it, so that I know it off the top of my head.

Here’s a fizzbuzz implementation.


#!/usr/bin/env bash

topval=${1:-100}

for i in $(seq 1 $topval);
do
	if [ "$(($i % 15))" -eq "0" ]
	then
		echo fizzbuzz!
	elif [ "$(($i % 3))" -eq "0" ]
	then
		echo fizz!
	elif [ "$(($i % 5))" -eq "0" ]
	then
		echo buzz!
	else
		printf '%d\n' $i
	fi
done


What the Heck Is a Kernel?

I attempt to answer that question, for the sake of the layperson, in this Toastmasters speech I gave this afternoon.

My evaluations and feedback were overwhelmingly positive. I got a lot of praise not for just making this topic accessible, but for even trying in the first place. The audience liked my analogies and my jokes. Although my positioning on the stage is sometimes lacking, I was told today that I stood in the perfect place. Glad I finally found my clicker last night, or I’d have had to stand right by my laptop.

My evaluator had some good points about my examples. Yes, the modem is very outdated, and I knew it. I’d started out intending to describe what historically came next, but then lost sight of that, leaving the inappropriate example still there. Also, he zeroed in on the word I was grasping for: “multitasking.” It’s amazing how what we think we know deserts us at times.

It feels good to get out of my loop and connect with other Toastmasters like this. Thanks, Cadence AHgorithms, for welcoming me.

Why Don’t I Speak Up?

That was what I asked myself a couple of days ago at a company sponsored hackathon. The product was part of a domain I know practically nothing about; and of the languages that it understands, I have a skill level of about four in the secondary one and flat zero in the primary one. But I was fired up about hackathons, having gone to a Code Camp session evangelizing them, and I was eager to get out, learn, and, um, have some fun.

I spent the day before installing and studying the product. I scolded myself for waiting until the last minute. If I really had it together, I thought, I’d be ready to hit the ground running on a sophisticated app that had a shot at the prize. Instead, I wasted most of the day trying to understand why I kept getting the same cryptic error messages with every example on two different machines. Clearly, I was missing a dependency, or had a permissions problem, or something.

So when I showed up bright eyed and bushy tailed the next morning, that was my first question–what was wrong with my system? Embarrassingly, the person who helped me was the company’s founder. After about ten minutes of intense trial and error, he found it: the product’s API had changed, but the examples hadn’t been updated. He was a bit red faced, but kind and respectful.

(In fact, not only had the API been changed, but a complete redesign of the entire documentation site had been rolled out while I showered that morning. This wasn’t the first time I’d shot myself in the foot by trying to get a jump start. Once, in college, I finished the week’s assignment early and already had an outline written for the next week’s, only to learn in class that I’d been working on last semester’s assignment. The new assignment–uploaded to the class website at the last second–was completely different.)

As the day wore on, my frustrations piled up. There was another gotcha in the autogenerated template; a line was technically not incorrect, but was misleading to a noob like me. There was an iffy condition on the servers that led me to believe my app was failing, although my code was actually correct. And oh yes, it was alienating to be alone in a room full of nerdy males half my age. To top it all off, the tap in the bathroom sink was baffling. There was no clear affordance for controlling the flow, no motion sensor, and no moving parts. I ended up taking a bottle of drinking water to the bathroom to wash my hands.

The hosts genuinely did their best. They came by several times to make sure I was doing OK. One even said to me quite plainly, “Please ask! If something isn’t working or isn’t making sense, it’s probably not your fault. It’s probably our fault.” On one level, I understood that the glitches I was facing were part of getting a new product off the ground. Bumps in the road are intrinsic to moving forward, and are to be expected. I also knew that I “should” take things in stride.

On another level, one that was much more real to me, I was a bimbo. I thought of what the hosts had told me. I heard the young males asking their questions, basic conceptual questions about the product that even I understood. I also thought of what my mentors, my friends and supporters, countless articles, and practically every other supportive voice has told me: you have to speak up. You have to ask questions. It’s the way you learn. It’s the way you become part of the community. It’s the way you get things done.

But, I just couldn’t. The inner voice that told me that the woman who speaks up is an attention whore, a fraud looking for a free pass, a professional victim, shouted down everything else. I expected the hosts to lose patience with me, and the other participants to target me, even though they’d given no indication of doing so. During my final battle with the design failure in the bathroom I thought, if I’ve looked through the docs pages multiple times and the descriptions of those objects didn’t jump out at me, there’s no point in continuing. Asking how to use the API is humiliating; and even if this question gets answered, there will be another, and another. I’ve wasted enough time on this. I should cut my losses and leave now.

The rest of the day was shot. Instead of spending the reclaimed time on my other projects, which I thought would be a good way to get my confidence back, I played sudoku until 1am trying to drown my depression. Why, exactly, was I depressed? Was it because my fears were accurate? Or because I silenced myself and gave up? I don’t know.