Skip to content

Instantly share code, notes, and snippets.

View doitian's full-sized avatar
🎯
Focusing

ian doitian

🎯
Focusing
View GitHub Profile
@doitian
doitian / parse_usbpcap.py
Created April 28, 2026 10:51
Parse USBPcap captures of the Ulanzi Stream Controller D200X (vid 2207 pid 0019); decodes the 7c7c framing layer and flags host->device frames sent before the first input event as candidates for the firmware's input-enable opcode. Companion to https://github.com/doitian/ulanzi-studio-niri
#!/usr/bin/env python3
"""Extract host->device packets to the Ulanzi D200X from a USBPcap capture.
Pure stdlib; runs on either Linux or Windows. Reads a PCAP/PCAPNG file
captured by USBPcap (https://desowin.org/usbpcap/) and prints every
URB submitted FROM the host TO an endpoint of vid:pid 2207:0019, decoding
the framing layer used by the device:
magic 7c 7c | command_protocol (BE u16) | length (LE u32) | payload
@doitian
doitian / sniff_official_app_windows.py
Created April 28, 2026 10:37
Pure-stdlib Windows HID sniffer for Ulanzi D200X (vid 2207 pid 0019); helps reverse-engineer the official Ulanzi app's startup handshake to unlock 4th-row + encoder input. Companion to https://github.com/doitian/ulanzi-studio-niri
#!/usr/bin/env python3
"""Sniff Ulanzi D200X HID input on Windows while the official app is running.
Pure-stdlib: uses ctypes against setupapi.dll + hid.dll (both ship with
Windows). No pip install, no admin needed for HID-level reads.
================================================================================
Goal
================================================================================
Capture what the official Ulanzi Stream Controller app does that makes the
@doitian
doitian / analogy-between-list-of-vectors-and-list-of-subspaces.md
Last active November 20, 2025 00:36
List of Vectors vs List of Subspaces

This query asks for a comparison between a list of vectors and a list of subspaces based on the concepts established in the sources, particularly regarding properties like span, linear independence, and basis.

Both lists of vectors and lists of subspaces are fundamental building blocks used to describe and structure a vector space $V$. They share analogies rooted in set theory, especially concerning how they generate or combine to form larger structures, but they differ fundamentally in the nature of their elements.

Here is a comparison based on the source material:

1. Fundamental Nature of Elements

Feature List of Vectors ($v_1, \dots, v_m$) List of Subspaces ($V_1, \dots, V_m$)
@doitian
doitian / ractor-fsm.rs
Created November 17, 2025 11:26
Ractor FSM
#[derive(Debug, Clone)]
enum ConnectionState {
Disconnected,
Connecting { attempts: u32 },
Connected { session_id: String },
Reconnecting { last_session: String },
}
enum FSMMessage {
Connect,
#!/bin/bash
# Script to delete AWS Glacier archives with retry logic and resume functionality
# Usage: ./delete-glacier-archives.sh [resume_archive_id]
#
# The script reads archive IDs from the provided file and deletes them one by one
# If an archive deletion fails, it prints the error and retries
# The script can resume from a specific archive ID if provided as an argument
set -euo pipefail
@doitian
doitian / git
Created June 21, 2024 01:51
git shim for WSL
#!/bin/bash
# Check if the current directory starts with /mnt/
if pwd -P | grep -q "^/mnt/"; then
# Use git.exe for directories under /mnt/
exec git.exe "$@"
else
# Use /usr/bin/git for other directories
exec /usr/bin/git "$@"
fi
This file has been truncated, but you can view the full file.
"use strict";
var obsidian = require("obsidian");
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
#!/bin/bash
# Start Python REPL and setup rich
# https://rich.readthedocs.io/en/latest/introduction.html#rich-in-the-repl
""":"
PYTHON=${PYTHON:-python}
if command -v python3 &>/dev/null; then
PYTHON=python3
fi
import base64
from Crypto.Hash import SHA256
from Crypto.PublicKey import ECC
from Crypto.Signature import DSS
from Crypto.Util.asn1 import DerSequence
response = {
"signature": "MEUCICF25qdO6nLreEoBHnyaw-9R6XFHbIu-NwsAI53t016qAiEAgmhlwTEMxoWx"
"Kj79R1rUkB_6nrhJfws82DqHkY_HnqQ",
{
"openrpc": "1.0.0-rc1",
"info": {
"version": "1.0.0",
"title": "Petstore",
"license": {
"name": "MIT"
}
},
"servers": [