For those of you who survived reading the Odyssey, you may remember the part where his crew had to pass by the Sirens, whose voices would lure sailors to their watery doom. To get by safely, Odysseus (Odie to his friends) gave his crew noise-cancelling headphones, or maybe wax earplugs, so they couldn't hear anything. However, he wanted to hear them and survive to tell the tale, so he had the crew tie him to the mast of the ship and refuse to release him no matter how hard he tried to convince them.
Odie knew his will power would not be enough to stop him from giving into the temptation of the Sirens. So, he created a scenario where he *couldn't* give in - even when he wanted to. I've been calling this approach "lashing to the mast" in his honor (Google tells me 277,000 other people had the same idea...). The principle is simple: if you know something is going to tempt you, set your world up in a way that makes it impossible (or at least difficult) to give in.
"Commitment devices" is a general term for this kind of approach. It can take may forms, but one of the more popular is an accountability agreement. If you don't follow through on your commitment, you face a penalty/ridicule/look of disappointment from your partner. This is the reasoning behind the advice to have a partner to work out with, so they provide that accountability.
Another fitness approach is the clearing out of the fridge. The new dieter will go through their kitchen and get rid of everything that isn't in line with the new eating plan. Of course, they can just go back and re-buy it, but the added hassle makes it a little easier to resist the temptation.
Another temptation, and one I have trouble with myself, is surfing sites when I should be working. (I've lost hours on Wiki-fueled explorations) To address this, I use an extension for Chrome called StayFocusd. The premise is simple: I have so much time per working day (15 minutes) on those sites and then it will block access with a friendly "shouldn't you be working" message. You can configure the sites to block, allowed sites, time of day/day of week it's active etc. Because it's a Chrome extension, I can easily use another browser to bypass it, but I find that that extra step is enough to remind me why I installed it in the first place.
Hopefully, some of these ideas will help you (and me) avoid more of the things we know we shouldn't be doing, but find ourselves doing anyway...