Read The Power of Habit by Charles Duhigg. He has some good suggestions. One of the best ideas in there is that certain small habit changes create behavioral cascades. For people trying to lose weight, just writing down what they eat at each meal has a huge effect. When you make up in the morning, making your bed increases the likelihood that you'll do other things that require discipline. The idea is to get many small wins, because they accumulate and give you momentum to tackle harder and harder tasks. When you draw up your goals, the trick is to state the goal, imagine the obstacle that might prevent you from achieving it, and then figure out what you'll do in that scenario. That's the thinking behind the WOOP app: http://www.woopmylife.org/ which I'm not affiliated with, fwiw. Finally, in your HN profile set "noprocrast" to yes. ;)
The best takeaway from that book is the "cycle" of habit: cue -> routine -> reward. The message of the book is that if you have a bad habit, e.g. smoking, there is a "cue" that causes you to engage in the "routine" of smoking, for the "reward" of nicotine. Unfortunately, these cycles are hard wired into our brain, so once they're fully established, we can't change them. The author offers the solution: keep the "cue" and the "reward," but change the "routine." The first step is recognizing the cue. Once you know what it is, you can replace the "routine" with something more benign, that also leads to a reward.
So for procrastination, maybe the "cue" is your code compiling, and the "routine" is typing "n -> down -> enter" into your address bar to get to hacker news, and the reward is some sort of stimulus. You can fix this habit by recognizing the "cue" of code compiling, and swapping it out for a new routine, like 30 pushups, to get a stimulus reward of energy.