I use ultrasonics to keep the neighbor's cats out of my carport, but it's not 100% effective. Intact males will still occasionally spray, but you can throw firecrackers at them and they still come back. Have noticed over the past year that none seem interested in crapping on my property anymore, which was my biggest complaint. I set it up for a 3 second blast every 15 seconds, around 21 khz. Since it uses 555 timers, it varies depending on the temperature. The 4 piezo tweeters can be heard, usually just a click, but in cooler weather the scream.
I don't know about bugs, but with mammals, a constant sound will get ignored after a while as normal background (you should try one of those ultrasonic sniffer/bat detector devices). Best bet is something intermitent. Needs loudness, but eventhough you can't hear it, it can still damage your hearing, so keep that in mind.
Eventually I'll get around to building a new gadget when I understand how to do it better. The idea is to make a noise generator and filter out everything in the audiable range (more or less). Figure it would be as annoying to the cats, as white noise is to people. Going to keep it on the pulse/timer, which I'd like to make a random period or atleast changing somehow.
Insects are basically stupid, and seem to be immune to everything except squashing, spraying, and burning. I heard a story once about a cockroach walking around in a microwave while it was running. Not sure I believe it, but that must be one tough bug.