This may sound stupid, but you can try looking up the stories of people who had really hard luck and struggled, and finally were able to make a life for themselves. Their stories can remind you that even after enduring incredible hardships, you can overcome them, even if you don't know how yet.
I also suggest meditating on death and life. Ask yourself what's the worst thing that could happen. Usually it's not death, which means you can survive whatever the worst thing is. Then you can ask yourself what good things do you have right now. If you're warm, safe, and have food, you've covered all the base requirements! Can you hear, see? Then you can also listen to music and look at nature/art. Even when things are falling apart, we usually still have pretty amazing lives.