Some systems get stronger from shocks—here is how