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
color_start='\e[' | |
color_end='\e[m' | |
Black='0;30m' | |
Blue='0;34m' | |
Green='0;32m' | |
Cyan='0;36m' | |
Red='0;31m' | |
Purple='0;35m' | |
Brown='0;33m' |
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
#seeds making it to final four in past ten years | |
seeds=[3,4,8,11,1,2,5,5,1,1,2,3,1,1,1,1,1,1,2,2,2,3,4,11,1,1,4,5,1,2,2,3,1,2,3,3,1,1,2,5] | |
# track how many times each seed has made it to final four | |
data=[] | |
for i in range(16): | |
s=i+1 | |
data.append([s,len(filter(lambda x:x==s,seeds))]) | |
# compute likelihoods |
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
# I don't know whether this is valuable or meaningful, but it seems interesting. | |
class MR: | |
def process(self,the_list,the_map_function,the_reduce_function,the_initial_value): | |
return reduce(the_reduce_function, map(the_map_function, the_list), the_initial_value) | |
def sum1(x): | |
return MR().process(x, (lambda x: x), (lambda x,y: x+y), 0) | |
def len1(x): |
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
# I don't know 100% what this is, but it seems interesting, so I am recording it. | |
class FunctionPiper: | |
def applyAll(self, data): | |
if len(self.functionList) > 0: | |
for func in self.functionList: | |
data = func(data) | |
return data | |
j=FunctionPiper() |
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
(defn add1 [x] (+ x 1)) | |
(defn sub1 [x] (- x 1)) | |
(defn o+ [x y] | |
(cond (= y 0) x | |
:else (o+ (add1 x) (sub1 y)))) | |
(defn o- [x y] | |
(cond (= y 0) x |
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
(define (add1 x) (+ x 1)) | |
(define (sub1 x) (- x 1)) | |
(define (o+ x y) | |
(cond ((= y 0) x) | |
(else (o+ (add1 x) (sub1 y))))) | |
(define (o- x y) | |
(cond ((= y 0) x) |
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
(defn make-die [sides] | |
(fn [] (+ 1 (rand-int sides)))) | |
(def d20 (make-die 20)) | |
(def d6 (make-die 6)) | |
(def d4 (make-die 4)) | |
(def d10 (make-die 10)) | |
(def d12 (make-die 12)) | |
(def d100 (make-die 100)) | |
(def d1000 (make-die 1000)) |
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
BEGIN { | |
body=0; | |
} | |
body==1 {a=a$0"\n";}; | |
/^Body:/ {body=1;a=a" --body=\"";} | |
/^To:/ {a=a" -t"$2;} | |
/^From:/ {a=a" -f"$2;} | |
/^Subject:/ {a=a" -u\""$2"\"";} | |
/^Attachments:/ { |
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
#!/usr/bin/python | |
from mailer import Mailer, Message | |
from optparse import OptionParser | |
def isnull(opt, default): | |
if (opt == "" or opt is None): | |
return default | |
else: | |
return opt |
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 Char | |
cCipher s = encode 3 s | |
cDecipher s = decode 3 s | |
encode sh s = map (encodeChar sh) s | |
decode sh s = encode (-sh) s | |
encodeChar sh c | |
| isChar c = shift sh c | |
| otherwise = c |