If someone is being shocked, live, then it all depends on the circumstances, but the most generic standard suggestion in various first aid courses seems to be using a non-conductive stick (e.g. broomhandle) to push them away from the source of power or vice versa. They have probably grabbed the thing with their hand and are unable to release it as the hand is cramped, so that may be difficult.
Finding a circuit breaker may be too long. My intuitive guess (though that's not something I have seen recommended) is that intentionally causing a short-circit and trip the breaker might be faster.
Alternatively, throw a scarf or other garment as a loop in between the victim and the source of the shock and use it to pull them away from it from behind them - the garment not being conductive means you'll be safe.
The immediate answer might be turn of the circuit breaker, but what if we're in a giant office building? Or I don't have access or know where the circuit breaker is?
Grab them with rubber gloves?