David Goggins's Cookie Jar technique is a motivation technique using visualization. The cookie jar is a mind palace filled with mental images of events and people triggering a strong emotional response, both negative and positive.
The idea is to use this mental imagery to force a hormonal response within your body that will act as a lifeline throughout your hardest moments.
It's not as wild as it sounds. It's been proven that playing tennis, watching someone playing tennis or imagining yourself playing tennis triggers the same parts of your brain called mirror neurons. Imagining a past event and how it affected you is no different.
There are really two kinds of cookies: the sweet ones and the bitter ones.
Sweet cookies rely on positive emotions: gratitude, compassion, love, victory, joy. On the contrary, the bitter ones originate from negative feelings: anger, frustration, pain, sadness, fear. It might remind you of Star Wars' concepts of the light side and the dark side of the Force.
Personally, I know I'm much better at being a passive-aggressive Sith Lord. Adversity has always been my greatest trigger to surpass myself. The mix of anger and frustration is particularly explosive. I shine best when I'm told I can't do something. I can become a great prick when I'm trying to prove people wrong, and I take great pleasure in playing the role of the underdog.
This is not a great mindset though. Negativity is a synonym of bad health. Replacing bitterness with sweetness is key, but I'm not pretty good at it. It's something I'm working on by walking and meditating.