Attosecond sampling of arbitrary optical waveforms