I think it boils down to living your life in a good way, so that when you are on your deathbed, you have very few regrets.
Start at the end, so to speak.