From the way you write, and the level of self-awareness you have accompanied by such a lack of control, it sounds as if you might have some ADHD. Do a little research, see a psychiatrist and ask. If ADHD is indeed what you suffer from, medication can help you. It will help marshal your thoughts and not give in to impulsive snark.