Just a demonstration of some sampling techniques (rejection sampling, importance sampling, sampling importance resampling, Metropolis sampling, Gibbs sampling) on a single toy problem. The code is written in python/numpy/scipy and is not optimised for speed.
You can either check sampling.py or skim through the corresponding iPython notebook sampling.ipynb (web: http://nbviewer.ipython.org/urls/raw.github.com/n0mad/sampling-study/master/sampling.ipynb)