If you're autistic, try embedded programming, assembly, ANSI C. The good shit.
Failing that, the best way I've found to do this is a meditative exercise. For about 10-20 minutes before you start working, sit down and clear your mind. Then, visualize gathering all your negative feelings together inside of you and breathing them out in the form of a dark cloud. Breathe in positive feelings instead, in the form of a luminescent cloud. Your breathing here should be 4-4-4-4, breathe in, hold, breathe out, hold, making sure you use your entire lung (vase breath). Do this by stretching your left arm fully to the left, then holding your left nostril closed with your left arm with your elbow at shoulder height, breathe in, hold, forcefully breathe out, hold, then mirror the movement with your right arm on the right side. Do each side 3 times, then breathe in fully and lean forward until you bend about 90 degrees, pressing the last bit of air out of your lungs. Then just meditate with a clear mind, and as the end nears, tell yourself you love this work and are happy to be doing it, visualizing good feelings as a luminescent cloud you breathe in through your entire being, not just your nostrils, but your skin as well.
I know it sounds new agey, but just test it out.