You can't change how other people act, but you can change your attitude to how they react. And, it turns out, your attitude can affect how other people act quite a bit.
I used to have a phone wallpaper that said something like "be kind. You never know what kind of shit other people are dealing with." it was much for inspiring and eloquent than that, but it was a helpful reminder to be aware that I'm not the only person in this universe. Whatever I have on my plate - a bad day, a better place to be - the other person just has just as much shit they are dealing with.