Generation of zonal flows in rotating fluids and magnetized plasmas