Skip to content

Instantly share code, notes, and snippets.

AWS LambdaのPythonから利用出来るOpenCV3.0のライブラリを作成する手順

AWS Lambdaの実行環境の確認

AWSのLambda 実行環境と利用できるライブラリで確認する。

2015年12月現在では、 AMI ID: アジアパシフィック(東京) リージョンの ami-cbf90ecb を使っている。

OpenCVのビルド環境を作る

@dersmon
dersmon / prediction.py
Last active May 31, 2016 09:13
Using Transfomer for prediction..
import sys
import caffe
import cv2
import Image
import numpy as np
from scipy.misc import imresize
caffe_root = "/home/simon/Workspaces/caffe/"
#MODEL_FILE = caffe_root + 'models/placesCNN/places205CNN_deploy.prototxt'
@dersmon
dersmon / prediction.py
Created November 11, 2015 13:03
Using a trained caffe model (buggy).
import sys
import caffe
import cv2
import Image
import numpy as np
from scipy.misc import imresize
caffe_root = "/home/simon/caffe/"
#MODEL_FILE = caffe_root + 'models/placesCNN/places205CNN_deploy.prototxt'
@davidejones
davidejones / get_s3_file.sh
Last active July 17, 2024 17:34
curl get file from private s3 with iam role
#!/bin/bash
instance_profile=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/`
aws_access_key_id=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'`
aws_secret_access_key=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'`
token=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | sed -n '/Token/{p;}' | cut -f4 -d'"'`
file="somefile.deb"
bucket="some-bucket-of-mine"
date="`date +'%a, %d %b %Y %H:%M:%S %z'`"
@kylemcdonald
kylemcdonald / build-caffe.md
Last active March 26, 2024 05:52
How to build Caffe for OS X.

Theory of Building Caffe on OS X

Introduction

Our goal is to run python -c "import caffe" without crashing. For anyone who doesn't spend most of their time with build systems, getting to this point can be extremely difficult on OS X. Instead of providing a list of steps to follow, I'll try to explain why each step happens.

This page has OS X specific install instructions.

I assume:

@cb372
cb372 / gist:1d7b1abbbf0c643f2903
Last active June 29, 2018 18:40
Using Elasticsearch as a Spark data source

Install the essentials.

$ brew update && brew install elasticsearch && brew install apache-spark

Start ES.

$ elasticsearch
@thomasst
thomasst / migrate-redis.py
Created May 14, 2015 18:26
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.
@hirobo
hirobo / mongoexport_with_query.sh
Last active August 6, 2020 11:49
Shell script for mongoexport with query
#!/bin/sh
#########################################################
# usage
#do_mongoexport '2015-04-01' '2015-04-02' 'hoge'
#########################################################
get_millis()
{
if [ $# != 1 ]; then
@jimmyislive
jimmyislive / clone_redis.py
Created January 4, 2015 04:53
Redis Elasticache Export
from optparse import OptionParser
import sys
import redis
__author__ = 'Jimmy John'
__doc__ = '''
This is a script to make a copy of a redis db. Mainly to be used for cloning AWS Elasticache
instancces. Elasticache seems to disable the SAVE/BGSAVE commands and you do not have access to
the physical redis instances. The UI allows you to create 'Snapshots', but no way to download
@drorata
drorata / gist:146ce50807d16fd4a6aa
Last active June 3, 2024 06:00
Minimal Working example of Elasticsearch scrolling using Python client
# Initialize the scroll
page = es.search(
index = 'yourIndex',
doc_type = 'yourType',
scroll = '2m',
search_type = 'scan',
size = 1000,
body = {
# Your query's body
})