The president unleashed a two-day Twitter tirade that was unusually angry and defiant even by his standards.