Temporary (just 2-3 second) 5V Power Backup for Raspberry Pi
Capacitor:

The voltage on a 1  Farad capacitor will drop 1V in 1 second with 1A load.
So eg for 100 mA load and 3 seconds holdup for 1V drop you need
1F x 3s x 0.1A ~= 0.3F. 

More mA or time or less voltage drop  = more capacitance.
eg for 0.1V drop and 500 mA you need ~= 15F.
So a supercap rated at > 5V will probably be needed.
Typically supercap Vrating is &lt; 5V so you need 2 in series with double the final capacitance each. ie   


  1.2F each for the first example and
  30F each for the 2nd example. 


Battery:

An easier method is to use a battery with a Schottky isolation diode or an active switch.    If you can be certain to not draw battery power except when laptop dock switching the AA Alkaline batteries will last a long while (years for several switchings per day).
Or you could use eg NimH batteries recharged by the 5V supply "with due design". 

Flywheel:

Just for fun - DC motor with flywheel that becomes a generator at changeover time. Not very practical, but fun. 

Once upon a time the big boys did something roughly similar, for different reasons with Ward Leonard sets. (Motor driving generator driving motor driving ...).