Skip to content

Instantly share code, notes, and snippets.

View jcchurch's full-sized avatar

James Church jcchurch

View GitHub Profile
@jcchurch
jcchurch / monty.java
Created April 20, 2011 03:19
Monty Hall Problem solved with Monte Carlo Simulations
/*
* The Monty Hall Problem is a famous teaching problem
* in statistics. It works like this:
*
* Imagine that you are on the show "Let's Make a Deal"
* with Monty Hall. Monty shows you three doors and says
* that a car exists behind one of them. You may pick
* one door and if the car is behind it, you win the car.
*
* You pick a door. Monty then chances the rules. He opens
@jcchurch
jcchurch / quickPlot.m
Created April 20, 2011 03:16
Quickly plot graphs in Matlab
function quickPlot(varargin)
% This function is useful for printing point
% cloud data quickly. This function accepts
% one or more vectors, in either 2D or 3D,
% and either row-order or column-order format.
n = size(varargin, 2);
colors = char('r.', 'g.', 'b.', 'c.', 'm.');
num_colors = size(colors, 1);
@jcchurch
jcchurch / processMysterBits.py
Created April 11, 2011 14:02
This function fails to decipher a listing of binary digits using the ASCII tables.
import re
text = "101011011101010001101101011011101010100010101101010001101100101011011101010001110100111011010101101110110110101110110101000011010101101110110100111011010101101011010100110101001000100100011010100101011100110101001000101011010100110101001010100111010101101001001010101110100101010001010101101001001010100111010101101010101010110001010001110100101011010101010010010100011101000110101010110001010000101001001101010011101011011101010100101011010100111010110100101001001101010011010101000101001010110111010100011111010110110010101101110111010101000101001010111101101010001101001110110101011101101101101011010011101101011101101010001101000101001010111010110101001101010001101001000110101101010011010101001010111010110101001010100010101001110101011010100010101010101010011101011101001010100010101010101110100101101010101100010100010101001010011010101011010110101110100101101010101011"
def bin2ascii(binary_form):
"""Converts binary strings of length 8 to ASCII"""
if len(binary_form) != 8:
retur
@jcchurch
jcchurch / oneliners.txt
Created April 5, 2011 23:38
Oneliners
And that judge wasn't gonna look at the twenty-seven eight-by-ten color glossy pictures with the circles and arrows and a paragraph on the back of each one, explainin' what each one was to be used as evidence against us. And we was fined fifty dollars and had to pick up the garbage in the snow, but that's not what I came to tell you about.
All your base are belong to us.
Support your local medievalist.
The three kinds of people: Those who can count and those who can't.
Must be user error.
Close Cover Before Striking
The light at the end of the tunnel is usually a train.
42
First pants THEN your shoes.
BSA HandBook, 2nd Ed,: "Scouts as a rule do not go into the big woods."