Your situation and mine seem very similar, it sounds like. I went to a technical high school, then studied computer science in university. My concussion came when I was 33 and my post-concussion syndrome just entered its 11th year. I wasn't able to do much of anything for several months, certainly not programming, but also not reading, nor even watching TV for more than ~15 minutes at a time. A neuropsychological exam was extremely interesting, I thought, picking out the specific areas that were most affected. My "verbal fluency" dropped precipitously, for instance. While talking, my brain will sometimes just stop mid-sentence for several seconds, or I can't find the right words. It's like a stutter, but where someone stuttering knows the word they want to say, I can't get to that point.

Over that first year, though, things did slowly improve. I started working again, as a software developer, but only a couple hours a day. "Find a supportive employer" isn't helpful advice, I know, and I was extremely lucky I was working at such a place. The important piece, though, is that I was able to start finding routines and patterns with how much mental energy I'd have at different points in the day and week. Around the one year mark, I'd improved enough and found a routine that let me get back to working full time, but on an altered schedule. I work a few hours in the morning, take several hours off, then finish my day later on.

Experimenting to figure out how much I could do at a stretch, and what sort of breaks I needed in between working periods, let me understand my injury a lot more and adapt my life around it. I'd feel best Monday mornings, after a weekend, but if I didn't watch my work time like a hawk, I'd be useless come Thursday or Friday. There's the mental health "spoons" metaphor, where you get a certain number of spoons per day, then everything you do costs some number of them. When you're out of spoons, you're out, and there'll be stuff you just can't do. It's the same for me, but I think of it as a weekly thing. I get my 40 units of brain-on time each week or so. Working counts against that heavily, but even something like listening to music in the car runs down the clock.

So, all that said, first, you've got my deepest sympathies. I hope your condition improves soon!

As some more practical advice, practice advocating for yourself, and when you're unable to, try to find someone who can on your behalf. Don't be cagey about it either, but tell your friends why -- "Sorry, I can't, my headache is awful right now and I just need to be alone and quiet." Don't be afraid to cancel plans either. It's frustrating to have to do so, but if the result of attending is having to spend the next 24 hours in a dark room, it's probably not worth it. You might put some people off, but your friends will understand.

Next, find hobbies that don't tax your brain, or at least, don't tax your brain in the same way. Programming as a hobby is pretty much off the table for me, for instance. Doing crossword puzzles, though, seems like it exercises different parts of my mind. I designed and build a 3d printer, and continue to tinker with it. I've delved deeper into more aspects of photography. There are plenty of options, but the important thing is to find some things that won't drain you, leaving you able to do the work/school stuff you have to do, but also not making you sit idly by while you recollect your energy.

Finally, regarding work and school, I'd suggest avoiding freelance work. It's more stressful, since it'll be on you to continually find work. It's also easy to end up as the single person who can fix someone else's urgent problem, which is exactly what you don't want, especially early on during recovery. If you go to university, look for job resources there. There might be on-campus jobs to apply for, which would probably be part-time gigs, or something similar for external companies. Either way, try to develop relationships and prove your value to the staff and faculty, then parlay that into a longer-term role.

Once again, best of luck to you. I hope this has been helpful in some way -- if so (or if not), feel free to PM me if I can help, or you just want to vent about the neurotypicals.