This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool shit = True; // shit happens |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Random random = new Random(); | |
public double GetRandomNumber(double minimum, double maximum) | |
{ | |
return random.NextDouble() * (maximum - minimum) + minimum; | |
} | |
//copied from:http://stackoverflow.com/questions/1064901/random-number-between-2-double-numbers/1064907#1064907 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copied from http://www.albahari.com/threading/ | |
static void Main() | |
{ | |
Thread t = new Thread ( () => Print ("Hello from t!") ); | |
t.Start(); | |
} | |
static void Print (string message) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#copied shamelessly from http://jasonmbaker.com/pimp-my-interactive-interpreter | |
import atexit | |
import os | |
import readline | |
import rlcompleter | |
import sys | |
histfile = os.path.join(os.environ["HOME"], ".pyhist") | |
try: | |
readline.read_history_file(histfile) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import operator | |
def c(n, k): | |
k = min(k,n-k) # using C(n,k) = C(n,n-k) | |
return (reduce(operator.mul, range(n-k+1, n+1)) / | |
reduce(operator.mul, range(1, k+1))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g = Graph({0:[1,2],2:[1]}) | |
graph_editor(g) |