Run code on a sample