Here are my suggestions:

1. Accept that you will probably be less productive as you expect. Being angry that you're not fully productive will make you even less productive. Make your goal to be 'as productive as I can realistically be under my current circumstances'.

2. Aggressively pre-empt distractions if possible. Get rid of anything you might want to read or watch from your work environment. If you can do your work without it, turn off your phone. If you can do your work without it, turn off the internet. If there is noise around you, especially people talking, get earplugs or noise cancelling headphones. If you can't do your work without it, but you can limit your internet to essential work related things, or at least block your worst temptations (e.g. HN, reddit, youtube) in your hosts file, or in your router, or using your ISP's Parental Controls, do that. Don't even listen to music, when your brain power is low even that can suck away productivity. If you don't have earplugs but need to block out others talking, listen to white noise, just not so loud as to damage your hearing obviously.

3. Consider negotiating with yourself. What's a reasonable amount of work you can get done in your current condition? Commit to it, and also commit to stopping when its done. Expect to crash a few hours after getting up and don't punish yourself when it happens.

4. Get to work ASAP after waking up to make the most of your most productive hours. If you can put off any chores, even showering & dressing & brushing teeth, more than basic food, do it. Your first four hours after waking up will be the most productive, use them to do what's critical.

5. Caffeine. Consider caffeine with the other items in this list to commit to and achieve a limited number of productive hours. Then accept the rest of the day as recovey or unproductive, or rest as reward for sticking to your commitment of, e.g. 2 or 4 solid hours of work. Or maybe 6 - 4 in the morning, nap then 2 more in the evening. Second to the hours after waking up, you are most awake in the early evening.

6. Eat. Second after light, eating food influences your circadian rhythm. I.e. eating wakes you up. But don't eat a lot that will make you fall asleep. So eat, eat some, eat regularly, but don't pig out.

7. Consider a controlled nap, 2 hours max, after lunch, to get some boost in productivity in the afternoon. Commit to a time, set an alarm. Maybe prep some food or caffeine you can consume as a reward for getting up when the alarm goes off to make sure you don't stay in bed.

8. Long term - practice some form of concentration meditation. A lot of Buddhist monks are trained under sleep deprivation. It doesn't make sense to me - but if they can enter samatha (a concentrated 'flow' like state) and even enlightenment under prolonged sleep deprivation, maybe it is possible to learn to concentrate under those conditions after all.

9. Forgive yourself. It is OK to be human. I had to hear/read this thousands of times before I started to understand it and be able to apply it. So here's 0.1% of a dose for you :-) It's amazingly powerful once you truly get it.

10. Remember why you're doing what your doing. Try to find a reason that really matters, and if you can't consider the possibility that you're doing the wrong thing. Bad reasons (unless you happen to be deeply and profoundly motivated by these reasons, in which case go ahead) status, money, fame, "I'm supposed to be able to do this", "I'm worthless if I don't do this", "I will disappoint X if I don't do this". Good reasons: I'm doing this to ensure a stable income in my retirement. I'm doing this to support my family. I'm doing this because the end product will help relieve people's suffering, I'm doing this because it's profoundly interesting or beautiful.

11. See a doctor, get a workup, get a sleep study, make sure there's nothing biological interfering with your sleep or body.

12. See a therapist, if possible/needed.