Hi,
Please read the book of Job from beginning to end. It will tell you what God says about when bad things happen to good people. Only until you worship and humble yourself before God will you improve. Relying on yourself will never work. You need to humble yourself and bow before God and ask him to help you do his commandments. Say the Lord's prayer often, the prayer Jesus taught us to pray. It is the perfect prayer. Also God warns you against "spiritists", those who claim to have all the answers etc. and give false hopes by believing in men who promise everything but deliver nothing. Jesus said, "By their fruit will you know them". You will see if someone is really a prophet or God-fearing person by their actions, not by their rhetoric.
Your quote, "As a man thinketh, so is he", apparently comes from the book "Power of the subconscious mind". I've read through that once in my life because I've researched various theories of the mind for various classes. What I hate about that book is he uses the Bible to illustrate his points. He uses and abuses the Bible for his own aims. He doesn't really believe in God apparently, yet he "uses" it and quotes scripture to give him the physical or mental benefits he describes in his book. That is a "spiritist" the Bible warns us against. He suggests it doesn't matter what you believe in as long as you believe in something. He is another lost sheep who does not believe in God and what He said in the Bible. Yet he's promoting you think of good things rather than bad, which is better than others could do.
Is it possible that non-believers can do good things? Yes. As the Bible says, the spirit of God was written on the hearts of man from birth. So everyone is capable of showing the fruits of the spirit. However, to be saved, to have a long life, to be happy, to be successful, you must believe in God, not just anything. There are more believers in the Bible than in any other book, and there's a reason. At one point there was very clear evidence of miracles to many people, and the fruits of the prophet Moses especially (which Muslims also believe in) and all the miracles he performed in front of all of Israel, and then when Jesus came and performed all those miracles, and even more important than the miracles was the way he conducted Himself and was sinless.
For even further evidence, God said to Moses that the life of every creature is in the blood. This was 3000 years before the first person discovered the circulation of the blood in the human body! Yet it was found in an Ancient text of the Bible. Also, all the foods God told us to eat are those
Science is just beginning to understand have remarkable properties, and everyone who eats them lives very long. All the orders He gave Moses about sanitation, epidemic control, which meats were unclean are all having very real basis in modern
Science and disease control. I'm not saying I can claim to have an innate knowledge of anything God does, because He has done everything and me nothing.
What I'm saying here is that you can't believe in just anything and do well, you have to believe in God. Being selfish and relying on yourself will make you feel bad forever. You said if it wasn't for you talking to yourself, you may have committed suicide. Well I promise you that if you had taken the tiem to read through the Bible amd analyze it and try to understand its wisdom, I think it's impossible to not be optimistic and God-fearing and upright, and hopeful for the future. I hope this helps and you take it to heart.