I study computer science and any time I sit down to code, I just browse or watch Youtube. Anything but do the work. Days and even months have gone by like this where I haven't done even an hour of learning. Its tough because in order to code I need to be in front of a screen but my brain refuses to study and just looks for that dopamine hit. My grades have suffered and I feel like a constant failure.
To clarify this is not an effect of the pandemic but has been happening for the past few years.
For me I've worked out that I don't respond well to rules, but I do respond well to real deadlines and stuff that I care about doing. The only CS projects that I have put serious time into have been stuff where I have a higher goal (create html CV to get job, create coronavirus graphs to understand if it's Bad) and the only time I'm good at school work is if the deadline is soon enough — and fake deadlines don't do anything for me. I think doing some meta thinking about when you have successfully been able to work (if you can't think then try different strategies) and go from there.
For social media addiction stuff, I've found putting my phone out of eye sight and reach; and having a browser with 'fun' on a different virtual desktop helps keep me on task. If I can see the thing it reminds me that social media exists and maybe I should check it just in case. My brain seems to think quickly checking sometihng that is open is fine, but expending effort to check the thing is not fine, even if it's not that much effort
A lot of these things have worked for me, and I'll add two more: