You can keep from entertaining negative thoughts and imagery. The way to get rid of darkness is with light; the way to overcome cold is with heat; the way to overcome the negative thought is to substitute the good thought. Affirm the good and the bad will vanish.