One who has seen a lamb shake its tail, can see that the saying “in two shakes of a lamb’s tail” means with no loss of time, for a lamb can shake its tail twice “before one can say Jack Robinson.”
Usage appears to be entirely American, going back a hundred years or longer.
The probabilities are that the saying is a humorous enlargement of the older “in a couple of (or brace of, or two) shakes,” a slang saying first recorded by Richard Barham in Ingoldsby Legends in 1840, but probably much older.
This latter saying has been variously interpreted, as alluding to a double shake of the hand, two shakes of a dice box, two shakes of a dustcloth, or whatever it may be that takes little more time in shaking twice than in shaking once.