Passing on the right is legal when:
You're passing someone who's stopped to make a left turn.
You're on a multi-lane road (if there are two or more lanes going the same direction, you can pass in either for them)
In San Francisco, when people are annoyed by other people on the road (whether on bikes, on foot, or in cars), they just honk their horns angrily and move on. They're all in too much of a hurry to stop and lecture anyone.