Skip to content

Instantly share code, notes, and snippets.

@ancientstraits
ancientstraits / LEDSubsystem.java
Created March 27, 2025 00:43
LED Subsystem with Trapezoid and Physics Object
package frc.robot;
import static edu.wpi.first.units.Units.Inches;
import static edu.wpi.first.units.Units.InchesPerSecond;
import edu.wpi.first.math.MathUtil;
import edu.wpi.first.wpilibj.AddressableLED;
import edu.wpi.first.wpilibj.AddressableLEDBuffer;
import edu.wpi.first.wpilibj.LEDPattern;
import edu.wpi.first.wpilibj.LEDPattern.GradientType;
@ancientstraits
ancientstraits / mirror_pathplanner_auto.py
Created March 22, 2025 14:08
Python script to mirror pathplanner autos (Warning: .path files may get overwritten!)
import json
import re
FIELD_Y_DIM = (26*12 + 5) * 0.0254
PATHPLANNER_ROOT = 'src/main/deploy/pathplanner'
PATHPLANNER_PATHS = f'{PATHPLANNER_ROOT}/paths'
PATHPLANNER_AUTOS = f'{PATHPLANNER_ROOT}/autos'
# returns new position for align command
def flip_align_position(position: int) -> int:
@ancientstraits
ancientstraits / genImportMap.js
Created March 18, 2025 17:10
Generating an Import Map
import fs from 'node:fs'
const imports = [
{ alias: 'firebase/app', path: '@firebase/app' },
{ alias: 'firebase/auth', path: '@firebase/auth' },
{ alias: 'firebase/database', path: '@firebase/database' }
]
if (!fs.existsSync('node_modules')) {
console.error('Please run `npm i`')
@ancientstraits
ancientstraits / Recorder.java
Created March 15, 2025 15:15
Recorder class. :)
package frc.robot;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.ByteBuffer;
import com.ctre.phoenix6.mechanisms.swerve.LegacySwerveRequest.RobotCentric;
import com.ctre.phoenix6.swerve.SwerveRequest;
import edu.wpi.first.wpilibj2.command.Command;
@ancientstraits
ancientstraits / GalactechSensors2.ino
Created February 22, 2025 19:20
THIS 100% WORKS!!!
#include <Wire.h>
void sensorSetup(TwoWire& sensor) {
sensor.begin();
sensor.beginTransmission(0x52);
// MAIN_CTRL (only turn on proximity sensor)
sensor.send(0x00);
sensor.send(0b00000111);
@ancientstraits
ancientstraits / GalactechSensor.ino
Created February 7, 2025 01:40
Galactech Teensy 4.0 Light Sensor
#include <Wire.h>
void setup() {
// put your setup code here, to run once:
pinMode(0, OUTPUT);
Wire.begin();
Serial.begin(115200);
Wire.beginTransmission(0x52);
// MAIN_CTRL (only turn on proximity sensor)
@ancientstraits
ancientstraits / main.py
Created November 10, 2024 18:13
Keyboard sampler python script
import wave
from pathlib import Path
import json
import time
import sys
import keyboard
import pyaudio
writing = False
reverse = False
@ancientstraits
ancientstraits / gl.html
Created May 14, 2024 02:39
webgl type thing
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>gl</title>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
@ancientstraits
ancientstraits / abstracts_and_summaries
Created December 6, 2023 18:03
My prompt's results
Abstract: We present the first deep learning model for segmenting galactic spiral arms and bars. In a blinded assessment by expert astronomers, our predicted spiral arm masks are preferred over both current automated methods (99% of evaluations) and our original volunteer labels (79% of evaluations). Experts rated our spiral arm masks as `mostly good' to `perfect' in 89% of evaluations. Bar lengths trivially derived from our predicted bar masks are in excellent agreement with a dedicated crowdsourcing project. The pixelwise precision of our masks, previously impossible at scale, will underpin new research into how spiral arms and bars evolve.
Summary: Scientists have introduced a groundbreaking deep learning model designed for accurately segmenting galactic spiral arms and bars, outperforming current automated methods and even original volunteer labels, according to expert astronomers in a blinded assessment. With 89% of evaluations rating the predicted spiral arm masks as 'mostly good' to 'perfect,' the mod
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.min.js"></script>
<div id="viewer"></div>
<select id="models"></select>