(1) Learning how to program
(2) Hacking hardware
(3) Learning Andy McKee Rylynn on guitar while only knowing Wonderwall (there's a YouTube tutorial).
(4) Breathing/anapana/'basic'/the-first-meditation-beginners learn meditation and Tonglen (see the book search inside yourself for instructions) meditation [1].
(5) In general: by bootcamping yourself. Also known as being woefully underprepared and then just do it for 8 to 16 hours per day (the hours depend on how the rest of your life balance is, your health must be ok).
I wasn't talented at hardware hacking and hated programming when I started with it. It was my curiosity that said: can't you learn to like it? You can create awesome things with it!
Curiosity + the promise of creating awesome things + observing myself and being rational on how to influence myself = learning how to program despite hating it initially.
But in general: focus a lot on what you're doing and focus as deep as you possibly can and do that for as long as possible. This state is in some was easier to get into if you're doing a topic that seems super hard for you to learn and that you don't know a lot about.
For physical toughness: learn the Wim Hof Method -- adrenaline whenever you want it. I'm pretty sure that will help for developing physical toughness.
[1] In my experiene the following meditations don't develop mental toughness, they only develop empathy or a form of emotional intelligence: Vipassana/body scan/mindfulness, loving kindness keditation/metta (yes the same metta as my username implies).