I don't think that there's any secret. Do something that motivates you and build the habits slowly and treat productivity like a muscle that you want to grow.
Trigger your brain to get in the flow of deep work and get your work done in half of the time . You can do it by finding an internal motivation or by creating those behavioral triggers to make you work like: pre-commitment, peer pressure, implementation intention, accountability or the specificity in the task definition. We implemented all these elements behind our start-up.
For me it's time blocking. The structure allows me to focus solely on the task at hand. But it also helps with structuring tasks that tend to take away from productivity ie set times during the day for email so the notifications don't pull me away from what I'm working on.
Everyone is different, and their pace of learning/problem-solving is different. Therefore what works for you could totally be detrimental to a different individual. If you can experiment and find the secret which clicks for you, it can change your perspective on what hard work is. For me, doing some physical exercise before starting on a problem was a game-changer. ⚡️