This file contains 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
# Monty Hall Simulator | |
# Raymond Ho | |
# September 5th, 2014 | |
# Run -> python montyhall.py | |
import random | |
def greet(): | |
# Using the 'statement continuation character '\' | |
print "\nWelcome to the Monty Hall Simulator, created by Raymond Ho.\n" \ |
This file contains 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
# Raymond Ho | |
# Oct 7, 2014 | |
""" | |
Checks if the movie / TV show you've been waiting for is finally up on Netflix, | |
or if they have new seasons / episodes, whatever. Only works if Netflix updated | |
in the past two weeks. | |
""" | |
from urllib import request, parse # Used to generate URLs and open links |
This file contains 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
#!/usr/local/bin/python3 | |
# Raymond Ho | |
# November 29, 2014 | |
# Downloads imgur uploads from reddit and saves them in a new directory. | |
# Rerun every so often to download new pictures without downloading the | |
# same pictures multiple times. A text file keeps track of what has | |
# already been downloaded. |
This file contains 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
print(''.join([chr(x) for x in [int(x,16) for x in \ | |
[str(hex(2 * 2 * 5 * 7 * 37 * 149 * 5417 * 148781 \ | |
* 51939996061871)[i:(i+2)])\ | |
for i in range(25)][2::2]]])) |
This file contains 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
# In probability theory, the birthday paradox concerns the probability that, | |
# in a set of n randomly chosen people, | |
# some pair of them will have the same birthday. | |
# By the pigeonhole principle, the probability reaches 100% when | |
# the number of people reaches 367. | |
import random | |
# 365 distinct birthdays including February 29th. |
This file contains 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
# Raymond Ho | |
# May 5, 2015 | |
# Note: Run me through the terminal. | |
# Sublime Text 2 won't successfully build b/c of Unicode errors. | |
import csv | |
import sys | |
This file contains 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
// Raymond Ho | |
// JavaScript makes Sleep Sort so easy to implement.. | |
// Exponentially slower if sorting larger numbers. | |
function sleepNumber(number) { | |
// The timeout is (n^2) so that close numbers are no longer close. | |
// Example: 1 is really close to 2, but 1^2 isn't close to 2^2. | |
setTimeout(function(){ | |
console.log(number); | |
}, number*number); |
This file contains 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
// Raymond Ho | |
// This small script is just to demonstrate some functional programming feautures of Javascript. | |
// Quicksort! | |
// Anon function helper, will return a random number. | |
var randomNumber = function() { | |
return Math.floor(Math.random()*101); | |
} | |
// Create an array of 100 random numbers. |
This file contains 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
-- Raymond Ho | |
-- 99 Haskell problems from: https://wiki.haskell.org/99_questions/1_to_10 | |
-- 9/17/2015 | |
module NinetyNineProblems where | |
--1 | |
myLast :: [a] -> a | |
myLast [] = error "No end for empty lists" |