A few years ago I was in a situation remarkably similar to yours and I found that getting a stable long term girlfriend was extremely helpful in keeping me on a good trajectory. Ironically, the only real way to achieve this is to already be on that trajectory. One strategy is to focus on getting really good at something you're interested in. Your mastery will attract both women and employment and the process is not unenjoyable. Another attractive trait (to both mates and employers) is healthiness, so eat healthy things, take vitamin D supplements if you're far away from the equator, and get at least some exercise every day (15 minutes is fine). Building these habits can have positive effects on your mental state as well.