Skip to content

Instantly share code, notes, and snippets.

View duhaime's full-sized avatar

Douglas Duhaime duhaime

View GitHub Profile
@duhaime
duhaime / Installing maven and couchdb-lucene on Ubuntu 14.04
Last active March 21, 2018 17:20
Installing Maven and CouchDB-Lucene on Ubuntu 14.04
# get couchdb-lucene
git clone https://github.com/rnewson/couchdb-lucene
# update java
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer -y
# check java version == 1.8
java -version
@duhaime
duhaime / Build PhantomJS on Amazon Linux.txt
Last active September 2, 2016 03:21
Build PhantomJS on Amazon Linux
sudo yum install gcc-c++ git chrpath openssl-devel freetype-devel fontconfig-devel
git clone git://github.com/ariya/phantomjs.git && cd phantomjs
git checkout 1.5
./build.sh --jobs 1
@duhaime
duhaime / Yale CAS Auth
Last active September 2, 2016 03:24
Yale CAS Auth
To authenticate users with Yale's CAS server, one can first send a request to the following endpoint:
`https://secure.its.yale.edu/cas?service=http%3A%2F%2Fgoogle.com`
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:
`https://www.google.com/?ticket=ST-6606719-A9AjXY2yXrsKw0b7oC4e-vmssoprdapp01`
@duhaime
duhaime / get_russian_poetry.py
Last active October 7, 2016 21:04
Fetch Russian Poetry
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import os, glob, codecs, json, urllib2, regex
"""
Notes:
Blok: example of poetry page with collection of poems
@duhaime
duhaime / friend_of_a_friend.py
Last active November 12, 2016 00:25
Recursively find friends of friends
import itertools
from collections import defaultdict
d = {
1: ["a", "b"],
2: ["b", "c"],
3: ["c", "d"]
}
def find_friend_of_friends(d):
@duhaime
duhaime / classify_images.py
Last active July 13, 2018 12:15
Image to Vec
from __future__ import absolute_import, division, print_function
"""
This is a modification of the classify_images.py
script in Tensorflow. The original script produces
string labels for input images (e.g. you input a picture
of a cat and the script returns the string "cat"); this
modification reads in a directory of images and
generates a vector representation of the image using
document.querySelectorAll('*').forEach(
function(i) {
i.addEventListener('click', function(e){
console.log(e.target)
})
}
)
@duhaime
duhaime / react-native-maps-enable-google-maps-instructions.md
Created March 2, 2017 12:26 — forked from heron2014/react-native-maps-enable-google-maps-instructions.md
Visual instructions how to enable Google Maps on IOS using react-native-maps

Visual instructions how to enable Google Maps on IOS using react-native-maps

This is for my personal use, things might not be correctly explained here. For the official docs please check https://github.com/airbnb/react-native-maps

Steps from scratch:

1.react-native init GoogleMapPlayground

2. cd GoogleMapPlayground

@duhaime
duhaime / create-splash-page-sizes.py
Created March 25, 2017 15:22
Resize monochromatic splash page to required ios sizes
import os, sys
print 'processing', sys.argv[1]
sizes = [
(1242, 2208),
(750, 1134),
(2208, 1242),
(640, 960),
(640, 1136),
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime