Install SAM CLI
$ sudo pip install --user --upgrade aws-sam-cli
Get a list of existing Lambda functions
aws lambda list-functions
Using Postman to test AWS API Gateway
- download Postman app
This notebook is a collection of code snippets and technical "how to" instructions.
$ sudo pip install --user --upgrade aws-sam-cli
aws lambda list-functions
$ pip install jupyter_contrib_nbextensions
$ jupyter contrib nbextension install --user
$ jupyter notebook
References:
https://arxiv.org/abs/1810.04719
https://github.com/google/uis-rnn
https://catalog.ldc.upenn.edu/LDC2001S97
Raspberry Pi 3B | 7-inch touchscreen | 7-inch case | 10.1 touchscreen | Infrared camera |
$ diskutil list
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *15.9 GB disk2
1: Windows_FAT_32 PI3_RASBIAN 15.9 GB disk2s1
$ sudo diskutil unmountDisk /dev/disk2
Password:
Unmount of all volumes on disk2 was successful
$ sudo dd bs=1m if=/Users/uki/Downloads/2018-10-09-raspbian-stretch.img of=/dev/disk23944+0 records in3944+0 records out
4135583744 bytes transferred in 3019.441172 secs (1369652 bytes/sec)
$ sudo diskutil eject /dev/disk2Password:
Disk /dev/disk2 ejected
# shorthand
# sframe[3]['image'].show()
# image_testing_SFrame[0:5]['image'].explore()
sframe = image_testing_SFrame[0:5] # show first 5 records
def show_images(sframe, image_column="image", label_column="label"):
for subset_dictionary in sframe:
image = subset_dictionary[image_column]
print(subset_dictionary[label_column])
image.show()
show_images(sframe, image_column="image", label_column="label")
show_images(sframe)
dogs_SFrame = image_training_SFrame.filter_by(values="dog", column_name="label", exclude=False)
print(dogs_SFrame["label"][0:15])
['dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog']
animals = ["dog", "cat", "bird"]
animals_SFrame = image_training_SFrame.filter_by(values=animals, column_name='label', exclude=False)
print(animals_SFrame["label"][0:15])
['bird', 'cat', 'cat', 'dog', 'bird', 'dog', 'bird', 'bird', 'cat', 'dog', 'cat', 'bird', 'cat', 'cat', 'dog']
training_sframes = {}
for label in unique_labels:
#print (label)
training_sframes[label] = image_training_SFrame.filter_by(
values = label,
column_name = "label",
exclude = False)
for key_name in training_sframes: # dictionary training_sframes
print(key_name)
labels_column_SArray = SFrame_DataSet['label']
print(type(labels_column_SArray))
unique_labels = labels_column_SArray.unique()
print(unique_labels)
['bird', 'dog', 'cat', 'automobile']
$ tar xvzf BIG_DATASET_MANY_THOUSANDS_FOLDERS.tar.gz
$ tar xvfz BIG_DATASET_MANY_THOUSANDS_FOLDERS.tar.gz /directory_path
# parameters:
# -a --archive; look at everything recursively
# -i; --itemize-changes; print update about each file
# -h; --human-readable
# -W; --whole-file; avoid file deltas
# --progress; show progress in terminal
# --log-file=XYZ.log; log the progress to file, this might be useful when resuming
$ rsync -aW source_directory/ destination_directory/
$ conda env export > environment_turi_20181105.yml
rm -r .... /anacondaX/
conda env create -f environment_turi_20181105.yml
$ conda activate turi
$ conda env list
# conda environments:
#
/Users/uki/.julia/conda/3
/Users/uki/.julia/packages/ORCA/uEiWT/deps
base /anaconda2
turi * /anaconda2/envs/turi
python -m ipykernel install --user --name turi --display-name "Python 2.7 (turi)"
$ jupyter notebook
$ source activate py36
$ conda env list
# conda environments:
/Users/uki/.julia/conda/3
/Users/uki/.julia/packages/ORCA/uEiWT/deps
base /Volumes/DATA/anaconda3
py2 /Volumes/DATA/anaconda3/envs/py2
py36 * /Volumes/DATA/anaconda3/envs/py36
$ conda install -c derickl turicreate
$ conda install ipykernel
$ conda update --all
python -m ipykernel install --user --name py36 --display-name "Python 3.6 Turi (env py36)"
Installed kernelspec py36 in /Users/uki/Library/Jupyter/kernels/py36
$ conda env export > environment_py36_20181102.yml
$ jupyter notebook
import turicreate as turi
WARNING: You are using MXNet 1.2.1 which may result in breaking behavior. To fix this, please install the currently recommended version: pip uninstall -y mxnet && pip install mxnet==1.1.0 If you want to use a CUDA GPU, then change 'mxnet' to 'mxnet-cu90' (adjust 'cu90' depending on your CUDA version):
(py36) $ pip uninstall -y mxnet && pip install mxnet==1.1.0
$ jupyter notebook
Traceback (most recent call last):
File "/anaconda3/bin/jupyter-notebook", line 11, in
sys.exit(main())
File "/anaconda3/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "", line 2, in initialize
File "/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 1602, in initialize
self.init_webapp()
File "/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 1381, in init_webapp
self.http_server.listen(port, self.ip)
File "/anaconda3/lib/python3.7/site-packages/tornado/tcpserver.py", line 143, in listen
sockets = bind_sockets(port, address=address)
File "/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 168, in bind_sockets
sock.bind(sockaddr)
OSError: [Errno 49] Can't assign requested address
$ jupyter notebook --ip=127.0.0.1
$ lsof | grep 8888Skype 407 uki txt REG 1,5
$ lsof -nP | grep 8888
_ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.0.1 (2018-09-29) _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release|__/ |
julia> println("Hello World,", "Julia!")Hello World,Julia!
git clone https://github.com/JuliaLang/julia.git
julia> using Pkg
julia> Pkg.add("IJulia")
$ git clone https://github.com/stevengj/NBInclude.jl.git julia_NBInclude
$ ping Google.comPING Google.com (74.125.138.102) 56(84) bytes of data.
$ ssh dummy@74.125.138.102ssh: connect to host 74.125.138.102 port 22: Connection refused
$ python --version
$ python3 --version
$ python3
wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda-2.3.0-Linux-x86_64.sh-bash: .: Anaconda-2.3.0-Linux-x86_64.sh: cannot execute binary file
$ chmod +x Anaconda-2.3.0-Linux-x86_64.sh
$ . Anaconda-2.3.0-Linux-x86_64.sh
$ java
$ sudo apt install default-jre
$ sudo apt install openjdk-11-jre-headless
$ sudo apt install openjdk-8-jre-headless
$ sudo apt install openjdk-11-jre-headless
$ java --versionopenjdk 10.0.1 2018-04-17
/Volumes/DATA/anaconda3/envs/py27/lib/python2.7/site-packages/graphlab/canvas/server.pyc
108 self.__server = tornado.httpserver.HTTPServer(self.__application, io_loop=self.__loop)
TypeError: initialize() got an unexpected keyword argument 'io_loop'
Fix Attempt 1:
$ conda update tornadoenvironment location: /Volumes/DATA/anaconda3/envs/py27tornado: 5.1-py27h1de35cc_0 --> 5.1.1-py27h1de35cc_0Fix is not successfulFix Attempt 2:
Reinstall Anaconda3
$ conda activate base
$ conda update -n base -c defaults conda
$ conda update --all -y
$ conda create -n py_36_tf python=3.6 tensorflow -y
$ ls -alt ~/Library/Jupyter/kernels/
$ conda info --envs
$ python -m ipykernel install --user --name py_36_tf --display-name "Python 3.6 (tensorflow)"
$ rm -r ~/Library/Jupyter/kernels/my_old_kernel_name
pip install Adafruit-PCA9685