Yes, this is me. Staying focused can be hard, and I can get easily distracted.
I've found what works for me is using a 25 minute pomodoro timer to create bursts of productive time. I also block access to HN, PH, Reddit, and other websites that distract me during this time.
Personally, I use a mac app called Focus to do this (https://heyfocus.com/) but there are other tools and browser...