Design and synthesis of porous carbon for energy and environmental applications