Dissipation in circuit quantum electrodynamics: lasing and cooling of a low-frequency oscillator