Skip to content

Instantly share code, notes, and snippets.

View dalequark's full-sized avatar
💭
🪂 slacking

Dale Markowitz dalequark

💭
🪂 slacking
View GitHub Profile
@dalequark
dalequark / objecttracker.js
Created June 18, 2021 21:11
Simple object tracker
View objecttracker.js
function huntForPets(monitoredItem, detectionArray, target) {
// naughtyAnimals is an array that keeps track of each animal are in frame
var naughtyAnimals = [];
// Loop through all of the objects recognized by the API
for (let i = 0; i < detectionArray.length; i++) {
// If we found one of the objects we were looking for...
if (detectionArray[i].class === target && detectionArray[i].score > MIN_DETECTION_CONFIDENCE) {
// Draw a bounding box on screen
renderFoundObject(detectionArray[i]);
@dalequark
dalequark / bbox_distance.js
Created June 17, 2021 21:43
bbox distance
View bbox_distance.js
class BBox {
constructor(bbox) {
let x = bbox[0];
let y = bbox[1];
this.width = bbox[2];
this.height = bbox[3];
this.midX = x + this.width / 2;
this.midY = y + this.height / 2;
}
@dalequark
dalequark / webcam_obj_detection.html
Last active June 18, 2021 23:34
Webcam object detection
View webcam_obj_detection.html
<!-- Load TensorFlow.js. This is required to use coco-ssd model. -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"> </script>
<!-- Load the coco-ssd model. -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/coco-ssd"> </script>
<script>
// Grab DOM reference to video element.
const video = document.getElementById('webcamVideo');
@dalequark
dalequark / stt_api_output.json
Created February 2, 2021 23:07
stt_api_output.json
View stt_api_output.json
[
{
"transcript": "Software developers. We're not known for our Rock and style. Are we or are we today? I'll show you how I use ml to make new trendier taking inspiration from influencers. I'm going to build an app that analyzes my closet and pictures of fashionable influencers and then makes me outfit recommendations. If I'm missing an important piece will also recommend me products to buy let me show you how",
"words": [
{
"word": "Software",
"start_time": 0.2,
"end_time": 0.6,
"speaker_tag": 0
},
@dalequark
dalequark / spreadsheet.gs
Created December 1, 2020 22:18
Spreadsheet NLP on GCP
View spreadsheet.gs
/**
* Copyright 2020 Google LLC
*
* 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
View canAddItem.py
def canAddItem(existingArray, newType):
bottoms = {"pants", "skirt", "shorts", "dress"}
newType = newType.lower()
if newType in existingArray:
return False
if newType == "shoe":
return True
if newType in bottoms and len(bottoms.intersection(existingArray)):
return False
if newType == "top" and "dress" in existingArray:
@dalequark
dalequark / rtt2
Created August 6, 2020 00:06
rtt2
View rtt2
sudo apt-get update && sudo apt-get install -y git python3-dev python3-pygame python3-venv libatlas-base-dev libasound2-dev python3-pyaudio
sudo cp /usr/share/alsa/alsa.conf /usr/share/alsa/alsa.conf.orig
@dalequark
dalequark / rtt1
Last active August 6, 2020 00:05
dalessickgist
View rtt1
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get install apt-transport-https ca-certificates gnupg
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-sdk
View dalessickgist
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
View gist:a21006ad5e4b3754813ecb5da6a4edb9
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list