You may find it useful to counter negative thoughts with positive affirmations. You can use affirmations to build confidence and change negative behaviour patterns into positive ones. You can base affirmations on clear, rational assessments of fact, and use them to undo the damage that negative thinking may have done to your self-confidence.
Examples of affirmations are:
* I can do this.
* I can achieve my goals.
* I am completely myself and people will like me for myself.
* I am completely in control of my life.
* I learn from my mistakes. They increase the basis of experience on which I can draw.
* I am a good valued person in my own right.
Traditionally people have advocated positive thinking almost recklessly, as if it is a solution to everything. It should be used with common sense. No amount of positive thinking will make everyone who applies it an Olympic champion marathon runner (though an Olympic marathon runner is unlikely to have reached this level without being pretty good at positive thinking). Firstly decide rationally what goals you can realistically attain with hard work, and then use positive thinking to reinforce these.