This is something from my past that I've all but forgotten, mostly because it's pretty embarrassing and I never mention it to anyone. It was my everyday way of coping with school, especially in 5th and 6th grade (I moved to a new area just before 5th grade, and had a much harder time fitting in than ever before).
Basically, I would barely talk to anyone in my class that I didn't want talking to me. I would turn them away with this vaguely cat-like animal sound, a "maow" or "raow," or something like that. Despite this, I was somehow I was still able to have a few friends (not really until 6th grade though, because I was in a different school)... I guess I was persistent enough in following the people I liked, and talked to them enough, for them to accept me. I was infamous for my "maow" sound, but it was just crazy enough to work. I wasn't bullied too much until 5th grade as far as I can remember, and it did help keep unwanted people away. I remember I even recommended this technique to a classmate once, because it seemed to work for me. Of course, I feel it would have been better to have actually tried to acquire some social skills during this time, but my nature was to keep everyone away, except for the few that I identified as potential friends.
Another thing I did, which wasn't so much to intentionally keep people away as it was to just do my own thing, I had a favorite tree on the playground in 6th grade (I started going to a private school in 6th grade, which was still elementary there). I circled around this tree all recess. Just paced around it and thought about whatever I wanted to think about. I went there to be alone. Occasionally a few kids would join me, I guess to figure out why I had so much fun doing this.
It's always puzzled me why people say people who do bizarre things are just "looking for attention." I suppose maybe there are some people like that... but for me, the intent was quite the opposite... I just wanted to be left alone, except by a few nice people. If I thought you were a nice person that I could consider to be a friend, I'd talk to you. If not, "maow" means "go away."