Former Birmingham forward O'Shea, who scored against the Spireites last season, has signed until January 5.
Townsend moves to the Proact Stadium on an initial one-month deal. The 19-year-old left-back is yet to make his first-team debut for the Tigers and spent most of last season on loan at Blue Square Bet Premier side Grimsby.
Cook, who took charge of the Spireites last month, is delighted to have added new faces to his squad.
He told the club's official website: "We need to increase the competition for places and these two players are quality additions to the squad."
The duo will go straight into the squad for Tuesday's League Two match at home to Cheltenham.