Skip to content

Instantly share code, notes, and snippets.

View jackyyeh5111's full-sized avatar

Jacky Yeh jackyyeh5111

View GitHub Profile
import sys
import Adafruit_DHT
import requests
import time
headers = {'X-AIO-KEY':'b89e5148eebe4f7b9eb366de79deabba'}
sensor = Adafruit_DHT.DHT11
pin = 4 # GPIO4 (Raspberry Pi 3 pin 7)
@jackyyeh5111
jackyyeh5111 / example_adafruit_post.py
Created May 20, 2019 03:21
Modify the value of light feed on adafruit.io via HTTP post request.
import requests
headers = {'X-AIO-KEY':'08e1fcfcb7554b348679ca0633241e42'}
res = requests.post('https://io.adafruit.com/api/v2/jackyyeh/feeds/light/data', {"value":900}, headers=headers)
print(res.json())
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
img_path = 'image/G2/6.jpg'# Detect and remove unrelevant regions (batch).
import cv2
import numpy as np
import pandas as pd
# Parameters.
group_lst = ['G1', 'G2', 'G3', 'G4']
group_dct = {'G1': 19, 'G2': 13, 'G3': 15, 'G4': 16}
kernel = np.ones((5,5), np.uint8)
img_path = 'image/G2/6.jpg'
from typing import List
from ..component import Component
from ...state import AllState, VehicleState, EntityRelation, EntityRelationEnum, Path, Trajectory, Route, ObjectFrameEnum
from ...utils import serialization
from ...mathutils.transforms import vector_madd, vector_dist
import math
import numpy as np
# Two helper functions to get plaaning time
# Should be moved to mathutils?
"""
data.txt
0,0,0
1,1,0
0,1,1
1,0,1
"""
import torch