Skip to content

Instantly share code, notes, and snippets.

View nicolehe's full-sized avatar

Nicole He nicolehe

View GitHub Profile
@nicolehe
nicolehe / index.html
Created April 14, 2016 02:29
cheaters by religiousness
<!DOCTYPE html>
<html>
<head>
<title>cheaters by religiousness - by nicole he</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link href='https://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
</head>
<body>
@nicolehe
nicolehe / index.html
Created April 21, 2016 14:12
index.js
d3.csv('/claims-data-2015.csv', function(data) {
var claimsDataByAirline = _.groupBy(data, 'Airline Name');
//console.log(claimsDataByAirline);
var eachClaimByAirline = {};
_.each(claimsDataByAirline, function(claimsDataForOneAirline, airline) {
@nicolehe
nicolehe / run_length.py
Created September 18, 2016 15:55
run length encoder and decoder
import sys
# split the input string into a list of characters
input_split = list(sys.argv[1])
def encode(i):
result = list() # storing the result in a list of tuples
previous = None # for the first letter, the 'previous' character is null
matches = 0 # no matches to begin with
for letter in i: # for each letter in the input...
@nicolehe
nicolehe / _traceroute-commute.html
Last active September 19, 2016 03:52
traceroute commute
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Baloo+Bhaina" />
<title>Directly accessing Street View data</title>
<style>
html,
@nicolehe
nicolehe / _recommender.py
Created September 26, 2016 03:49
simple python recommendation engine
import numpy as np
import sys
from data import critics as people
# euclidian distance method:
# get the shared items between each person, and then find the distance
def similarity(person1, person2):
# if they share a rated item, add it to the shared list
shared = [item for item in people[person1] if item in people[person2]]
@nicolehe
nicolehe / mlp.py
Created October 24, 2016 04:06
mlp attempt, unfinished
import numpy as np
class MultilayerPerceptron():
'making a multilayer preceptron'
def __init__(self, sample_size, hidden_size, output_size, hidden_layers, total_epochs, learning_rate, report_freq):
self.sample_size = sample_size
self.hidden_size = hidden_size
self.output_size = output_size
self.hidden_layers = hidden_layers
@nicolehe
nicolehe / _mlp_income.py
Last active October 31, 2016 16:28
predicting whether or not someone makes more than $50k or less than $50k: http://archive.ics.uci.edu/ml/datasets/Adult
#!/usr/bin/python
# Learning Machines
# Taught by Patrick Hebron at NYU ITP
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import numpy as np
# np.set_printoptions(threshold=np.nan)
@nicolehe
nicolehe / index.html
Last active February 1, 2017 19:05
nicole.pizza/itp/hacking-the-browser/relax
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>relax :)</title>
<script type="text/javascript">
var image = 0;
var background = ['0.jpg', '1.jpg', '2.jpg', '3.jpg', '4.jpg'];
// shuffle
function shuffle(array) {
var currentIndex = array.length,
temporaryValue, randomIndex;
while (0 !== currentIndex) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
@nicolehe
nicolehe / freshdirect.py
Created March 2, 2017 21:39
incomplete attempt at using selenium to add things to my fresh direct cart
"""
So far, this script logs in to FreshDirect and then lists all products that you search
for (like "bacon"). What I'm trying to do is get it to add all of those items to your cart.
The part I'm struggling with is getting the "Add To Cart" buttons "visible" on the page.
I'm trying to use this ActionChains thing, but I don't think it's working, maybe I have
the wrong selector? (Also, it doesn't work with Firefox's webdriver, and I couldn't get
the Chromedriver upgraded to work. But with PhantomJS it's hard to tell what's going on...
"""