Tall and tan and young and lovely.
Doo doo doo doo doo duh-doo duh-doo
I’m a simple man, with simple tastes.
If I see Kate Bush, I upvote.
Well you're not wrong
The foundation of this ability originates from releasing yourself from attachment. In this example, you are not your pain and the pain has no intrinsic power over you. It isn't pain that disturbs us, it's our emotional response to the pain because of our attachment to our bodies. Overcome your bodily attachment (one's own body isn't even your own, it's impermanent) and there will be no sensation that can overcome you. Overcome your attachments to pleasant feelings, and eliminate your aversion to unpleasant feelings. Only then will your happiness cease to be conditional, and you will be impervious to the winds of suffering.
Source: 3 years as a novice monk in the tradition of Thich Nhat Hanh (Vietnamese Zen Buddhism), and study of Tibetan texts; most notably, The Dhammapada.
Take your filthy upvote and think about what you’ve done
It's all about "mind over matter". Still, I can't imagine how instincts don't just kick in and take over, must take a lot of self control and willpower.