I started a "universal problemsolving" journal a few months ago — whenever anything goes wrong, I write down (1) what happened, (2) the universal problems / root causes that might underlie that problem, and (3) generalized countermeasures for that situation in the future.
Many of these are basic, boring stuff — "Lack of Relevant Supplies" is a universal problem; lacking food or coffee at home makes the morning run worse. (The countermeasure is having adequate secondary stocks of supplies, and I adjusted my grocery orders accordingly after realizing it.)
Some of them are interesting, though.
Perhaps the most interesting general countermeasure is "Just Suffer Until It Passes."
Sometimes you lie down and can't sleep. What do most people do? Get up and do something stimulating.
Boredom. What do most people do? Do something stimulating.
If you've ever done mindfulness meditation, even for just 5-10 minutes per day, you know that there's periods of massive raw unpleasantness than occur from time to time. You want to get up and stop meditating.
The answer? Just... suffer until it passes.
You can quibble with the wording — some people won't like the word "suffer"... feel free to swap in "endure" or even "wait" for a more neutral-valence word.
But I'm starting to realize a lot of problems aren't huge problems in-and-of themselves, and it's the flight to distraction and stimulation that compound the problem and create bad ongoing habits (internet surfing, games, junk food, whatever).
Potential Takeaways —
(1) I'm getting immense mileage out of my Universal Problemsolving journal. Feel free to think about it and try something like it out. If there's interest, I might write up how I go about doing it.
(2) "Just Suffer [Endure/Wait/Whatever] Until It Passes" — it's possible to accept negative affect and wait, and it... passes. This is often more productive than trying to banish it via distraction or stimulation, which often compounds the problem at hand.