Because AWS Lambda runs in a Amazon Linux environment, to run external modules you must
sudo yum update -y
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 |
# 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): |
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} |
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() | |
) |
# 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; |
#!/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 |
#!/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 |