The tool is called anchoring, and it comes from a technique called Neuro-Linguistic Programming, or NLP. It is deceptively simple, but it works really well.
When you are in a positive headspace - feeling something like joy, peace, well-being, etc. - focus your full attention on that feeling and create a gesture. It can be any gesture (you'll want different gestures for different feelings), but make sure it isn't something you'd typically perform. For example, one of my gestures is touching the tip of my index finger of my left hand to the thumb of my left hand. Do this several times over a few days, focusing on the positive emotion you are feeling as you perform the gesture. Then, the next time you are in a negative space and want to access that positive feeling again, perform your gesture. It's that simple.