Skip to content

Instantly share code, notes, and snippets.

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@rsivapr
rsivapr / data.json
Last active August 29, 2015 14:18 — forked from d3noob/.block
[
{
"date":"1-May-12",
"close":58.13
},
{
"date":"30-Apr-12",
"close":53.98
},
{
(u'A. Flaxman', u'Matthias Ekman', u'Miroslav Batchkarov', u'Michael Eickenberg')
(u'Abhijeet Kolhe', u'Alexander Fabisch', u'James Mcdermott', u'F\xe9lix-Antoine Fortin')
(u'Adrien Gaidon', u'Justin Pati', u'Rafael Cunha De Almeida', u'Raul Garreta')
(u'Alemagnani', u'Roman', u'Matti Lyra', u'Lqdc')
(u'Alex Companioni', u'Jakemick', u'Bogdan Trach', u'Miroslav Batchkarov')
(u'Alexander Fabisch', u'Alexander Fabisch', u'Miroslav Batchkarov', u'Bogdan Trach')
(u'Alexandre Abraham', u'Jan Hendrik Metzen', u'F\xe9lix-Antoine Fortin', u'James Mcdermott')
(u'Alexandre Gramfort', u'Gaelvaroquaux', u'Immanuel Bayer', u'Andy')
(u'Alexandre Passos', u'Nzer0', u'Miroslav Batchkarov', u'Bogdan Trach')
(u'Alexis Mignon', u'Jamestwebber', u'Jansoe', u'Eugene Nizhibitsky')
awk 'BEGIN { srand(systime()); } {if (rand() < 0.25) { print $0; } }' Train.csv > sampled_train.csv
@rsivapr
rsivapr / renewBot.py
Created August 17, 2013 00:27
To run the code, $ pip install selenium then, $ python renewBot.py
from selenium import webdriver
import getpass
driver = webdriver.Firefox()
driver.get('https://myaccount.lib.ncsu.edu/')
user = driver.find_element_by_name('user_idp')
for option in user.find_elements_by_tag_name('option'):
if option.text == 'NC State Unity Users':
We can't make this file beautiful and searchable because it's too large.
300,100006
300,100011
300,100012
300,100033
300,100044
300,100053
300,100059
300,100072
300,100104
300,100111

What

Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.

What are we using? What do you need?

  • An active AWS account. First time sign-ups are eligible for the free tier for a year
  • One Micro Tier EC2 Instance
  • With AWS we will use the stock Ubuntu Server AMI and customize it.
  • Anaconda for Python.
  • Coffee/Beer/Time
@rsivapr
rsivapr / problem2.py
Created August 6, 2013 06:06
run $python problem2.py > avgclaims.csv
import numpy as np
from datetime import date
claimsdata = np.genfromtxt('claims.csv', dtype = (int, object, object, int, object), delimiter=',', names = True)
poldata = np.genfromtxt('policies.csv', dtype = (int, object, object, object, object), delimiter=',', names = True)
f = open('categories')
f.readline()
dict1 = {}
for i in f.readlines():
colorVal = i.split(',')
colorVal[1]=colorVal[1][:-1]
@rsivapr
rsivapr / problem1.py
Created August 5, 2013 23:10
Challenge
import pandas as pd
import statsmodels.api as sm
import pylab as pl
import numpy as np
import sklearn.metrics
print "Reading DATA.CSV ... \n"
df = pd.read_csv('data.csv')
df.columns = ["numb", "age","frailty","sex","val"]
for i in range(df.shape[0]):
@rsivapr
rsivapr / game.js
Last active December 20, 2015 09:39
Influence
gameGrid = function(gridSize) {
var i;
window.a = [];
this.size = gridSize;
this.map = [];
for (i = 0; i < this.size; i++) {
this.map[i] = [];
}
};