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
def get_probabilities(corpus, alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ"): | |
corpus = ''.join([c for c in corpus if c in alpha]) | |
counts = [corpus.count(c) for c in alpha] | |
start_probs = np.array(counts, dtype=float) / sum(counts) | |
trans_counts = [[0.1 + corpus.count("%s%s" % (a,b)) for b in alpha] for a in alpha] | |
trans_probs = np.array([np.array(x, dtype=float)/sum(x) for x in trans_counts]) | |
return (start_probs, trans_probs) | |
start_probs, trans_probs = get_probabilities("THISSHOULDBEAHUGESTRINGLIKETHISBUTHUNDREDSOFTIMESBIGGER") |
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
import cv | |
cv.NamedWindow("w1", cv.CV_WINDOW_AUTOSIZE) | |
camera_index = 0 | |
capture = cv.CaptureFromCAM(camera_index) | |
gx = gy = 1 | |
grayscale = blur = canny = False | |
def repeat(): |
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
[dag] | |
name=Dag RPM Repository for Red Hat Enterprise Linux | |
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag | |
gpgcheck=1 | |
enabled=1 |
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
EDITOR=vim | |
alias edit=$EDITOR | |
alias c="clear;pwd;ls" | |
alias rc=". ~/.bashrc" | |
alias eb="edit ~/.bashrc" | |
alias ..="cd .." | |
alias cd..="cd .." | |
alias ll="ls -al" | |
function k() { |
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
import time | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
driver = webdriver.Chrome() | |
driver.set_window_size(1024, 768) # optional | |
url1 = "https://registrar.princeton.edu/score/" | |
url2 = "https://puaccess.princeton.edu/psc/hsprod/EMPLOYEE/HRMS/c/SA_LEARNER_SERVICES.SSR_SSENRL_CART.GBL?Page=SSR_SSENRL_CART&Action=A&ACAD_CAREER=UGRD&EMPLID=960579807&ENRL_REQUEST_ID=&INSTITUTION=PRINU&STRM=1142" | |
driver.get(url1) |
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/bin/python | |
# Adapted from http://kutuma.blogspot.com/2007/08/sending-emails-via-gmail-with-python.html | |
import getpass | |
import smtplib | |
from email.MIMEMultipart import MIMEMultipart | |
from email.MIMEBase import MIMEBase | |
from email.MIMEText import MIMEText | |
from email import Encoders | |
import os |
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
// Blokus Life Lessons (http://david-bieber.tumblr.com/post/41975899830/blokus-life-lessons) | |
$(".blokus").click(function(e) { | |
$(".blokus").each(function(index, el) { | |
if (el.innerHTML == "Life") $(el).text("Blokus"); | |
else if (el.innerHTML == "life") $(el).text(" Blokus"); | |
else if (el.innerHTML == "Blokus") $(el).text("Life"); | |
else if (el.innerHTML == " Blokus") $(el).text("life"); | |
}); | |
}); |
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
/* CSS for Collapsible Blog Posts */ | |
[id^=_] { | |
display: none; | |
} |
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
def getInput(): | |
#return raw_input() | |
return ask("Input", { | |
"choices":"http://hosting.tropo.com/97257/www/grammar/zork_grammar.grxml", | |
"timeout":60 | |
}).value | |
def speak(x): | |
val = x.replace("<br />", " ").replace("<br>", " ") | |
#print val |
NewerOlder