At least 31 dead as Tripoli residents rebel against militias