Here is his answer from a Reddit AMA to the question "What kind of learning path would you recommend for aspiring hackers looking to sharpen their programming skills?"
I think this is great advice. There are few CS classes that demonstrate how unified theory and practice can be more than compilers and OS and, where Ryan says that the maths classes should be taken for pain, I'd point to Scott Aaronson's remark that "[t]hings like linear algebra, group theory, and probability have so many uses throughout science that learning them is like installing a firmware upgrade to your brain — and even the math you don’t use will stretch you in helpful ways".Take a hardcore compiler and/or OS class at your university, take real analysis and modern algebra - just to be exposed to pain. Work on projects.
Stretching is painful. And it's a good, and useful kind of pain.
The "work on projects" advice is general. But I'd use the stretching metaphor here too. Find something you're interested in, but that seems a little too hard for you at your current level of skill. Then try do it. You'll succeed or fail, but either way you'll learn.
Doing the same kind of project again and again isn't how we learn.