How to stop apps from opening automatically when I plug things in
In iPhoto > Preferences > General select "Connecting Camera opens: no application"

In iTunes select your device and go to Summary and make sure "Automatically sync when this iPhone [or whatever device it is] is connected" is unchecked.

I'm not certain the second one will completely solve opening iTunes since I can't test it as I don't have a cable here with me.