Quantifying resilience of humans and other animals