This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Open another terminal to find your running container id | |
docker ps | |
# CONTAINER ID IMAGE COMMAND... | |
#<CONTAINER ID> py36lambda "bash" ... | |
# Copy the files from container to local | |
docker cp <CONTAINER_ID>:/path/to/file/in/docker /path/to/local/directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install two utilities to download and extract .rpm files | |
yum install yum-utils rpmdevtools | |
# Download .rpm files | |
yumdownloader <package_name> | |
# Extract files from .rpm | |
rpmdev-extract *.rpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from chalice import Chalice | |
import os | |
app = Chalice(app_name='pdftotext') | |
@app.route('/') | |
def index(): | |
# Get a sample pdf file | |
os.system("curl https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf -o /tmp/file.pdf") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from wand.image import Image | |
import os | |
# Download and read pdf file | |
os.system("curl https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf -o /tmp/file.pdf") | |
f = open('/tmp/file.pdf','rb') | |
infile = f.read() | |
f.close() | |
with Image(blob=infile,resolution=150) as img_pdf: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from chalice import Chalice, Response | |
from pdf2image import convert_from_bytes | |
import os | |
from io import BytesIO | |
app = Chalice(app_name='pdf2image') | |
@app.route('/') | |
def index(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bluetooth | |
server_socket=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) | |
port = 1 | |
server_socket.bind(("",port)) | |
server_socket.listen(1) | |
client_socket,address = server_socket.accept() | |
print("Accepted connection from ",address) | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bluetooth | |
import subprocess | |
class BluetoothComm: | |
def __init__(self): | |
self.server_socket=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) | |
port = 1 | |
self.server_socket.bind(("",port)) | |
self.server_socket.listen(1) | |
self.client_socket,address = self.server_socket.accept() | |
print("Accepted connection from ",address) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
plt.figure(figsize=(6.4*5, 4.8*5), constrained_layout=False) | |
img_c1 = cv2.imread("left01.jpg", 0) | |
img_c2 = np.fft.fft2(img_c1) | |
img_c3 = np.fft.fftshift(img_c2) | |
img_c4 = np.fft.ifftshift(img_c3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def distance(point1,point2): | |
return sqrt((point1[0]-point2[0])**2 + (point1[1]-point2[1])**2) | |
def idealFilterLP(D0,imgShape): | |
base = np.zeros(imgShape[:2]) | |
rows, cols = imgShape[:2] | |
center = (rows/2,cols/2) | |
for x in range(cols): | |
for y in range(rows): | |
if distance((y,x),center) < D0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def distance(point1,point2): | |
return sqrt((point1[0]-point2[0])**2 + (point1[1]-point2[1])**2) | |
def butterworthLP(D0,imgShape,n): | |
base = np.zeros(imgShape[:2]) | |
rows, cols = imgShape[:2] | |
center = (rows/2,cols/2) | |
for x in range(cols): | |
for y in range(rows): | |
base[y,x] = 1/(1+(distance((y,x),center)/D0)**(2*n)) |
OlderNewer