In order to avoid electric shock, I need to discharge the capacitor of my refrigerator before working on it. How do I do it, and where can I buy an appropriate power resistor?
Use a light bulb. Besides being more than capable of dissipating the power, it has the bonus of telling you when the capacitor is empty since the light will go out.
The best way is to use a spare light socket and touch the two wires to the capacitor leads. Lacking a socket, some wire and electrical tape will do the trick if you're careful.
You should be using an insulated shorting probe to properly discharge that capacitor.
There are special shorting probes made for this purpose, but the only ones I've seen online are for really large applications (like attached to a hot stick type large). When I was in the Navy we had some nice handheld sized ones for using inside equipment cabinets.
Short of purchasing one, there are instructions on the web on how to build one. I wouldn't just take a wire or leads from a bulb socket and short the cap leads to ground - those compressor start/run capacitors can be fairly high in capacitance and hold a decent amount of energy. If you decided to create a DIY shorting probe, ensure you get a resistor of sufficient size so you're not just instantaneously discharging the cap to ground (basically creating a direct short - unsafe).
And lastly... ABSOLUTELY check the circuit is deenergized at the capacitor terminals after you're done discharging them - you might think it's dead... but sometimes you don't always get a good contact on the lead or fully discharge the component.