If it's something recurrent and really bothering you, you may want to see a therapist. I don't deal with trauma, just ... Here are some personnal thoughts that may help... Or not.
* Getting too busy to think about it or trying to think about something else everytime you have these thoughts may work with enough time, but is a double edged sword as well, as you may forget things you would prefer remembering on the long run.
* Thinking deeply about what happened, what you think you did wrong and compartimentalize these elements should help you understand what you don't like about these events, and what was outside your power to influence, taking into account your emotions at the moment.
* Now you can't change what happened but you can be someone who tries not to do these mistakes or shameful things again. And remember that change takes time. Think about who you want to be in relation to these experiences and imagine what you would have liked to do. The next time you may still do it. Maybe the time after you'll try but make another mistake, and maybe you'll never really manage to fixe things. But by trying to, you already become a better version of yourself.
* You should also try to think about things you did right, to put your previous thoughts into perspective.
* My final advice would be to cultivate experiences : go to events, meet with friends, work on things you like. And see that it's not at all the end of the world. There are so many people and so many things to do. You only made a few small mistakes in the grand scheme of things. Like everybody does. You may never be in the exact same situation you were in when you said this or that, but many similar experiences (mainly social interactions from what you wrote) can help put your previous experiences in perspective. Some friends will start with you, some will move on, and so should you. Move on, apologize if needed, make new friends, invite them somewhere, play games with them. Make them see your bad side is not all there is to you. All the while, you can work on yourself if you want to fix it.
* In the end (for real this time), some thoughts may still stay with you all the time. You remember them when you think a lot or in some situations. It's part of who you are and I don't know if you can simple get rid of them...