# Log 2022-08-09 ## Rust + WASM More notes about [[IDEA - Rust based Microbit Typewriter]]. This produces a smaller allocator and thus smaller [[WASM]] files: - [wee_alloc - Rust](https://docs.rs/wee_alloc/latest/wee_alloc/) Found an example of using [[fontdue]] into a [[HTML Canvas]] element: - [fontdue/index.js at gh-pages · mooman219/fontdue · GitHub](https://github.com/mooman219/fontdue/blob/gh-pages/www/index.js) ```js function renderFontdueCharacter(char = "¾", size = 600) { const rednerResult = wasm.render(size, char); const textureRaw = new Uint8ClampedArray(memory.buffer, rednerResult.bitmap.offset(), rednerResult.bitmap.size()); const clampedFullColor = new Uint8ClampedArray(textureRaw.length * 4); for (let i = 0; i < textureRaw.length; i++) { const intensity = linearIntensityTosRGBIntensity(255 - textureRaw[i]); clampedFullColor[i*4] = intensity; clampedFullColor[i*4 + 1] = intensity; clampedFullColor[i*4 + 2] = intensity; clampedFullColor[i*4 + 3] = 255; } const image = new ImageData(clampedFullColor, rednerResult.width, rednerResult.height); const elem = getCanvasA(); elem.height = rednerResult.height + 20; elem.width = rednerResult.width + 20; const ctx = elem.getContext("2d"); ctx.putImageData(image, 10, 10); const [xmin, ymin] = [rednerResult.xmin, rednerResult.ymin]; rednerResult.free(); return [elem.height, elem.width, xmin, ymin]; } function renderBuiltinCharacter(char = "¾", xmin, ymin, height = 200, width = 200, size = 600) { const elem = getCanvasB(); elem.height = height; elem.width = width; const ctx = elem.getContext("2d"); ctx.font = `${size}px 'Roboto Mono'`; ctx.fillText(char, 10 - xmin, height + ymin - 10); } ``` This of course does 8 byte per pixel at the very least. We need at most 2 bit (gray?) or 1 bit per pixel, and that's important because we really don't have that much memory. Let's look in the [[waveshare 4.2 inch e-ink display]] datasheet to see what the speed of transfer is. Looks like we can get a whole screen flashed at around 15 ms minimum, more realistically around 30 ms (?). In any case, more than fast enough. We'll have to rasterize in 1 bit monochrome to avoid eating too much memory. ![[BBC Microbit#Specification]] A full raster takes 15 kB. ## Capture ### Kicad tooling ecosystem A talk about all kinds of additions to [[KiCad]] and other tricks. They go over: - pretty labels - interactive bill of materials - multi-board panelizer - automated/preset generation of production data - yaml-driven footprint generation - wiring add on - usuing freecad within kicad to generate missing 3d models - simulating bendable pcbs - layout replication for repeated connections - checklists!! - vc w/ gita - [media.ccc.de -The tooling ecosystem that adds joy to KiCad](https://media.ccc.de/v/mch2022-332-the-tooling-ecosystem-that-adds-joy-to-kicad) - [The tooling ecosystem that adds joy to KiCad | Hacker News](https://news.ycombinator.com/item?id=32394607) ### Misc Links An article by a man writing to his wife everyday. Adding to [[SK - 5a0 - 2022-07-26 - Better Communication]]: - [Write a Note to Your Spouse Everyday](https://jdnoc.com/note/) - [Write a note to your spouse every day | Hacker News](https://news.ycombinator.com/item?id=32393545) ## Coffee chat Sourcing bash functions is like having a little collection of army knife, so for example `uniqify = sort | uniq`: - [GitHub - adityaathalye/bash-toolkit: Could be my ever-growing, ever-improving, Swiss Army Toolkit of functions-as-cmd-line-tools and useful-to-me patterns.](https://github.com/adityaathalye/bash-toolkit) And a PHP in bash kind of static site generator: - [GitHub - adityaathalye/shite: The little hot-reloadin' static shite generator from shell.](https://github.com/adityaathalye/shite) The rest I extracted into [[CHAT - 2022-08-09 - Chat with Aditya about DevOps]], as it is quite relevant to my writing about [[Technical Strategy]]. ## Working on PCAP ppa-control Asking Simon for the missing preset name command. I managed to find that it's Commands: 0xa, 0x3, 0x6 and status 35 and 37. Here is changing the Volume using DeviceData: ``` ppa-control on  task/PPA-1/add-pcap-udp-parser via 🐹 v1.18rc1 on ☁️ ttc (us-east-1) ❯ go run ./cmd/pcap ~/Dropbox/Simon\ UDP/sniff\ volume.pcapng | grep -B1 MessageType: src: 192.168.0.49:63259 dst: 192.168.0.255:5001 MessageType: MessageTypePing (0) -- src: 192.168.0.42:5001 dst: 192.168.0.49:63259 MessageType: MessageTypePing (0) -- src: 192.168.0.49:63259 dst: 192.168.0.255:5001 MessageType: MessageTypePing (0) -- src: 192.168.0.42:5001 dst: 192.168.0.49:63259 MessageType: MessageTypePing (0) -- src: 192.168.0.49:63259 dst: 192.168.0.42:5001 MessageType: MessageTypeDeviceData (2) -- src: 192.168.0.42:5001 dst: 192.168.0.49:63259 MessageType: MessageTypeDeviceData (2) -- src: 192.168.0.49:63259 dst: 192.168.0.42:5001 MessageType: MessageType(9) (9) -- src: 192.168.0.42:5001 dst: 192.168.0.49:63259 MessageType: MessageType(9) (9) -- src: 192.168.0.49:63259 dst: 192.168.0.42:5001 MessageType: MessageType(3) (3) -- src: 192.168.0.42:5001 dst: 192.168.0.49:63259 MessageType: MessageType(3) (3) -- src: 192.168.0.49:63259 dst: 192.168.0.42:5001 MessageType: MessageType(3) (3) -- src: 192.168.0.42:5001 dst: 192.168.0.49:63259 MessageType: MessageType(3) (3) -- src: 192.168.0.49:63259 dst: 192.168.0.42:5001 MessageType: MessageType(3) (3) -- src: 192.168.0.49:63259 dst: 192.168.0.42:5001 MessageType: MessageTypeDeviceData (2) -- src: 192.168.0.42:5001 dst: 192.168.0.49:63259 MessageType: MessageTypeDeviceData (2) -- src: 192.168.0.49:63259 dst: 192.168.0.42:5001 MessageType: MessageTypePresetRecall (4) -- src: 192.168.0.42:5001 dst: 192.168.0.49:63259 MessageType: MessageTypePresetRecall (4) ``` This is probably setting the volume, and I don't parse the StatusCommandClient yet: ``` > go run ./cmd/pcap -print-hexdump -print-packets deviceData ~/Dropbox/Simon\ UDP/sniff\ volume.pcapng | less ... ---- src: 192.168.0.49:63259 dst: 192.168.0.42:5001 00000000 02 01 02 01 00 00 00 00 0a 00 ff 01 01 00 03 06 |................| 00000010 c4 02 00 00 |....| -- MessageType: MessageTypeDeviceData (2) ProtocolId: 1 Status: StatusCommandClient (2) DeviceUniqueId: 00000000 SequenceNumber: a ComponentId: ff Reserved: 1 Payload: 00000000 01 00 03 06 c4 02 00 00 |........| Status: StatusCommandClient ---- ``` ## Preparing [[2022-08-09 - Category Theory Catacombs - Week 1]] Starting to work on some kind of structure for the event I'm hosting at RC. I'm not sure who's joining and why and how much time they have to dedicate to it. ## Data Intensive Books We are doing a reading group about: - [[BOOK - Designing Data-intensive Applications - Martin Kleppmann]] ### Agenda How are we going to structure the reading group? A lot of people coming in with: - web developer experience but not much experience with scaling / building bigger systems - people with industry experience and want to dig into the theory behind the systems they have worked with - implementing some of the data structures and topics in the book We could go for breadth over depth and have each member of the group present one or two chapters. There are a lot of additional resources in the book that people could go into. We're going to send out a google form so that everybody can sign up for the chapters they are interested in. We could also look at additional material or discuss other topics around the book (war stories, interview questions, ...). We could discuss the practical side of it as the book is pretty encyclopedical. Max brings up that we could invite people with industry experience to give us a little talk about XY. Julian is also interested in people's personal experiences as that is the value of sharing in such a group, instead of reading the book on our own. Vivian is going to look if she can find some of the lecture recordings from the course she followed (Data Intensive Data Analytics). There is a document to sign up for the topic one is interested in: - [DDIA Reading Group - Google Docs](https://docs.google.com/document/d/1yP3SyVi1IwMYXLNXFrGTGHxn4B27hLY0L3LBFB4-nv4/edit) Presentations are: - War Stories - Reading Summary We were thinking of doing a little presentation for each, about 15 minutes. Because the chapters are pretty dense, you could present just about a single paragraph. We'll keep notes in google doc.