Any person capable of angering you becomes your master;
he can anger you only when you permit yourself to be disturbed by him. – Epictetus
Epictetus provides what is often intellectually straight forward advice. The practical application requires a decent amount of self awareness.
Meditatuon is a good technique to help build the short gap between stimulus and reaction