AWSのLambda 実行環境と利用できるライブラリで確認する。
2015年12月現在では、 AMI ID: アジアパシフィック(東京) リージョンの ami-cbf90ecb を使っている。
AWSのLambda 実行環境と利用できるライブラリで確認する。
2015年12月現在では、 AMI ID: アジアパシフィック(東京) リージョンの ami-cbf90ecb を使っている。
| 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' |
| 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' |
| #!/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'`" |
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:
Install the essentials.
$ brew update && brew install elasticsearch && brew install apache-spark
Start ES.
$ elasticsearch
| """ | |
| 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. |
| #!/bin/sh | |
| ######################################################### | |
| # usage | |
| #do_mongoexport '2015-04-01' '2015-04-02' 'hoge' | |
| ######################################################### | |
| get_millis() | |
| { | |
| if [ $# != 1 ]; then |
| 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 |
| # Initialize the scroll | |
| page = es.search( | |
| index = 'yourIndex', | |
| doc_type = 'yourType', | |
| scroll = '2m', | |
| search_type = 'scan', | |
| size = 1000, | |
| body = { | |
| # Your query's body | |
| }) |