It is really hard to be productive when our minds wander in the past or think of the future while living in the present. Often, simple techniques can help us get past it. One such technique is the Pomodoro technique. I was impressed after reading the article on Medium.
This webpage rings an alarm after steps 2 and 4.
Rules : 25 minutes of steady, focused work on ONE task. No multitasking. No emails. No phone calls. No checking Facebook. Nothing! No distractions allowed!