It's no secret that having to wait while coding breaks you out of "the zone". Even worse, you might get sucked in by some activity (like SO) and suddenly realize you've just wasted yet another half an hour. Long compile times are often mentioned in this context, but there are many other things with the same effect - programs that open slowly, files that need to be uploaded, scripts that take time to execute, etc. The net result is the same.
Sure, it's an argument to get better hardware, but let's face it - not all of us can afford top-notch computers, and even on those there are some things that just take time.
So - how do you cope with this problem? What do you do during the wait that makes it easier to return to coding afterwards?
(P.S. If this question has already been asked, I wasn't able to find it)