Personally for me, I take a nice long walk out in the middle of the night and go to mcdonalds, get myself a nice cup of coffee, and sit in the parking lot drinking it and admiring the night. Especially if it is a snowy night. Even better if your roommate or friend tags along.
In these moments, I forget all my worries for a while and come back home de-stressed and filled with motivation to finish my tasks.