Standalone program: http://www.gpower.hhu.de/en.html
Manual PDF: gpowermanual.pdf
Example: FisherExactTest (also MATLAB implementation)
See also: http://www.mathworks.com/help/stats/examples/selecting-a-sample-size.html
See https://github.com/dagdpz/testsim/blob/master/testsim_stat_power.m