I helped myself with the head hitting by laughing at myself and supporting that poor self I was trying to hit; I say "trying" because I decided to slap myself (my stepmother use to) only I would jerk my head backwards so I would "miss". Once when socializing with my stepson(s) I made a verbal mistake and went to smack myself but was sitting on the couch and my head went back and hit the wall while I was trying to avoid the slap. It was very funny for all of us. Think about it, I'm so lame I can't even hit myself right?
When you call yourself a stupid idiot, immediately get in there and argue. Just say the first thing that comes into your head, "Who you calling a stupid idiot?" Make fun of the name caller, that they can't even think up a good name to call you, don't have the words (name callers and swearers generally don't). Tell the name caller you can't possibly be "stupid" or you wouldn't have gotten to grade ___ whatever the last one is you completed and remind the name caller that they're calling you names from your own head so you're not an idiot if they're able to do that! Have fun with talking to yourself. I once got three voices in there at work and had my coworkers rolling in the aisles. My hands and head got into an argument over whose fault a typing error was and I had to "call in" a referee to stop them arguing :-)