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 sys | |
import subprocess | |
from tqdm import tqdm | |
def create_test_bash_script(): | |
""" | |
Create a bash script that generates numbers 1 to 1000000 | |
This is just for illustration purpose to simulate a long running bash command |
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 os | |
import math | |
import dask.dataframe as dd | |
import numpy as np | |
import pandas as pd | |
from dask.distributed import Client | |
client = Client('tcp://scheduler:8786') |
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
$ serverless invoke --function currentTime --log --profile localstack --stage local | |
Serverless: config.options_stage: local | |
Serverless: serverless.service.custom.stage: undefined | |
Serverless: serverless.service.provider.stage: ${opt:stage, 'local'} | |
Serverless: config.stage: local | |
Serverless: Using serverless-localstack | |
Serverless: Reconfiguring service apigateway to use http://localhost:4567 | |
Serverless: Reconfiguring service cloudformation to use http://localhost:4581 | |
Serverless: Reconfiguring service cloudwatch to use http://localhost:4582 | |
Serverless: Reconfiguring service lambda to use http://localhost:4574 |
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
service: simple-http-endpoint | |
frameworkVersion: ">=1.2.0 <2.0.0" | |
plugins: | |
- serverless-localstack | |
# - serverless-python-requirements | |
provider: | |
name: aws |
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 os | |
import json | |
import uuid | |
import boto3 | |
# Inside docker use docker dns name localstack | |
# os.environ['LOCALSTACK_SQS_ENDPOINT_URL'] = 'http://localstack:4576' | |
# If your connecting to the localstack outside docker use host dns | |
# each aws service has its own endpoint url ensure boto3 client is configured accordingly |
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
#!/usr/bin/env bash | |
printf "Configuring localstack components..." | |
readonly LOCALSTACK_S3_URL=http://localstack:4572 | |
readonly LOCALSTACK_SQS_URL=http://localstack:4576 | |
sleep 5; | |
set -x |
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
version: "3.7" | |
services: | |
localstack: | |
container_name: "${LOCALSTACK_DOCKER_NAME-localstack}" | |
image: localstack/localstack | |
hostname: localstack | |
networks: | |
- localstack-net | |
ports: | |
- "4566-4599:4566-4599" |
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 zmq | |
import numpy as np | |
port = "5555" | |
context = zmq.Context() | |
footage_socket = context.socket(zmq.SUB) | |
footage_socket.connect("tcp://localhost:%s" % port) | |
footage_socket.setsockopt_string(zmq.SUBSCRIBE, np.unicode('')) |
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 zmq | |
context = zmq.Context() | |
footage_socket = context.socket(zmq.PUB) | |
footage_socket.bind("tcp://*:5555") | |
camera = cv2.VideoCapture(0) # init the camera |
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
package com.zeromq; | |
import org.zeromq.SocketType; | |
import org.zeromq.ZContext; | |
import org.zeromq.ZMQ; | |
import org.zeromq.ZMQ.Socket; | |
public class Subscriber { |