Selling something
I live in Indonesia so I get it a lot. When they come at me I banter with them. I tell them (the taxi drivers) to find the taxi "over there". I tell them "besok" (tomorrow). Until they get confused and give up in disgust because their friends are laughing at them. My wife hates it but I have fun with them (nicely, with a smile). It avoids anger.
Ignoring them completely is also good advice which I do a lot.
If your hotel is picking you up at the airport and waiting for you with your name on a sign, you can just go with them and nobody will bother you again since you're obviously spoken for.
Most of the time at the local airport I just look like I know where I'm going (because I do) and they leave me alone. Might also need an occasional firm "tidak perlu" (not needed). But that often doesn't work for actual tourists.
Picture with the foreigner
They see the white foreigner as a celebrity they would like to be friends with. And just like home-country celebrities, we get tired of it. We just want to be ignored and left alone.
When hiking or on the beach they always want to take a picture with us. My wife and sisters hate it. So I tell them "besok" (tomorrow) and keep on walking. Or I tell them to take a picture of the nice scenery. Or I offer to take a picture of them (without us). Or if my wife isn't there I tell them my wife won't allow it (if she was there they would just ask her directly).
If the above fails: We were on a beach and my wife and sisters got surrounded. I quickly approached and told them firmly "cukup" (enough) while shaking my head at them and ushering them away. They got the message. Usually they just want to be friendly but enough is enough.