I read this question about falling behind, but my question is more about the long term.
I find myself becoming depressed at lack of overall opportunities in graduate school (in mathematics, specifically, though this question is more about the general case). I had a bad relationship that messed up a few semesters for me at the beginning of grad school. I'm more or less recovered now, but I'm having difficulty trying to support my progress in any way outside of classes.
My field is computational, so I really want to get a summer internship at a software company, government agency, or some other place where I can get exposure to research and skills that are not immediately available in the department (like coding). My advisor's perception of me formed during my period of low performance, too, so he hasn't invested much in teaching me. I have some mediocre grades on my transcript from this time, so the profs from these classes so far don't have such a good impression of me, either. I don't know who to ask for recommendation letters or networking opportunities. I had shining recommendations from undergrad, but that was years ago, which will raise obvious questions on any application.
Meanwhile, my friends are doing interesting projects they can associate with their name. They're giving talks, going to conferences with their advisors, being awarded fellowships, etc. Feeling like I have nothing going on except for classes and an advisor that doesn't believe in me is no good, and though I'm performing better than before, I am still far under what I know to be my potential.
In other words, I feel like I'm stuck in a cycle of poor opportunities, and I'm not sure how to break out of it. I had a lot of momentum when I came here. People were offering me all manner of things, I had many side-projects in different areas, and I was beginning to make a name for myself in research. Now, all I do is try to get my homework in on time. I'm just bored, and don't know how to get back to a successful state of mind.
How could one recover from this type of setback?