I've been there. I was staying up way too late and when I did sleep I'd be laying in bed for hours before I finally dozed off. I had things I wanted to do, but since I didn't have the energy to do them I started feeling worse, which left me with less energy. You're describing a classic cycle of ADHD depression.
I fixed mine by jolting myself out of my routine. I went back to school. I suddenly had a whole new batch of problems and dealing with new problems that felt immediate was what I needed.
For you, based on what I know now (I'm in my 40s), I have some advice:
- put the coding project down for now. Don't make that the thing you ought to be doing. Put your notebooks in a box and the code in an archived folder.
- get outside. Go for walks. Find a hiking trail. Listen to some podcasts. Walk at least a mile every day. Use that as thinking/meditation time
- stop getting high. The best way I've heard it said was from someone in my support group: "getting high makes you ok with being bored." That's killing a lot of your motivation.
- Work very hard on getting good sleep. This is the hardest and I never really figured it out until my late 30s, but good sleep will fix most of your issues. Unfortunately, getting good sleep is difficult. You need to mentally and physically exhaust yourself daily, and it sounds like you're doing neither. Start by trying to physically exhaust yourself, whether it's the gym or something else. Expand from there.
If you'd like more help, feel free to DM me. I've been where you are, and it sucks. You can find contact info in my bio. Good luck!