Code snippets for solving some useful and interesting questions