For me it was in a Paul Graham essay, the title of which escapes me now. The advice was simple: if you have a hard time deciding whether to do one thing or the other, always choose the harder thing. That way, you rule out being lazy.
I can't tell you how many times I've used that piece of advice and seen the benefits.
He said if something is truly hard to do, put it off as long as possible. But if something is merely distasteful, do it as soon as possible.
The rationale is that if something is truly hard to do, you can spend time thinking about it, researching it, gathering resources and asking others about it while doing other necessary things. Oftentimes, there will be a way to make the hard thing easier or even unnecessary.
But if something is more distasteful than hard-to-do, you need to do it right away. It's worse to put off distasteful things than just get them over with.
Anyway, that bit of wisdom has worked for me. In programming specifically, I also endorse David Heinemeier Hansson's advice: "If something is too hard it means that you're not cheating enough."