Skip to content

Instantly share code, notes, and snippets.

View wyojustin's full-sized avatar

Justin Shaw wyojustin

View GitHub Profile
wyojustin /
Created July 28, 2022 20:24
capture aruco codes from webcam using opencv2
import cv2
import cv2.aruco as aruco
markerSize = 4
key = getattr(aruco, f'DICT_{markerSize}X{markerSize}_{totalMarkers}')
arucoDict = aruco.Dictionary_get(key)
def findArucoMarkers(img, draw=True):
wyojustin /
Created October 11, 2020 16:37
Convert an image to a mono-bit dithered image.
from PIL import ImageOps
from PIL import Image
import numpy as np
import pylab as pl
import sys
usage = '''USAGE:
python <input_image_fn> [dim]
if len(sys.argv) < 2:
#include "FastLED.h"
// FastLED "100-lines-of-code" demo reel, showing just a few
// of the kinds of animation patterns you can quickly and easily
// compose using FastLED.
// This example also shows one easy way to define multiple
// animations patterns and have them automatically rotate.
from pylab import *
from numpy import *
Me = 5.98E+24 # KG
G = 6.67E-11 # KG^2/(MS^2)
Re = 6378137 # M
Rp = 6356752 # M
DEG = pi/180
lat = arange(-90, 91, 1) * DEG
wyojustin / COVID19 Timeseries Plot
Last active March 8, 2020 15:11
Plot animation of spread of COVID 19
Download data from github:
Place this file in
wyojustin /
Created October 26, 2019 21:00
NavKey Test Code
import time
import smbus2
I2C = smbus2.SMBus(1)
INT_DATA = 0x00
wyojustin /
Created September 7, 2019 18:48
Widget that implements NavKey
Send serial messages based on button presses and thum wheel movement
from tkinter import *
from numpy import *
import serial
s = serial.Serial('/dev/ttyUSB0', baudrate=115200, timeout=.1)
wyojustin /
Created February 24, 2019 12:44
Google Photo Upload
### downloaded from web. Contact me if you developed this and would like attribution. wyojustin
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import AuthorizedSession
from google.oauth2.credentials import Credentials
import json
import os.path
import argparse
import logging
def parse_args(arg_input=None):
wyojustin /
Last active February 28, 2019 00:03
Tkinter Long Press Detector (Credit: [laurentalacoque](/laurentalacoque))
#### USAGE! Attach to self.image (not self.root) that way button clicks do not count as long presses.
#### otherwise the button call backs hang long enough to trigger the long press
## self.longpress_obj = LongPressDetector(self.image, long_press_cb)
class LongPressDetector:
"""Helper class that calls a callback after a long press/click"""
# call_back will get the long_click duration as parameter
def __init__(self, root, call_back, long_press_duration = 1000 ):
"""Creates the LongPressDetector
wyojustin / ClockIOT.ino
Last active October 28, 2018 12:07
ClockIOT for esp8266
#include <Time.h>
#include <Wire.h>
#include <WiFiManager.h>
#include <FastLED.h>
#include <PubSubClient.h>
#include <EEPROM.h>
#include <EEPROMAnything.h>
#include <NTPClient.h>
#include <WebSocketsServer.h>