There are many things that you can do against sleeping problems, including:
-Take yourself enough time to sleep. You should try to go for 1 hour minimum.
-Trying to do daily exercises, especially a little bit of cardio.
-Avoid the consumption of caffeine, sugar, especially towards the evening, and avoid drugs in general (as sleeping problems bear the risk of causing addiction if you attempt self-medication).
-Try to keep a overall healthy diet.
-Try to avoid media consumption and the use of screens in the last hour before you go to bed.
There are also strategies for time management. Set yourself fixed hours that you try to spent on your hobby (=> coding), and were you try to keep yourself from spending your time on other subjects. Consider using tools to limit your access to sites where you think you spent too much time on.
⚑ Moderators Note ⚑
Health questions and problems are delicate subjects, and they might exceed the capacity of this forum. We'll try it for now, but please be careful, both when giving advice, and when disclosing health related information. I also removed the photography at the OP for this reason.