Skip to content

Instantly share code, notes, and snippets.

View jlertle's full-sized avatar

Jason Lee Ertle jlertle

  • Saint Petersburg, FL, US
View GitHub Profile
@jlertle
jlertle / dynamodb_item_to_dict.py
Created December 13, 2017 08:53 — forked from JamieCressey/dynamodb_item_to_dict.py
Coverts a Python Boto3 DynamoDB item to a standard dictionary
def parse_dynamo_item(item):
resp = {}
if type(item) is str:
return item
for key,struct in item.iteritems():
if type(struct) is str:
if key == 'I':
return int(struct)
else:
return struct
@jlertle
jlertle / boto_dynamodb_methods.py
Created December 13, 2017 05:53 — forked from martinapugliese/boto_dynamodb_methods.py
Some wrapper methods to deal with DynamoDB databases in Python, using boto3.
# Copyright (C) 2016 Martina Pugliese
from boto3 import resource
from boto3.dynamodb.conditions import Key
# The boto3 dynamoDB resource
dynamodb_resource = resource('dynamodb')
def get_table_metadata(table_name):
@jlertle
jlertle / dict_to_dynamodb_item.py
Last active June 25, 2019 07:16 — forked from JamieCressey/dict_to_dynamodb_item.py
Covert a Python dictionary to Boto3 DynamoDB item
def dict_to_item(raw_dict):
"""Covert a Python dictionary to Boto3 DynamoDB item"""
if isinstance(raw_dict, dict):
resp = {}
for k, v in raw_dict.iteritems():
if not v:
continue
if isinstance(v, str):
resp[k] = {'S': v}
@jlertle
jlertle / CherryPy.wsgi
Created November 26, 2017 07:13 — forked from omedhabib/CherryPy.wsgi
CherryPy.wsgi
import socket
from cherrypy import wsgiserver
from app import application
server = wsgiserver.CherryPyWSGIServer(
bind_addr=('0.0.0.0', 9808),
wsgi_app=application,
request_queue_size=500,
server_name=socket.gethostname()
)
@jlertle
jlertle / sync-using-gitignore.sh
Created October 28, 2017 07:13 — forked from theothermattm/sync-using-gitignore.sh
Rsync files using .gitignore
# sync everything excluding things in .gitignore
# delete anything on target not in source
# include dotfiles and symlinks, also use compression
rsync -azP --delete --filter=":- .gitignore" . my-target-host:/my/target/directory
set(ENV{OPENCV_FFMPEG_BUILD_DIR} /home/$ENV{USER}/ffmpeg_build)
set(ENV{PKG_CONFIG_PATH} $ENV{OPENCV_FFMPEG_BUILD_DIR}/lib/pkgconfig)
set(ENV{LD_LIBRARY_PATH} $ENV{OPENCV_FFMPEG_BUILD_DIR}/lib)
set(ENV{C_INCLUDE_PATH} $ENV{OPENCV_FFMPEG_BUILD_DIR}/include)
set(ENV{CPLUS_INCLUDE_PATH} $ENV{OPENCV_FFMPEG_BUILD_DIR}/include)
set(CMAKE_INSTALL_PREFIX $ENV{OPENCV_FFMPEG_BUILD_DIR})
set(CMAKE_CXX_FLAGS "" CACHE STRING "c++ flags")
#include <cv.h>
#include <highgui.h>
using namespace cv;
int main( int argc, char** argv ){
char* imageName = argv[1];
Mat image;
@jlertle
jlertle / install-ffmpeg-amazon-linux.sh
Last active September 18, 2017 21:31 — forked from prashantmaurice/install-ffmpeg-amazon-linux.sh
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on gist.github.com/gboudreau/install-ffmpeg-amazon-linux.sh
# and https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
# if [ "`/usr/bin/whoami`" != "root" ]; then
# echo "You need to execute this script as root."
# exit 1
# fi
@jlertle
jlertle / install-ffmpeg-amazon-linux.sh
Created September 15, 2017 01:38 — forked from gboudreau/install-ffmpeg-amazon-linux.sh
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF
@jlertle
jlertle / BUILD_AWS_LAMBDA.md
Created September 14, 2017 18:09 — forked from joseph-zhong/BUILD_AWS_LAMBDA.md
Building OpenCV for AWS Lambda Python

To build OpenCV3.0 for AWS Lambda Python

Summary

Because AWS Lambda runs in a Amazon Linux environment, to run external modules you must

Create the OpenCV build environment

sudo yum update -y