Skip to content

Instantly share code, notes, and snippets.

import cv2
import cv2.aruco as aruco
import numpy as np
from enum import Enum
from math import cos, sin
import pandas as pd
# define a video capture object (continuinity camera)
# Swap it out in the instance of it picking the internal MacBook camera
# (why it's not constant I don't know)
//
// ContentView.swift
// playing2
//
// Created by Scott O'Brien on 12/29/22.
//
import SwiftUI
import RealityKit
import ARKit
KeyboardLayout = [
[
{
"a": 6
},
"Esc",
"F1",
"F2",
"F3",
@scottyob
scottyob / Kicad-Keyboard-Support-Exporter.py
Last active September 6, 2024 23:21
A script to export support items from KiCAD to JSON
# Board Importer
# ABOUT
# The board has the following Edge Cuts:
# - Circles: These are for support screws
# - Polygon: This is the outside shape type
import pcbnew
import logging
@scottyob
scottyob / freecad-keyboard-import.py
Last active December 4, 2024 21:26
Script to import into FreeCAD for my keyboard project.
from itertools import chain
spec = {"width": 76.9, "height": 117.7, "support_stems": [[19.2, -19.15], [-19.45, -19.1], [-19.35, 19.0]], "switches": [[9.53, 28.0], [-19.05, -48.2], [9.53, -48.2], [-9.53, 8.95], [-28.58, -10.1], [-9.53, -29.15], [-9.53, -10.1], [28.57, 28.0], [28.57, -38.67], [28.57, -0.57], [-28.58, 28.0], [9.53, -10.1], [-28.58, -29.15], [9.53, 8.95], [9.53, -29.15], [-28.58, 8.95], [-9.53, 28.0]], "diodes": [[-19.4, -56.6, 180.0], [10.2, -56.6, 180.0], [-27.5, 0.5, 180.0], [19.6, 4.3, 90.0], [-27.9, 19.65, 180.0], [-8.45, 0.5, 180.0], [10.0, -18.6, 180.0], [10.6, 0.5, 180.0], [-9.0, 19.65, 180.0], [-8.8, -18.6, 180.0], [10.2, 19.65, 180.0], [29.3, 19.7, 180.0], [-8.55, -37.65, 180.0], [19.6, -33.85, 90.0], [-27.6, -37.65, 180.0], [-28.0, -18.6, 180.0], [10.0, -37.65, 180.0]], "smd_cutouts": [[19.8, 19.8, 6.4, 8.0], [30.7, 17.8, 9.8, 6.0], [2.1, -38.5, 8.2, 4.2], [0.0, -32.0, 5.6, 8.8], [30.1, -19.6, 15.0, 7.6]]}
DIODE_LENGTH = 5
DIODE_WIDTH = 2
SMD_HEIGHT = 1.3
@scottyob
scottyob / sx1262.cpp
Created February 13, 2025 21:07
SX1262 module test.
#include <Arduino.h>
// include the library
#include <SPI.h>
#define RADIOLIB_DEBUG_BASIC \
(1) // basic debugging (e.g. reporting GPIO timeouts or module not being found)
#define RADIOLIB_DEBUG_PROTOCOL (1) // protocol information (e.g. LoRaWAN internal information)
#define RADIOLIB_DEBUG_SPI \
(1) // verbose transcription of all SPI communication - produces large debug logs!
@scottyob
scottyob / basic-stats.cpp
Created February 28, 2025 00:04
basic-demo
#include <Arduino.h>
#include "esp_heap_caps.h"
#include "esp_system.h"
void printMemoryStats() {
Serial.println("=== Memory Stats ===");
// Heap memory info
Serial.printf("Free Heap: %u bytes\n", esp_get_free_heap_size());
Serial.printf("Largest Free Block: %u bytes\n", heap_caps_get_largest_free_block(MALLOC_CAP_8BIT));
#include <Arduino.h>
#include <WiFi.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
#include "esp_heap_caps.h"
#include "esp_system.h"
BLEServer* pServer = nullptr;
BLECharacteristic* pCharacteristic = nullptr;
## BEFORE this PR:
=== Memory Stats ===
Total Heap: 296 KB
Free Heap: 158 KB
Used Heap: 138 KB
Largest Free Block: 95 KB
Minimum Free Heap Ever: 155 KB
Main Task Stack High Water Mark: 12 KB
Free PSRAM: 0 bytes
Largest Free PSRAM Block: 0 bytes