There's many variations out there, here's a few to get you started:
Sprays: Take about one clove of garlic and one medium-sized onion and add some water to them. Let it stay for a while before you add a teaspoon of cayenne pepper or dry chillies (basically anything with a bit of heat) and a dash of liquid soap to the mix. Use it on your plants to ensure that no bug infests your produce. You can also blend them up, sieve and use it.
Smoke Flavoured Liquid: If you have these in your kitchen, put in a few dash of it. The 'smell' alerts the bugs that there is potentially a fire nearby, and they flee.
Using the peels (skin): If you have 'onion and garlic' peels, instead of putting them into your Compost, you can also cut them out and use them as mulch in your pots or on your vegetable beds. I personally find this very effective.