What you described could be symptoms of undiagnosed ADHD. The brain fog, only 5-10 days of random great/motivated days.
Contrary to popular belief, people with ADHD can be very smart and successful without even realizing they have it. Check out the ADHD subreddit and TotallyADD.com.