Hey man, a lot of suggestions in the thread, but I think you can also do some journaling. Just open your text editor and write whatever you're feeling. For me I thought this was stupid and a waste of time but it's nice to see your thoughts and see the progression of how you're thinking/feeling. I sometimes have crappy days where I write "I just played the Sims all day" or "I am really not in the mood" and I find that for some reason I can't keep on writing that same thing for several days in a row.
It's like when I write "I did crappy things" down, I get irritated with myself for not being productive and I want to do better things tomorrow. Not necessarily programming at first but something productive (like cook a meal, exercise, etc.).
Not sure if this will help but for me it did so hopefully it works? Also eat right and try to exercise. If you don't like exercise just take walks. I find walking to be therapeutic too