Nearly arbitrary on-chip optical filters for ultrafast pulse shaping