Information Dissemination via Gossip: Applications to Averaging and Coding