It's hard tbh- my LO rarely does anything like that either, and never out of anger. Usually she thinks she's being funny- on occassion though she will throw something down on the ground out of frustration-- all very common toddler behavior. I just keep my response calm and simple/consistent. I simply get down to her level and tell her I'm not gonna let her do that. I'll take the toy away she threw or if she throws food at meal time, then meal time is over (for now). If it's out of play- I'll block her hand from pushing my face and say the same... sometimes I do have to speak more "stern" so she get's it's not funny. She was doing this a few times last week- but not since... so we shall see if it worked? LOL.
If she is having a particularly bad "moment" and frustrated- I'll again, say the same, keep calm and then take her into her playroom for a "reset". I'll ask if she wants to go play with a puzzle- to help redirect her little mind- and then we sit and do that for a bit. Usually snaps her right out of it.
Obviously all kids are different- so I would try an approach for a week or so to see if it helps, if not, then try something else. Sorry no better advise.