Here is a prettied up version of a python script for calculating this that I found on a link on that site.

Code:

import argparse
argparser = argparse.ArgumentParser(description='Calculate the probability of run of n events in m trials where p is the probabilty of an event')
argparser.add_argument('-n', type=int, required=True, help='run length')
argparser.add_argument('-m', type=int, required=True, help='number of trials')
argparser.add_argument('-p', type=float, required=True, help='probability of an event')
args = argparser.parse_args()
N = args.n
M = args.m
p = args.p
q = 1-p #probability of failure
#setting up P_i (P[i] will be the probability that we see a run of length n in i flips)
P = [None for i in range(0,M+1)] #initialize list to all Nones
for i in range(0,N): #set boundary conditions, (not including P_N (r)
P[i] = 0
P[N] =p**N #P_N (r) is now equal to p^N
#now for main recursion (using a loop here instead)
for i in range(N,M):
P[i +1] = P[i] + (1-P[i-N]) * q * P[N]
print 'A run of',N, 'events of probability',p, 'has a chance of 1 in',1.0 / P[M], 'of occuring in',M, 'trials'