Skip to content

Instantly share code, notes, and snippets.

View rosterloh's full-sized avatar

Richard Osterloh rosterloh

View GitHub Profile
@rosterloh
rosterloh / edge_detection.py
Created May 30, 2019 09:15
OpenCV Edge Detector
"""
Loads and displays a video.
"""
# Importing OpenCV
import cv2
import numpy as np
# Create a VideoCapture object and read from input file
# If the input is the camera, pass 0 instead of the video file name
@rosterloh
rosterloh / boot.py
Created May 28, 2019 15:49
CircuitPlayground Express Current Logger
# boot.py
# Set Circuit Playground Express flash chip to program writeable
# If toggle switch is right,
# flash is program writeable and file access is frozen
# If toggle switch is left,
# flash chip file access ok, file writes give an error
# via Dan Conley
# https://learn.adafruit.com/cpu-temperature-logging-with-circuit-python/
# writing-to-the-filesystem
# 2018 Mike Barela for Getting Started with Circuit Playground Express
@rosterloh
rosterloh / m5cam.yaml
Last active November 4, 2023 10:41
ESPHome for m5cam
esphome:
name: m5cam
platform: ESP32
board: m5stack-core-esp32
wifi:
ssid: "ssid"
password: "password"
# Enable logging
from machine import I2C, Pin
import ssd1306
import mpu6050
from simulation import Simulation
i2c = I2C(scl=Pin(5), sda=Pin(4))
display = ssd1306.SSD1306_I2C(128, 64, i2c)
accel = mpu6050.accel(i2c)
s = Simulation(accel, display)
@rosterloh
rosterloh / .gdbinit
Created October 22, 2018 12:44
GDB init commands for Black Magic Probe
target extended-remote /dev/ttyACM0
monitor version
monitor swdp_scan
attach 1
set mem inaccessible-by-default off
@rosterloh
rosterloh / splashscreen.service
Created October 15, 2018 14:07
For testing run with -vt 1 on an ssh terminal
[Unit]
DefaultDependencies=no
After=local-fs.target
[email protected]
[Service]
StandardInput=tty
StandardOutput=tty
ExecStart=/usr/bin/fbi -d /dev/fb0 --once --noverbose --autozoom /opt/splash.png
import datetime as dt
import tkinter as tk
import tkinter.font as tkFont
import matplotlib.figure as figure
import matplotlib.animation as animation
import matplotlib.dates as mdates
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import tmp102
import apds9301
@rosterloh
rosterloh / analyse.py
Last active June 6, 2018 20:04
CV-ND Project 2
import sys
sys.path.append('/opt/cocoapi/PythonAPI')
from pycocotools.coco import COCO
import nltk
nltk.download('punkt')
from data_loader import get_loader
from torchvision import transforms
import torch
from collections import Counter
import numpy as np
@rosterloh
rosterloh / FileLoggingTree.java
Created May 7, 2018 09:40
Timber log to file
public class FileLoggingTree extends Timber.DebugTree {
private static final String LOG_TAG = FileLoggingTree.class.getSimpleName();
@Override
protected void log(int priority, String tag, String message, Throwable t) {
try {
String path = "Log";
String fileNameTimeStamp = new SimpleDateFormat("dd-MM-yyyy",
Locale.getDefault()).format(new Date());
@rosterloh
rosterloh / heartrate.py
Created May 3, 2018 08:34
MicroPython Optical Heart Rate
from machine import Pin, Signal, I2C, ADC, Timer
import ssd1306
import time
adc = ADC(0)
i2c = I2C(-1, Pin(5), Pin(4))
display = ssd1306.SSD1306_I2C(128, 32, i2c)
MAX_HISTORY = 250