Sam Gentle.com

Prototype wrapup #41

Last time I did a prototype wrapup it was mainly home automation stuff. Since then I've fallen out of prototypes habit a bit but, especially with my recent integration push, I'm starting to pick up on them a little and use them for bigger projects.

Saturday

I've had a little Arduino-on-a-breadboard kit for a while, but I never actually set it up properly. I thought it would let me program the bootloader (ie that it would work as an ISP), but actually it just connected to the serial pins by default. However, by using the broken out FT232 pins in bitbang mode and a few jumper wires it was possible to do it. Even though the functionality was all there it took a totally unreasonable amount of time to figure out how to do it, so I thought I'd capture my newfound knowledge in a shell script for posterity.

Friday

I'm working on an interesting project for Prismatik Labs that involved some Javascript AST mangling, so I thought I'd try to get comfortable with the Typescript API. It was actually pretty easy once I figured it out, but a lot of it is undocumented, so this is a little demo transformer that adds comments around function calls and function definitions.

Tuesday

This was a bit of a tale of woe. I was setting up user groups on a Linux machine and running into that annoying problem where you add yourself to a new group, but for it to take effect you have to quit and log back in. I carefully put together the Linux syscall magic necessary to load the group list and update the current groups, before realising that what I was trying to do was fundamentally impossible under Linux's security model (a process can only relinquish privileges, not gain them, and an extra group counts as gaining privileges). Still, here's some code that would work if it was somehow injected into your shell and your shell was running as root anyway (or had CAP_SETGID, which is pretty close).

Saturday

On the other hand, this worked great. I'm doing some new brain things and I needed to convert the raw data format used by my code to something that research-grade tools could understand. So I wrote the unimaginatively named txt2edf to do it. I tested it out using a BDF file and BrainVision Analyzer and, although random markers showed up for no reason, the data itself seemed to import cleanly.