Skip to content

Instantly share code, notes, and snippets.

View whitequark's full-sized avatar
🐈‍⬛

Catherine whitequark

🐈‍⬛
View GitHub Profile
@whitequark
whitequark / cxxrtl_debug_server_spec.md
Last active March 5, 2024 17:02
CXXRTL debug server protocol

Version 0.14.0

@whitequark
whitequark / ELEMENT_ISSUES.md
Last active August 12, 2023 19:19
Element issues
  1. (Desktop 1.11.34) Edit events increase unread count, and like in (2) there isn't even any way to find out what was edited besides educated guessing
  2. (Desktop 1.11.34) New messages in threads increase unread count, but there is no easy way to get to the thread that had a new message (like it is for clicking on the room for normal messages)
  3. (Desktop 1.11.34) Thread view is stuffed into the same sidebar as other auxiliary info. I want auxiliary info to be narrow, and the thread view to be wide (ideally replacing the normal view when I'm in a thread); right now this requires constant manual resizing
  4. (Android 1.5.32 no GMS) Notifications sometimes/often arrive in batches hours after the messages arrived on Desktop Element and I responded to them later
  5. (Android 1.5.32) If I lock my phone with Element open on it and unlock it later, sometimes Element blocks without any redraw or indication for >>seconds, which causes the overall OS UI to behave weirdly and not let me do much
  6. (Desktop 1.11.34) Room
@whitequark
whitequark / gist:ed0d0967efab26f2699a7251bf0bd40d
Last active March 13, 2023 11:30
Godox X1T on-air protocol description
CH1 is at 2.413G, format is 250kbps FSK.
All packet bits are inverted wrt nRF24L01+.
<PACKET>:
0xAA 0xAA 0xAA 0xAA 0xC3 0x68 0xC3 0x68 <PAYLOAD>
<PAYLOAD>:
<CONTROL>
<CONFIG>
$ cat ~/fragment8.txt
• The year is 𝟮𝟬𝟴𝟯.
In a post-Amazon world, brain-computer interfaces are widespread. Although expensive, with the total operating cost approaching 20 years of median United States income (and reducing life expectancy by about as much), they are essential for employment. Most people, even young adults, adapt to the newly acquired sensory and control capabilities only in a rudimentary way. Still, this gives you enough of an advantage over your peers that the last two decades saw a steep decline in workplaces where an unaltered human could succeed; or pass a single performance review.
Every parent looking out for their child's future wants to see them transition to the altered life as early as they can—and, since the CLEAR MINDS Act passed in 2061, that means the age of 24. With the prefrontal cortex fully formed and the brain's plasticity almost gone, even the latest low-power hybrid ASIC driving hundreds of implanted electrodes amounts to little more than an awkward way to keep up wit
@whitequark
whitequark / jt51_player.cc
Last active January 22, 2021 02:22
JT51 + CXXRTL + VGM = <3 <3
// Step 1: Obtain Yosys from git.
// Step 2: Download jt51 from https://github.com/jotego/jt51.
// Step 3: Build as follows:
// $ yosys jt51/hdl/*.v -b 'cxxrtl -header' -o jt51_core.cc
// $ CFLAGS="-fbracket-depth=2048 -I$(yosys-config --datdir/include)"
// $ clang++ -O3 $CFLAGS jt51_core.cc jt51_player.cc -o jt51_play
// Step 4: Convert as follows:
// $ python3 vgm2tsv.py music.vgm music.tsv
// Step 5: Play as follows (assuming YM2151 clocked at 4 MHz):
// $ ./jt51_play music.tsv music.wav 4000000
@whitequark
whitequark / jt51_driver.cc
Last active December 22, 2020 12:23
JT51 + CXXRTL = <3
// Step 1: Obtain latest Yosys from https://github.com/YosysHQ/yosys/.
// Step 2: Download jt51 from https://github.com/jotego/jt51.
// Step 3: Build as follows:
// $ yosys jt51/hdl/*.v -b 'cxxrtl -header' -o jt51_core.cc
// $ CFLAGS="-fbracket-depth=2048 -I$(yosys-config --datdir/include)"
// $ clang++ -O3 $CFLAGS jt51_core.cc jt51_driver.cc -o jt51_sim
// Step 4: Enjoy!
#include <fstream>
#include <backends/cxxrtl/cxxrtl_vcd.h>
#lang rosette/safe
(require rosette/lib/angelic
(only-in racket/base syntax->datum))
(define-syntax-rule (define-distinct v x ...)
(begin
(define x v) ...
(assert (distinct? x ...))))
(define-syntax-rule (list-choices x ... sol)
(list (list (evaluate x sol) (syntax->datum #'x)) ...))
@whitequark
whitequark / minlogic.rkt
Last active April 12, 2020 17:06
Logic minimizer with a configurable cost function in 50 lines of Rosette (https://github.com/emina/rosette)
#lang rosette/safe
(require rosette/lib/angelic
rosette/lib/match)
(define (^^ x y) (|| (&& x (! y)) (&& (! x) y)))
(struct lnot (a) #:transparent)
(struct land (a b) #:transparent)
(struct lor (a b) #:transparent)
(struct lxor (a b) #:transparent)
(struct lvar (v) #:transparent)
#lang rosette/safe
(require rosette/lib/angelic
rosette/lib/match)
(current-bitwidth #f)
(require (only-in racket list*))
; bit operations
(define (rotate-right i x)
@whitequark
whitequark / echofile.py
Created October 14, 2019 23:06
file transfer via `echo -ne`
#!/usr/bin/env python3
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
"file", metavar="FILE", type=argparse.FileType("rb"),
help="source file")
parser.add_argument(