Terahertz pulse shaping using diffractive surfaces