My way of getting those 6 solid hours was a common hacker solution to the problem: I used the hours between 9 pm and 3 am, when no one could interrupt me.
Also, I've read that taking short naps for about 20 minutes (any longer would make you groggy) helps improve learning potential and confidence.
At night, I'm more likely to keep plugging away at something until it's done. Also, it's often easier to concentrate on only one thing at a time. It's quiet, and there's no nagging idea that there's something else I could be doing. I've also got a whole day's worth of memory and context stored up.
At night, I'm less likely to make intuitive leaps that solve problems, and I'm less likely to want to do things that are mentally difficult. I'm more likely to get frustrated at complicated problems and make stupid mistakes.
It occurs to me that with 6 hours of productive hacking, you could in theory start a startup and still have a day job, except for the interruptions. For example, all three of my most productive periods are bisected by an hour-long commute or the need to go to bed, making them effectively useless. Has anyone tried telecommuting + startup, or consulting + startup? It seems like if I could shift my working hours to 2:00 - 10:00 PM and get rid of commuting time, I'd be able to get all the work for my day job done in the 5:00-7:00 PM timeslot, and have 6 hours of useful time for my own projects.
Actually, I should probably clarify - when doing active product development, it takes way more than 2 hrs/day of work. At that point, you can basically forget about doing any outside programming projects. But most jobs are very feast-or-famine: once you've written the program, you have little bug reports dribble in, or your boss asks you to reboot the server or something. If you architected the program well, it shouldn't take more than 2 hrs/day to keep up with those.
And I also manage a 1.5 hour bicycle ride in there and some time with my kids.