Skip to content

Instantly share code, notes, and snippets.

@moveurbody
moveurbody / pubsub_iot.py
Created January 7, 2021 02:24 — forked from skirdey/pubsub_iot.py
Connecting to AWS IoT MQTT topic using Python and Paho MQTT client
import paho.mqtt.client as paho
import os
import socket
import ssl
from time import sleep
from random import uniform
import json
import logging
logging.basicConfig(level=logging.INFO)
@moveurbody
moveurbody / lifecycle-cheat-sheet.md
Created December 21, 2020 03:16 — forked from HyperBrain/lifecycle-cheat-sheet.md
Serverless Lifecycle Cheat Sheet

Serverless plugin author's cheat sheet

This cheat sheet provides a detailed overview of the exposed lifecycle events and available commands (and entrypoints) of the Serverless framework, that can be hooked by plugins (internal and external ones). The document is structured by the commands invoked by the user.

Lifecycle events are shown as the globally available outer events (all providers) and sub lifecycle events that are provider specific in the called order. Currently only the AWS provider is shown. If you have information about the other provider,

@moveurbody
moveurbody / vpc-fargate.yaml
Created August 20, 2020 09:34 — forked from lizrice/vpc-fargate.yaml
Cloudformation template for setting up VPC and subnets for Fargate
# Usage:
# aws cloudformation --region <region> create-stack --stack-name <stack name> --template-body file://vpc-fargate.yaml
# This template will:
# Create a VPC with:
# 2 Public Subnets
# 2 Private Subnets
# An Internet Gateway (with routes to it for Public Subnets)
# A NAT Gateway for outbound access (with routes from Private Subnets set to use it)
#
@moveurbody
moveurbody / 影像比對
Last active October 18, 2021 03:33
透過Opencv, Python比對A影像是否有出現在B影像之中
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('/Users/yuhsuan/Desktop/matchTemplate_1.jpg',0)
img2 = img.copy()
template = cv2.imread('/Users/yuhsuan/Desktop/matchTemplate_2.jpg',0)
w, h = template.shape[::-1]
# 共有六種比對的演算法,已經先將他設定成只有一種