“If you are distressed by anything external, the pain is not due to the thing itself, but to your estimate of it; and thus you have the power to revoke at any moment.”.
Same notion from Buddha, "You can't control what happens in life but you can control your reaction.".