For the first one
>! $(4 + (4/4))!/4  = 30$

Second one
>! $4! + (4!+4)/4 = 31$