small pieces of useful matlab code