The only safe and legal way to wire a standby generator into your panel to power the entire house in the event of a power outage is to install a Double Pole Double Throw transfer switch. It disconnects the panel from the main power supply while the generator is running and protects workers who may be repairing the electrical lines. This installation can be an expensive proposition though, and if you only need power to your refrigerator and a few key appliances, there is an easier alternative that isn't up to code, but is just as safe.
Mount a fusible service disconnect switch and a commercial-duty 20-amp, 3-way switch next the main electrical panel.
Replace one of the 20-amp receptacles on the generator with a 30-amp one -- of the type used for RV connections. This will allow you to plug in a heavy-duty cord capable of carrying the full power of the generator. Some generators already have this type of receptacle.
Cut the plug off the other end of the extension cord, strip the cable and separate the wires. Connect the black wire to the outgoing load lead of the service switch mounted next to the panel.
Identify the circuit in the panel you want to power with the generator and turn off the breaker. Pull the breaker out and remove the wire. Twist a length of black insulated wire onto the end long enough to reach the 3-way switch and screw on a wire cap, then lead the wire to the common terminal of the switch and connect it. Use wire that is the same size as the one that was connected to the breaker. The common terminal is the one coloured differently than the other two.
Run a second wire from the top brass terminal of the switch back to the breaker you removed, connect it to the breaker and snap the breaker back into the panel.
Run a third length of wire from the other brass terminal of the transfer switch to the fused service terminal of the service disconnect.
Twist a length of white insulated wire onto the end of the white wire in the extension cord, screw on a wire cap and run the wire into the panel. Feed it into an available slot on the neutral, or silver, bus bar and tighten the lug. Connect the ground wire from the electrical cord to the ground bus of the panel in the same way, using bare wire. Be sure the wire gauges are the same as the black wires connected to the switches.
Mark the positions of the 3-way as "generator" and "main power" to identify them. Keep the switch in the "main power" position until you have an outage and toggle it to the other position it when you turn on the generator. It will isolate the circuit powered by the generator from the main service panel.
If you want to be able to remove the extension cord, install a 30-amp receptacle next to the service disconnect. Wire its neutral and ground terminals to the panel and its hot terminal to the service disconnect. You can install more than one 3-way switch in the same way if you want to power more than one circuit. Connect each switch to the same terminal on the service disconnect.