Twitter has agreed to hand over about three months’ worth of tweets to a judge overseeing the criminal trial of an Occupy Wall Street protester.