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 a dictionary of words with positive valence and another dictionary | |
# of words with negative valence. Get access to Twitter. Search Twitter for | |
# tweets that discuss 4 topics. Grab the text from those tweets. Combine | |
# tweets into database. Look for words with positive and negative valence | |
# in those tweets. Subtract words with negative valence from words with | |
# positive valence to get net subjective response to topic of interest. | |
# Create graphs. Code by Gaston Sanchez, edited by Douglas Duhaime | |
library(twitteR) | |
library(plyr) |
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 os | |
from os import makedirs | |
from subprocess import call | |
# It seems this script must be run from inside C:\mallet-2.0.7 | |
# Set the path to your mallet package (make sure to change the mallet | |
# version number, if necessary) | |
# Create directory "inputdirectory" within this mallet directory. Load the | |
# files to be analyzed in "inputdirectory" |
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
### Locating UI elements ### | |
# By ID | |
<div id="coolestWidgetEvah">...</div> | |
element = driver.find_element_by_id("coolestWidgetEvah") | |
or | |
from selenium.webdriver.common.by import By | |
element = driver.find_element(by=By.ID, value="coolestWidgetEvah") | |
# By class name: |
This file has been truncated, but you can view the full file.
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
"Mikysco, Bartholdus." "The spanish-Austrian league:" 1.0 1 | |
"Miller, John," "The evidence, (as taken down in court) in the trial wherein the Rt. Hon. John, Earl of Sandwich, was plaintiff, and J. Miller, defendant, before William, Lord Mansfield, And a Special Jury, in the Court of King's Bench, July 8, 1773." 1.0 1 | |
"Whiston, Thomas." "A sermon preached at Wisbech, Sunday, March 11. 1743." 1.0 1 | |
"Whiston, Thomas." "The important doctrines of original sin," 1.0 1 | |
"Highmore, Joseph," "Observations on a pamphlet, entitled, \"christianity not founded on argument.\" By a Christian freethinker, Who apprehends that Infidels cannot be effectually answered, on any Principles less general, than those which he has adopted. The only apology he can make for publishing (at this distance of time) animadversions on a pamphlet printed so long since, is, that he has just now (and never before) perused it with that design." 1.0 1 | |
"Member of the Hon. Artillery-Company." "The necessity of a well-regulated and able-bodied nightly- |
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 __future__ import division | |
from sklearn.cluster import KMeans | |
from numbers import Number | |
from pandas import DataFrame | |
import sys, codecs, numpy | |
class autovivify_list(dict): | |
'''Pickleable class to replicate the functionality of collections.defaultdict''' | |
def __missing__(self, key): | |
value = self[key] = [] |
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
# | |
## Add the rubycas-client gem to your Gemfile and run bundle install | |
# | |
gem 'rubycas-client' | |
gem 'mechanize' | |
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
var selector = 'img' // Replace this with the selector for the element you want to make transformable | |
jQuery.getScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', function() { | |
jQuery.getScript('//cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js', function() { | |
(function() { | |
var $, applyTransform, getTransform, makeTransformable; | |
$ = jQuery; |
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 numpy as np | |
""" | |
This script identifies a transform matrix X such that | |
one can determine how to perform a css matrix translation | |
to map one div's coordinates to those of another. | |
A fiddle demonstrating the input div, output div, | |
and a transformation that maps the input to the output | |
may be found here: https://jsfiddle.net/dduhaime/9444Lnjp/ |
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 numpy as np | |
""" | |
This script calculates a transform matrix X such that | |
one can project points in one 2d coordinate system | |
into another 2d coordinate system. Because the solution uses | |
a homogenous coordinate space to represent points, | |
the projection may involve rotation, translation, shearing, | |
and any number of other forces acting on the input matrix | |
space. |
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
# Steps to install CouchDB 1.6.1 and Apache2 on Ubuntu 14.04 | |
# On AWS, select the Ubuntu 14.04 standard box (ami-2d39803a) | |
# edit security groups to add the "HTTP" rule, which exposes port 80 to traffic from 0.0.0.0 | |
# then add a "Custom TCP rule", exposing port 5984 to traffic from 0.0.0.0 | |
# launch and ssh to the instance | |
# become root | |
sudo -s |
OlderNewer