Skip to content

Instantly share code, notes, and snippets.


Douglas Duhaime duhaime

View GitHub Profile
View counts_per_title.txt
This file has been truncated, but you can view the full file.
"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-
View twitter_sentiment_classification_in_R
# 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
View gist:5876255
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"
View gist:8643692
### Locating UI elements ###
# By ID
<div id="coolestWidgetEvah">...</div>
element = driver.find_element_by_id("coolestWidgetEvah")
from import By
element = driver.find_element(by=By.ID, value="coolestWidgetEvah")
# By class name:
duhaime / Gemfile
Created June 22, 2016 14:18 — forked from zackrw/Gemfile
Yale CAS and user info with Rails (after security "upgrade" on LDAP)
View Gemfile
## Add the rubycas-client gem to your Gemfile and run bundle install
gem 'rubycas-client'
gem 'mechanize'
duhaime / DragTransform
Created July 3, 2016 10:48 — forked from fta2012/DragTransform
Slightly modified compiled coffeescript from this codepen: Paste into console on a page that has jQuery to load the two dependent libraries (jquery-ui and numericjs). Then call makeTransformable('#selector-name') to make that element WYSIWYG editable. Use inspector to get the CSS for the transforms.
View DragTransform
var selector = 'img' // Replace this with the selector for the element you want to make transformable
jQuery.getScript('//', function() {
jQuery.getScript('//', function() {
(function() {
var $, applyTransform, getTransform, makeTransformable;
$ = jQuery;
duhaime / Matrix Transform Gist
Created July 6, 2016 19:51
Matrix Transform Gist: calculates the X matrix for AX = B linear algebra equation
View Matrix Transform Gist
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:
duhaime / 2D Point Project via Transformation Matrix
Last active July 8, 2016 12:17
Project points from input 2d space to output 2d space
View 2D Point Project via Transformation Matrix
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
duhaime / Build PhantomJS on Amazon Linux.txt
Last active September 2, 2016 03:21
Build PhantomJS on Amazon Linux
View Build PhantomJS on Amazon Linux.txt
sudo yum install gcc-c++ git chrpath openssl-devel freetype-devel fontconfig-devel
git clone git:// && cd phantomjs
git checkout 1.5
./ --jobs 1
duhaime / Yale CAS Auth
Last active September 2, 2016 03:24
Yale CAS Auth
View Yale CAS Auth
To authenticate users with Yale's CAS server, one can first send a request to the following endpoint:
The `service` query param specifies the application that's requesting the authentication.
This request will redirect control back to the application with the following url: