In general, by realising that I can't be motivated all the time on all subjects. Pick and choose what to prioritise at that point of time.
Understand how your mind work - I like to see the results of my effort relatively quickly, so I do small things in a less efficient way but still let me...