You’ve bought a piece of ginger, but only need to use a small part of it. Peel it, pop it in whole in a freezer bag or container and when you need ginger again in a recipe get it out and grate straight from the freezer!
Chillies freeze really well. Just pop them in a plastic bag or box and bung in the freezer. When you want to use one take one out, wash and use as you would fresh.