Skip to content

Instantly share code, notes, and snippets.

View stuartlynn's full-sized avatar

Stuart Lynn stuartlynn

  • Two Sigma
  • Brooklyn
View GitHub Profile
@stuartlynn
stuartlynn / GettingStarted.ipynb
Created September 7, 2017 20:11
CartoFramesGettingStarted
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stuartlynn
stuartlynn / matplotlibrc
Created August 3, 2017 00:39
Matplotlibrc
backend : Agg
@stuartlynn
stuartlynn / zappa_settings.json
Last active August 3, 2017 20:45
zappa settings
{
"dev": {
"app_function": "plotter.app",
"s3_bucket": "zappa-888fe0qlm",
"slim_handler": true
}
}
@stuartlynn
stuartlynn / setup_venv.sh
Created August 3, 2017 00:35
virtualenv setup
virtualenv env
source env/bin/activate
pip install zappa requests pandas matplotlib flask
@stuartlynn
stuartlynn / barplot.py
Created August 3, 2017 00:26
bar plot end point
@app.route('/bar.img')
def bar():
query = request.args.get('q')
username = request.args.get('username')
api_key = request.args.get('apikey')
xlabel = request.args.get('xlabel')
ylabel = request.args.get('ylabel')
title = request.args.get('title')
# Run a query over the CARTO SQL api
def carto_query(query,username,api_key):
params = {'q' : query, 'format':'csv'}
if api_key:
params['api_key'] = api_key
url = 'https://{}.carto.com/api/v2/sql?'.format(username) + urlencode(params)
return pandas.read_csv(url)
@stuartlynn
stuartlynn / index.md
Created March 8, 2017 16:36
Thoughts on running Analysis Functions on AWS Lambda

Analysis on AWS Lambda

What is AWS Lambda

Lambda is a serverless code execution enviromnent on AWS that can run abitrary python or node code. When a function is triggered it spins up runs and then exists.

Issues with the current setup for Analysis

Analysis currently is run at the Database level through plpythonu functions.

@stuartlynn
stuartlynn / index.md
Created March 8, 2017 15:59
FCC install requirements

Requirements for the FCC project

The Linear programing framework we where using is called CVXOPT, which consists of some C libraries and a python module that calls them

This is the install that worked in a Docker container we have been using for development of tha algorthum. The full docker container is

apt-get install -yq libopenblas-dev libatlas-dev libblas-dev libglpk-dev glpk-utils liblapack-dev libsuitesparse-dev gsl-bin libgsl0-dev libfftw3-dev libblas-test  libopenblas-base libopenblas-dev
git clone https://github.com/cvxopt/cvxopt.git                                                                                                                                                                                 
cd cvxopt                                                                                                                                                                                                                   
@stuartlynn
stuartlynn / Dockerfile
Created March 8, 2017 15:59
Stuarts Docker File
from kaggle/python
RUN apt-get install -yq libopenblas-dev libatlas-dev libblas-dev libglpk-dev glpk-utils liblapack-dev libsuitesparse-dev gsl-bin libgsl0-dev libfftw3-dev libblas-test libopenblas-base libopenblas-dev
RUN git clone https://github.com/cvxopt/cvxopt.git