Skip to content

Instantly share code, notes, and snippets.

View crawles's full-sized avatar

Chris Rawles crawles

View GitHub Profile
---
applications:
- name: sentiment-compute
memory: 2GB
disk_quota: 2GB
instances: 1
path: .
buildpack: python_buildpack
command: >
jupyter-kernelgateway --KernelGatewayApp.port=$PORT
python-3.5.2
$ cf push
$ curl -H "Content-Type: application/json" -X POST -d '{"data":["This app is awesome and in the CLOUD","Steph Curry is a basketball player","i am so mad and angry"]}' sentiment-compute.cfapps.pez.pivotal.io/polarity_compute
[ 0.78031286 0.49108975 0.14809403]
$ cf scale myApp -i 5
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
name: jupyter
dependencies:
- jupyter
- pandas==0.18.1
- python=2.7.11
- pip==8.1.2
- requests
- scikit-learn
- pip:
- jupyter_kernel_gateway
@crawles
crawles / connect_to_hawq_gpdb_postgres.ipynb
Last active September 21, 2016 15:51
Boilerplate code for connecting to a HAWQ, Greenplum, or PostgreSQL database in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@crawles
crawles / .inputrc
Created December 8, 2016 22:12
My inputrc
# By default up/down are bound to previous-history
# and next-history respectively. The following does the
# same but gives the extra functionality where if you
# type any text (or more accurately, if there is any text
# between the start of the line and the cursor),
# the subset of the history starting with that text
# is searched (like 4dos for e.g.).
# Note to get rid of a line just Ctrl-C
"\e[B": history-search-forward
"\e[A": history-search-backward
@crawles
crawles / set_interval.py
Last active December 14, 2016 21:29
Async set_interval function
import threading
def set_interval(func, sec):
def func_wrapper():
set_interval(func, sec)
func()
t = threading.Timer(sec, func_wrapper)
t.start()
return t