Gravitational wave emission from proto-neutron stars and neutron star mergers