Synthesis and Applications of Nanomaterials for Photocatalysis and Electrocatalysis