If this person is not leaving, you should leave asap. For your own sanity and safety. I've never seen sociopaths get better, I've only seen them hunt and hurt other people.
I think I can just focus on work, put on headphones, tell people they can still ask me for help, and demonstrate that I'm a good and motivated programmer. Let the work do the telling.
The only thing I really worry about is that he becomes a team leader and gets to manage me. I would like to prevent that if possible without dropping to his level - if possible. I don't have illusions that I can make him like me. When we're the only 2 people left in the room, we don't talk unless necessary.