Skip to content

Instantly share code, notes, and snippets.

@JoeReis
JoeReis / lambda_function.py
Last active June 4, 2018 02:49
AWS Lambda function that creates metadata about a file uploaded to S3, and inserts this metadata into DynamoDB.
import json
import urllib.parse
import boto3
s3 = boto3.client('s3')
dynamodb_client = boto3.resource('dynamodb')
table_name = # your dynamodb table name
table = dynamodb_client.Table(table_name)
@JoeReis
JoeReis / gist:a5f80c01fecdc3159358
Created August 9, 2014 02:22
Setup pip, virtualenv, virtualenvwrapper on a new Mac
easy_install pip
sudo pip install --upgrade setuptools
sudo pip install --upgrade distribute
sudo pip install virtualenv virtualenvwrapper
echo -e "\nsource /usr/local/bin/virtualenvwrapper.sh" >> .bash_profile
mkvirtualenv <your-virtual-env-name>
workon <your-virtual-env-name>
@JoeReis
JoeReis / data_munger.py
Last active August 29, 2015 14:03
Simple Python Script To Convert A Table Into Machine Learning ready format
"""
Goal is to be able to transform a text file into machine readable form
"""
import pandas as pd
import numpy as np
from sklearn import preprocessing
#open the file
df = pd.read_csv('<your file name>')
#select categoricals
@JoeReis
JoeReis / Receive classpath
Last active December 14, 2015 23:19
This adapts the "Recv" file in the RabbitMQ tutorial #1 to write a message to a Postgres database. The same rationale can apply to other databases besides Postgres. There are two versions of this tutorial - Python and Java. We're using Java in this example. The only thing you need to change from the tutorial is the Recv.java file and the classpa…
java -cp .:commons-io-1.2.jar:commons-cli-1.jar:rabbitmq-client.jar:postgresql-9.2-1002.jdbc3.jar Receive