Assuming it's for the headset, you wrap a single thickness shim around the cups and the pressure should keep it in place as you press the headset in.
I've also got shims on the bottom bracket for holding a crank on. With these I've glued the shim on.