Skip to content

Instantly share code, notes, and snippets.

View sowbug's full-sized avatar

Mike Tsao sowbug

View GitHub Profile
@sowbug
sowbug / subscription_1.rs
Last active December 13, 2022 21:31
One way to wrap an Iced subscription around a long-running task in another CPU thread. Probably wrong. See https://github.com/iced-rs/iced/discussions/1600
use iced::{
executor, time,
widget::{button, column, container, text},
window, Application, Command, Event as IcedEvent, Settings, Theme,
};
use iced_native::futures::channel::mpsc;
use iced_native::subscription::{self, Subscription};
use std::thread::JoinHandle;
enum ThingSubscriptionState {
@sowbug
sowbug / subscription_2.rs
Created December 13, 2022 22:46
Try #2 on threaded subscription, this time with a view() method on the app calling into the background struct's methods to construct the view.
// See https://gist.github.com/sowbug/40148c249136a037cc3b4b814e9de129 for try #1
//
// https://github.com/iced-rs/iced/discussions/1600 for more background
use iced::{
executor, time,
widget::{button, column, container, text},
window, Application, Command, Event as IcedEvent, Settings, Theme,
};
use iced_native::futures::channel::mpsc;
@sowbug
sowbug / wiggler.ino
Created July 2, 2023 21:16
USB mouse wiggler for Arduinos that can emulate USB devices
#include "Mouse.h"
void setup() {
Mouse.begin();
// Give it a sec to initialise, or we miss the first jiggle when it's plugged in
delay(5000);
}
int shift = 5;
int instdelay = 50;
@sowbug
sowbug / igloo_tray_side.scad
Created May 6, 2025 18:29
OpenSCAD model of 3mL vial tray for Igloo Legend 6-can cooler
// https://github.com/revarbat/BOSL/wiki/masks.scad#fillet
include <BOSL/constants.scad>
use <BOSL/masks.scad>
test = true;
/////////////////////
vial_diameter = 16.75; // Diameter of the vials in mm
vial_height = 40; // Height of the vials in mm
vial_width = 16.5;