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
from selenium import webdriver | |
driver = webdriver.Firefox() | |
driver.set_window_size(800, 600) | |
driver.set_window_position(0, 0) | |
driver.get("https://images.google.com") | |
searchbar = driver.find_elements_by_css_selector("#lst-ib")[0] | |
searchbar.send_keys("cute kittens") | |
searchbar.submit() |
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 |
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
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
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
[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
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
// Computer assisted snake! | |
// Paste this into the JS console at http://dskang.com/snake/ to play and win! | |
function getX() { | |
var head = gSnake.getHead(); | |
var x = head.x / 20; | |
return x; | |
} | |
function getY() { |
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
function getColumnIndexes(columns) { | |
// Returns a map from column name to column index. | |
var container = {}; | |
for (var i = 0; i < columns.length; i++) { | |
var value = columns[i]; | |
container[value] = i; | |
} | |
return container; | |
} |
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
function onOpen() { | |
var ui = SpreadsheetApp.getUi(); | |
ui.createMenu('Activity Log') | |
.addItem('Archive Past Events', 'archivePastEvents') | |
.addToUi(); | |
} | |
function archivePastEvents() { | |
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = spreadsheet.getSheetByName("Activities"); |
OlderNewer