Awhile back I set up a Raspberry Pi to be a gateway to get access to my SunPower PVS6 monitoring system. That’s going great; the extra status info is really helpful and interesting. (Bonus screenshot below). I just bought a Raspberry Pi Zero 2 W to be the new computer for this. It’s so tiny it’ll fit entirely in the PVS6 box, powered by the USB that’s in there.
It works! The wifi is pretty flaky, despite me getting an amazing -30dB signal. It seems to be a problem with one specific access point, need to tinker some more. (Update: it may be wifi power saving.) The cable mess is pretty janky but it’s going to be shut inside a box, not sure I care. A smaller ethernet adapter would sure be nice.
Here’s my detailed software notes on setting this up.
Log in to pvspi0.local using pi/newpassword. Note mDNS takes awhile to start working, a minute or two after the RPi starts up
Install haproxy
Configure /etc/haproxy/haproxy.cfg. I did not include stats.
A brief note on power consumption. Idle the RPi Zero 2 W seems to use about 165mA (at 5W). Running stress-ng -c 4 peaked at 570 mA. The magic number here is 500 mA, that’s the minimum power for a USB port. I expect the system to basically be idle all the time so I think I’m safe with no extra measures. But some ideas on reducing power consumption.
Turn off HDMI. Instructions don’t work.
Turn off LEDs
Use fewer than 4 cores
Turn off unnecessary daemons. bluetoothd, hciattach (the serial console)
Here’s the bonus snapshot of some of my Grafana config. Not running on the RPi; all its doing is proxying requests. These graphs are centered on showing the status of all 28 separate panels, something you can only do by accessing the PVS6 data directly.
One mild annoyance with Starlink is geolocation doesn’t work very well. A lot of sites identify me by my IP address, which is the satellite base station somewhere near Winters, CA 100 miles from me. Even if they use the browser’s geolocation API to get my location my computer, since I don’t have a WiFi connection Firefox seems to fall back on that same IP based location.
Anyway, there’s a simple solution in Firefox. Open the URL about:config and search for “geo”. Edit the value of geo.provider.network.url and change it from the default (a Google service) to a static answer. Here’s what I use, for Grass Valley:
Note this JSON blob is not a Javascript Geolocation API response; it must be some special backend API. Mozilla has their own location API, I wonder why they use Google’s in Firefox?
It’d be nicer to have a browser extension to manage this for me. There used to be a consensus open source choice, Location Guard, but it hasn’t gotten an update for two years. There’s a bunch of spammy looking clones on the Firefox store I won’t trust. Location Guard might still work but when I briefly tried it I couldn’t see how to give out a specific location, only enable their privacy fuzzing.
Note that browser location spoofing won’t be good enough to fake out sites that really care what your location is. They’re probably using your IP address to locate you, or some other more devious means. But it’s a nice solution for ordinary apps that are just trying to do something simple.
Also note setting a single static location is probably a bad idea for a mobile device like a laptop or phone.
Wanted to document this learning as more than some tweets.
The amazing Julia Evans launched Mess with DNS, a little sandbox where you can register some domain names and then see what queries their DNS server of record gets. Great tool for learning.
I learned something! When I did a single A query at home on Sonic.net using their DHCP servers, Mess With DNS sees six queries all at once
That seems like an awful lot. There’s several mysteries here, but the one I focussed on was that query for _.lily6.messwithdns.com. Underscores are generally understood to not be valid in domain names, although the underlying DNS protocols do seem to allow them in some places. But why would a query for a normal subdomain also produce a query for _?
A simple way to reproduce this is $ dig @50.0.1.1 nelson.lily6.messwithdns.com a That’s a different Sonic resolver than I use. It only results in two queries, not six, but it still generates that underscore query.
Over the last ~5 minutes I see ~12 queries per second on average (globally) to 1.1.1.1 for _.www.google.com and ~3 QPS for _.www.cloudflare.com - which is effectively noise.
So that’s interesting. Those queries do exist but they are not very common.
As for what causes them, the Hacker News discussion came through. Several folks all pointed out this is something Bind9 does with the “QNAME optimization” option turned on. One Sonic engineer even explicitly confirmed that was the DNS server they use and the source of the queries.
So what do they mean? QNAME Minimization is a privacy thing in recursive resolvers. If you’re querying foo.bar.example.com at some point you end up asking the .com root server for information. But there’s no need for them to see the whole domain name, so you just send the minimum you need (example.com, I believe.)
That still doesn’t explain the underscore. TBH I don’t really understand it. The Bind9 code is here but there’s few comments. However I was able to find the commit that added it and the comment says
qname minimization, even in relaxed mode, can fail on some very broken domains. In relaxed mode, instead of asking for “foo.bar NS” ask for “_.foo.bar A” to either get a delegation or NXDOMAIN. It will require more queries than regular mode for proper NXDOMAINs.
So that seems to be the answer. It’s not great that this workaround for “some very broken domains” ends up doubling the name server traffic for the rest of the Internet, but here we are.
For completeness, several people pointed to RFC 2782 or RFC 8552. (It’s one of first Google search results for “underscore dns”.) That RFC is about using _ to mangle some other tokens to not collide with domain names; they are used when querying things like _tcp or _udp. I’m pretty sure that’s not what’s going on here.
I’m grateful to have gotten replies from someone at CloudFlare, my ISP, and the author of the QNAME Minimization RFC. It’s nice to be able to get an answer from actual experts.
I’ve been using Starlink since March. I’m also a gamer. While Starlink has gotten a lot better for gaming it’s still not perfect. See this lag graph for an example. Basically every few minutes the game freezes for a second or so and I’m 95% sure it’s Starlink packet loss. It doesn’t make the game unplayable but it is annoying.
Path of Exile is unusual in that the default network mode is lockstep. It only draws a frame if it receives a network packet from the TCP stream, so any packet loss and retransmit delays is immediately visible. Most games compensate for network flakiness by guessing at what probably should have happened and then catching up once the network resumes again. PoE has the option to do that too, but by default they show you exactly what’s coming in on the network. No packets, no updates.
So it’s a nice example of how Starlink’s momentary outages can cause problems. You won’t notice it streaming a video or loading web pages. You’ll see occasional hiccups in a live videoconference. In PoE you see little lag spikes.
I have more proper monitoring for similar loss: see my latency graph based on sending 5 pings at once every 5 seconds. Each red dot is packet loss. It’s really quite good but you see some latency spikes and a few lost packets here and there.
I learned how to make lots of little graphs in Grafana 8 today. It’s a bit strange but I figured it out thanks to this video on variables and these docs. Here’s a visualization of the power production of all 28 solar panels on my house. Some of those panels aren’t doing a lot of work in the morning; hope it’s better in the summer!
The first step is to declare a variable. You do this in the dashboard settings. In this case I wanted to create a variable named “inverter” which has 28 possible values, one per serial number. I’ve already stored the serial numbers as tags in my Influx data so this Influx Query will get at them
show tag values from pvs6_inverter with key=SERIAL
When you do this Grafana will magically add a little selection UI to your dashboard. You can configure whether there’s an “All” option and whether multiple sections are allowed when you define the variable.
Then you need to make a Grafana panel for the graph that is parameterized by that variable. This is as easy as adding a where SERIAL =~ /$inverter$/ to the query for the graph data; you can do this via the graphical query builder. Once you’ve done this you can choose which graph you want to see, but there’s still only one panel with one graph.
The last step is to enable repetition. This is under “Panel Options / Repeat Options”. You choose which variable to repeat by, then what layout you want. “Horizontal” actually means vertical too; I have it set to 6 max per row and it creates multiple rows automatically. Then go back to the dashboard view and select “All”. You should see all your panels. It’s a little wonky about reloading on changes, you may have to do something to force the UI to refresh.
The last bit of polish I did was to remove all the decorations from the graph I could to get it to display more densely. No title, hide the legend, no Y axis. I switched to the Graph (old) widget because I couldn’t figure out how to hide the X time axis in the new Time Series graph. The only thing I couldn’t do was change the padding of the graphs themselves; there’s more whitespace than I’d like. But it’s not bad and I appreciate how much UI work Grafana does, so nicely.
This is news to me. The Firefox page at about:compat shows a bunch of cases where they spoof their User-Agent to get websites to work better. Also other hacks. The most recent one in Firefox 95 is to pretend to be Chrome for Slack so that Slack enables some features. What a terrible kludge on top of a kludge.
The “Overrides” seem to be about tricking websites into enabling features that for some reason are disabled on Firefox. The Interventions seem more targeted, patches for bugs in sites like a CSS hack that prevents some badly performing overdraws on Zillow.
This all reminds me of the hacks Microsoft does to keep broken apps working on Windows.
I’m using Influx more and more for system monitoring. I’m setting up a new system to monitor my solar system and realized I don’t understand Influx data schema. Here’s my notes, based on the docs. This is for Influx 1.8; I think it’s broadly the same in Influx 2 but I’m not sure. Their docs are really quite good but I had to summarize it here to understand it.
Influx schema concepts
I’m going to follow those docs’ example: you have two scientists (langstroth and perpetua) conducting a census, recording observations in two locations (1 and 2). Each observation records two things: the count of butterflies and the count of honeybees. Observations are timestamped. Note the term observation is something I made up; it’s not an InfluxDB term. The question is how you store a bunch of observations in Influx.
Influx feels a little free-form and schemaless but really it’s pretty structured. Each observation is a row. Every row has a bunch of columns in it that boil down to key/value pairs. Rows can have different numbers of columns in them. Here’s all the components of an Influx schema
Measurements. These are more or less like tables in databases. You have one Influx measurement for each observation. In a traditional relational database you’d have a table per kind of data and a row for each observation. In our example there’s one measurement called “census” that records all the observations.
Timestamp. An integer, in nanoseconds. Signed 64 bit numbers from the years 1677 to 2262. In a table database you’d have a column named timestamp. It’s probably indexed.
Fields. These are the measured data for each observation. Fields have keys (names like “butterflies”) and values (numbers like 12). Field values can be strings, floats, integers, or booleans. In a table database you’d have one column per field with the column name being the field key and the values being the field values. There’s probably a lot of different values for field values. Field values are not indexed.
Tags. These are labels for the observations. Tags also have keys (names like “scientist” or “location”) and values (strings like “langstroth” or “location 1”). In a relational database you’d also have one column per tag, named by the tag key and with the tag value stored in the row. There’s probably only a few values for tag values. Tag values are indexed.
Series. A series is the name for all of the measurements that match the same measurement name and tag values. A series isn’t a thing you create explicitly, it’s implied by the set of values of tags. Ie: one series is “all of langstroth’s observations in location 1.” There’s no direct analog for a series in a relational database, but it’s the kind of data you’d regularly query. select timestamp, butterflies, honeybees from census where scientist = langstroth and location = 1
InfluxDB is schemaless in that you can create new series without having to define them first. Insert some new data with a new measurement name and tag values and it will make a new series. Each measurement can have its own collection of fields with values of various types.
In practical use it’s a pretty close match to how we use tables for storing observations in a relational database. The big difference is the distinction between tags and fields; some of the columns are independent variables like who took an observation and some are dependent variables like the count of butterflies.
Designing my solar schema
Going back to my solar monitoring project, the whole reason I’m looking at this is the code I found creates a whole lot of measurements when I think it should create one.
For example there’s a measurement named “sunpower_pvs_inverter_operating_frequency_hertz” and a different one named “sunpower_pvs_inverter_heatsink_temperature_celcius”. Each measurement then has a single field typically named “gauge” where the actual data is stored, a number like the temperature or frequency. That feels clumsy to me, maybe it’s a consequence of the data being cast in Prometheus format?
To me it feels more natural to have a single measurement named “sunpower_pvs_inverter” and for each observation to have two fields with keys “operating_frequency_hertz” and “sunpower_pvs_inverter”. Each field would store the data directly; no “gauge”.
I agree more with the tag design of the code I found. For instance I have 28 inverters and these are represented in the data with tags like device_id=E00100128000007. But they went overboard with tags; there’s separate tags for software version, URL the data came from, etc. This might come in handy with a complex hetereogeneous system but it’s confusing complexity for my simple system.
Here’s the schema I think I want. It kind of tracks the schema implied in Sunpower’s own JSON output from the device_list call. Just four measurements.
PVS status. This is information on the monitoring computer itself. No tags needed, some field keys:
Production. This is measuring data from the PVS6 CT sensors on the solar power production power line and has type “PVS5-METER-P” in the JSON. I don’t think I need any tags at all for this. Some field keys I will record values for:
STATE p_3phsum_kw net_ltea_3phsum_kwh freq_hz s_3phsum_kva q_3phsum_kvar p_3phsum_kw
Consumption. Again CT sensors, this on the house consumption side independent of the solar. This has type “PVS5-METER-C” in the JSON. There’s two values for many things because I have a split phase system with different sensors on each side. Some interesting values:
Inverters. This is the detailed data from each solar panel, there’s one JSON block for each of 18 panels. Some values:
STATE SERIAL ltea_3phsum_kwh p_3phsum_kw vln_3phavg_v i_3phsum_a p_mppt1_kw v_mppt1_v t_htsnk_degc freq_hz
Inverter rollup. I might want to add a synthetic fifth measurement, something that summarizes the state of all the inverters. You could do this at query-time in Grafana or whatever but it’s probably easier to do it in the Python code which is collecting the data. Probably this is what I’d actually graph; trying to draw 28 different inverters separately seems like a mess. Some possible measurements
Count of working inverters
Sum, average and S.D. of inverter kW (both AC and DC)
Number of inverters well below average kW
Sum, average, and S.D. of inverter voltage and current (both AC and DC)
Average and SD of inverter temperature
I think in all cases the timestamp should be when my own monitoring code ran. Each bit of JSON data in the PVS output has its own timestamp and I bet that can matter sometimes, say if an inverter isn’t communicating correctly. But I could imagine a lot going wrong too; I trust my own clock more.
A big question for me is if I should try to filter and reprocess all the data coming from the PVS6 JSON. Or just insert it more or less as-is. Filter each JSON item into either a tag (“SWVER”) or a field (“killowatts”). That means inserting a bunch of junk into Influx I will never care to query. But then again it means not losing data, either.
Data meanings
This has nothing to do with Influx but I was trying to understand what some of these data values mean.
“LTEA” seems to stand for “life time accumulator” and is one of the few (only?) bits of data that has history. Most of the rest are instantaneous values; current watts, not watt-hours.
“3phsum” seems to refer to three phase power, presumably the sum of all three phases so you have a single number. I think my inverters are simple single phase so this doesn’t really apply, but maybe they use that word for consistency with other products. The only measurements of wattage are labelled “3phsum” so I’m gonna just ignore the details.
I got a new Raspberry Pi 4. It’s neat! Some thoughts on it. Bottom line: it’s a great little computer and my only complaint is the SD card I/O is slow.
First, context. A friend gave me an original RPi Rev B way back in 2012 or so. I’ve used it every year or two when I needed a small Linux box to do something. For awhile I had RetroPie on it for gaming. I dusted it off last week to serve as a network proxy for my SunPower PVS6 solar power monitoring system. It’s working great for that! But it’s a very slow, limited system.
So I bought a new RPi4. I got a Vilros kit that includes a case, a power adapter, heatsinks, an SD card, various cables. It’s very convenient. The core computer is $55 but the kit is $135. Probably not a great value but this was in stock at Amazon; like everything else these days, availability is not great.
The RPi4 is the first RPi capable of running a 64 bit OS. The ARM Cortex-A72 CPU in it is quite capable but nothing too exciting, but since it’s the ARMv8-A architecture it’s pretty well up to date. You have your choice of 1-8GB RAM wired on the board. And all the IO integration that makes the RPi so popular. 4 USB ports, gigabit ethernet, two HDMI ports, WiFi and Bluetooth built in, an audio jack, and of course the famous GPIO pins for hackery.
A word on cases. A nice case goes a long way to making it feel like a “real” computer. The Vilros case is a nice aluminum case that fits just right. RPi4s apparently run hot, at least when actively used. My case has an always-on fan. There’s a bunch of passive cooling cases that basically turn the whole chunk of aluminum into a heatsink, that seems like a better idea if it’s sufficient.
On power: the RPi4 uses 3-5 watts. Everyone recommends a good USB power supply, the official one is 5.1V/3.0A. Alternately the RPI4 can be powered over ethernet with a small extra board. Note 3A is a lot of power for USB; that’s a device intended for charging, not just a random computer’s 0.5A USB port.
Operating system
Vilros shipped an SD card with Raspberry Pi OS (aka Raspbian) installed. Full desktop environment. I used it for a few minutes and it seemed to work but was as unlovely as any Linux desktop. Also slow; you could see the background picture repaint when I dragged windows. I only want this as a headless server so I wiped it and put Ubuntu 21.10 server on it. How about that? Stock Ubuntu, compiled for aarch64 and with a clean boot loader. Shout out to the RPi folks for creating a great disk imager. There was also a thing called NOOBS, a small boot system which let an RPi install its own OS, but I guess that’s deprecated.
The RPi4 has some complex boot loading and firmware overlay stuff. I don’t understand it but it seems to work. USB booting is supported via a bootloader on the SD card.
One drawback with Ubuntu is it’s less clear how to tinker with the Raspberry Pi-specific stuff. Raspbian has raspi-config which lets you adjust things like clock speeds, GPU memory usage, etc. It looks like you can just edit config.txt on the Ubuntu boot partition, this works sort of like BIOS settings but for the RPi.
Another useful tool for RPi-specific hacking is vcgencmd. This lets you get at a bunch of state on the GPU, which apparently in this Broadcom implementation is controlling the whole system. This lets you get at things like how much RAM is dedicated to video (78MB for me) and what the current temperatures, voltages, etc are.
There’s a whole lot of software dedicated to working with the GPIO pins. This capability is the really neat hidden feature of the RPi and gets pretty complex as you mess with different modes of I/O: I2C, Serial, etc.
Performance
No one buys an RPi4 for performance. But it’s pretty impressive, particularly by historical standards. Unfortunately it feels slow for interactive stuff. But then I’m spoiled by fast machines with SSDs. The main issue with the RPI4 is the SD card is slow. Some comparisons to an Intel NUC based on a i5-7260U.
With the cheap SD card Vilros sent me hdparm reports about 45 MB/s. Compare 100 MB/s for a spinning disk on an Intel NUC or 1600 MB/s to SSD. I’d hoped the SD would be faster. And that 45MB/s is for synthetic tests: this blog post says 7 MB/s for reads for random access reads. SD cards are clearly not a fast medium. This blog post suggests 100-300MB/s with a proper SSD drive plugged in to USB 3, which is big boy PC speeds but nothing amazing. The RPi4 can boot off USB so you can eliminate the SD entirely if you want. It’s too bad they don’t have an NVMe interface, but then that’d require a PCI bus. (The Compute Module product does have one.)
Another word on I/O: older RPis implemented ethernet on the USB bus so performance was severely limited, particularly if you wanted to use it as a router with multiple ethernet interfaces. Raspberry Pi 4 has a dedicated channel for its ethernet separate from USB, so that helps.
RAM is reasonably fast. Testing with sysbench I get about 4GiB/s on the RPi 4; compare 17GiB/s on the Intel NUC.
CPU is impressively fast. Again testing with sysbench, using one or two threads the RPi was about 1.35x faster than the i5-7260U. With 4 threads the RPi is 1.6x faster. The Intel CPU is 4 threads but only 2 real cores; the RPi4 has four cores. I have no idea if this is a real world CPU benchmark, probably not.
I played around with overclocking a bit. Boosting CPU speed from 1500MHz to 2000MHz gave me about 1.3x speedup. Max temps were 45C and 52C respectively. Then I found the arm_boost=1 config.txt setting, which apparently gets you 1800MHz as a temporary boost with extra voltage. I don’t normally overclock but since they say it’s safe I’ll leave that enabled.
I found a note in the docs that suggests there is no hardware support for video decoding.
Thoughts
What an impressive bit of kit. What I like best is how contained it is; a small pack of cards running a real 64 bit Ubuntu with zillions of hardwaer ports. The only drawback from a conventional computing point of view is you’re limited to USB 3 for disks. And hell that’s not bad at all, with an SSD significantly faster than computers I was using on the daily a few years ago. If I were using the RPi 4 interactively I’d be sure to set up USB booting to a fast disk.
But I’m not using it interactively. In fact I probably won’t use this RPi4 much at all. The old RPi B is doing fine as my proxy device. But now I’ve got this little swiss army knife computer sitting around for the next project where I need something this flexible. I’d like to learn more about ARM as a practical server platform. Or maybe I’ll use it as a web a server for my plotter. Or a base for some home automation tinkering via those tasty GPIO pins.
One other thought; the RPi 4 is the flagship product but there’s other devices. The Raspberry Pi Zero 2 W is a smaller, cheaper system suitable for less demanding uses (like being a web proxy). I/O ports are limited but for a certain type of application it might be more suitable. There’s also a Compute Module which looks like an RPi 4 only without all the I/O ports (and with the SD card built in). I think this may only be of interest to folks designing embedded systems.
Tinkering with my new solar system. The install includes a fancy SunPower monitoring system called a PVS6. SunPower has a decent website which gives you current conditions and hourly history of energy production. But I want more detailed data! And thanks to this guide I’ve got access and am starting to unpack what all is there. This GitHub project also has lots of notes and this PDF is quite detailed.
Access to monitoring data
The PVS6 has a web server with stats you can access over the network. The trick is you have to use the LAN1 installer port to get to it. You don’t want to just plug it into your network; it has a DHCP server of its own that might make mischief. So instead I set up a Raspberry Pi with haproxy to forward HTTP requests to the PVS6. The guide I followed has detailed instructions and now I have access to the PVS6 web API.
So what’s there? The notes here are a detailed guide. The main command for monitoring is DeviceList. Apparently most of the data updates every 15 seconds. The JSON output is complicated, but it boils down to a block for the PVS itself, a block for each CT sensor measuring overall electricity flow, and a block for each inverter (28 microinverters for me). Note it’s pretty slow, about 6-7 seconds to answer a DeviceList query.
The numbers I get from the PVS6 do seem to match what SunPower shows me in their consumer app.
sunpower-pvs-exporter
At this point I took a left turn and decided to install this monitoring setup. It’s a Python project that creates a Prometheus service from the PVS6 data, which Telegraf can import. The project also includes some Grafana dashboards. Looks nice!
I installed sunpower-pvs-exporter directly on the Raspberry Pi, no need for haproxy in the path. Then I set up telegraf to query it (just need to configure the URL) and insert the data in to InfluxDB. The resulting schema is a bit messy; Grafana is now polluted with lots of measurements with names like sunpower_pvs_power_meter_net_energy_watt_hours. And a whole lot more series inside that, and the values all are named “gauge”. Not awesome but I can work with it.
Unfortunately importing the sample dashboards from the project did not work. Some config did come through but not the queries. (Schema mismatch?) I hand-edited a few and got some stuff working but it’s not great. Also the schema is not a great match for Grafana so the queries are pretty contorted. All told I got discouraged at this point; if I’m going to have to do this much hand-work I might as well write my own code to pull data straight from the PVS6 JSON and output it in nicely aggregated Influx format.
Mysteries
My solar install has something weird; their estimate of my usage is wrong. They seem to think that in the middle of the day I’m using 6kW, 3-4x more than I use. Also usage goes up with solar power. I think maybe the CT sensors aren’t installed correctly. Or maybe this has something to do with not being fully activated at PG&E? The electric meter display looks correct, just not the SunPower monitoring, so I’m thinking I have an install problem.
The other confusion is arithmetic. I have one CT power meter labelled “GROSS_PRODUCTION_SITE” and one labelled “NET_CONSUMPTION_LOADSIDE”. That’s what’s graphed in the picture above, those two numbers. But note that’s net consumption; if you want gross consumption you need to add those two numbers. That’s baked in to the sunpower-pvs-exporter’s queries but it confused me at first. Particularly since my net consumption numbers from the power meter seem to be wrong.
jq
I took a quick crack at getting basic wattage output with JQ. This dumps the wattage of all the things in my report; the two meters and also the individual inverters.
p_3phsum_kw appears to be the actual AC power production. I assume that means “3 phase sum”. It seems to account for reactive loads.
Thoughts
At this point I’m declaring victory for the day. I’ve got access to the data. I still need a system to massage it and import it into InfluxDB and I don’t think sunpower-pvs-exporter is it for me. Too many problems. Telegraf’s JSON plugin might be sufficient but I’ll probably end up writing my own Python code so I can massage things as desired. In particular I’m trying to think how to handle the data streams for all 28 inverters, that seems a bit unwieldy.
I just got solar installed on my roof in Grass Valley, CA. 28 SunPower SPR-A410 Panels for a nominal maximum of 11.5kW. I’m not officially done yet but in testing it seems to be working and I’m enjoying the spectacle of my meter running backwards. Looking forward to getting access to SunPower’s monitoring software and hopefully lots of data.
In the meantime I was curious what to expect for power generation. NREL has an excellent calculator called PVWatts that takes precise details on the panels orientation, location, etc and estimates how much power you’ll generate. It takes into account local weather, various inefficiencies in the system (I’m calculating a total loss of 11.5%), etc. Anyway the final number they give me is just about 15,000 kWH in a year. The proposal estimated 10% more but that could easily just be different assumptions about efficiency. The system is sized to just about zero out my historical usage over the course of a year and take full advantage of PG&E net metering.
How about monthly variance? November works out to 22kWH per day in November or an average of about 900W. And what about variance over time of day? Here’s a curve of total insolation from this calculator; this doesn’t include factoring the orientation of the panels.
PVWatts doesn’t have a nice display for this, but they do let you download per-hour calculations for the entire year. Here’s an excerpt for today
Hour
Watts
07:00
195
08:00
456
09:00
775
10:00
1968
11:00
2579
12:00
3578
13:00
3619
14:00
5147
15:00
2705
16:00
1060
Interesting how skewed this is to the afternoon; I assume it’s because my panels are at an angle on a west-facing roof.
Anyway that’s all theoretical calculations. I’m excited to get actual measured outputs and compare. Soon!
I got a new phone, replacing my Pixel 3 (my first Android phone) with a Pixel 6 Pro. So far mostly so good; the new phone is nice. It’s too big IMHO but that’s the trend.
I am surprised at how bad the migration tool was moving data from my old phone to my new one. I think moving from my iPhone to the Pixel 3 worked better than this Pixel upgrade, although perhaps I had low expectations the first time.
The good
It’s simple enough to get the transfer going. Plug the two phones together (USB-C means no bizarro cables), press some buttons, and it’s off. It completed very quickly.
All the Google services moved seamlessly. Gmail, Android backups, Photos... no problems with any of that. Damn well better not be!
Getting Verizon to provision the new phone was also relatively easy. I finally can use an eSIM, so that’s nice, although I never could find IMEI2 in the software settings anywhere. (I had to read the tiny numbers off the box). Verizon basically just has you paste in the IMEI and do some auth stuff and they just transfer phone service over. Slick! (There was a caveat early in the Pixel 6 release you had to tell Verizon to set you up with a non-CDMA phone or else SMS didn’t work. I don’t seem to have needed to do that, and indeed that discussion says this was fixed.)
The bad
Google slammed me out of Firefox, switching my default browser back to Chrome. Funny how that happens. It’s an illegal monopolistic practice, btw, and one we used to complain about loudly at Google when Microsoft did it.
My Google Pay sort of carried over? My credit card is there but I had to reauthorize it. My California vaccination record which I’d laboriously gotten into Google Pay awhile back did not.
Almost no app state copied over. I mean some did; I have all my old text messages, for instance. Aegis also managed to bring all my (encrypted) 2FA tokens over (there’s an explicit preference to enable this). But lots of apps didn’t. For example both dict.cc and Kiwix download 100MB+ databases and cache them to let you read things offline. Those databases did not get transferred over. It seems pretty random what did and what didn’t. I can’t tell if this is just bugs / old design in some apps or if the migration tool is weirdly selective. Given all the changes to Android file semantics over the years I’m gonna guess old design.
No app logins carried over. Everything - Twitter, my bank, Lyft, etc - all require I log in again. No doubt this is “for security” but it’s a very bad user experience, there’s probably 50 logins I have to do. And really how much security is this providing? Many of these are for services where I don’t really use the app regularly but rely on notifications instead. I’m having to go through every single installed app and log them in one at a time.
Logging in the apps reminds me just what a shitty user experience usernames and passwords are. It’s 2021 and that’s still the best we can do? I’ve got 1Password set up, and in theory it’s integrated in to Android as a keyboard. Some apps prompt me to “fill with 1Password”, but I’d say only 25%. And some of those will only prompt with username or password but not both. Also inconsistently; second time I try the password field will prompt me to press a button for the 1Password fill. Mostly though I am just cut and pasting awkwardly between two Android apps. It’s terrible.
I’m sort of over the hump doing all this. I’m to the Ms in my apps making sure each one works on the new phone. No real surprises along the way, it’s just a terrible chore. Android really could make this better.
I’m grouching about Android but my memory of iOS was it was about the same migrating between iPhones.
I’m getting a new phone and decided to stop using Authy and use Aegis Authenticator instead. Authy’s been fairly good but I worry about it as a product. It’s not Twilio’s business. Also it’s closed source. Aegis Authenticator is a nice open source alternative with thoughtful features. Its main drawback is it’s Android-only; no iOS, no desktop apps. Works for me but may not for you.
Authy was an improvement because it offered a way to migrate data to a different Authy install. Unfortunately it does not support a proper open export option. For security, they say, which may be true but also means you’re locked in. So instead of having a managed export we’re reduced to using some scary third party Go program or Javascript pasted in from a Gist. As if that were more secure.
I went with the Javascript; the method that worked for me is documented here. (See the discussion below for updates.) This is an update on an older method that relied on hacking the Chrome extension to get the data out of it. That extension no longer exists but happily the desktop app is just a wrapper for a webapp, a wrapper that supports a debug console. The method boils down to “get to the console and then paste a script which will render a bunch of QR codes you can scan”. Scary and hacky, but it seems to work.
I was able to do all this with Authy Desktop for Windows using Google Chrome. Firefox might or might not work; I couldn’t figure out how to get to the console for the main.html there so using Chrome was easier. I then scanned the resulting QR codes into Aegis and it’s working.
Aegis is nice, btw. It supports various options to backup (encrypted) to JSON files that presumably anything could read.
Update: once you’ve migrated you probably want to delete your Authy account to remove the data they have in cloud storage. It’s pretty easy and they have a thoughtful tool, although note there’s a 30 day wait for it to actually be deleted. The one wrinkle is Authy also has a special unique 2FA protocol, you can recognize it from the 7 digit codes. my529 uses it. I was able to migrate this code to Aegis and log in with it. But Authy’s site and the existence of online authentication protocols makes me think deleting your Authy account may also disable this token behind the scenes. The Authy app recommends you disable it yourself; I changed my529 to use a standard HOTP style token.
It’s been six weeks since the Let’s Encrypt certificate expiration debacle and I’m still finding errors. This one today from running apt update
Err:3 https://apt.syncthing.net syncthing Release
Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate. Could not handshake: Error in the certificate verification. [IP: 82.196.13.137 443]
Reading package lists... Done
E: The repository 'https://apt.syncthing.net syncthing Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
The problem is syncthing is signing with a certificate in the expired chain. Or rather used to be. I tried various cargo cult solutions that did not work. The one that did was running apt install ca-certificates. That package was already installed but the command also forces an upgrade. Probably just running apt upgrade would have fixed it so the next apt update would have worked, too.
I’m fascinated by all the systemic failures from the certificate expiry. The Let’s Encrypt team thought carefully and tried really hard to head off problems. They failed. I found this one post-mortem but honestly there’s a masters thesis in systems complexity in analyzing all the global failures.
This came up on Twitter again today; do gas stoves produce soot? As measured typically in PM2.5, small carbon particles. The answer is no, at least not if your stove is working right.
The graph above is from my Kaiterra Laser Egg (with CO2 sensor) sitting about 10 inches from the burner on a Wolf CG365P/S/LP. I ran the hot burner - 18000 BTU - at full blast with no ventilation. It was turned on for 25 minutes at 10:07 am. As you can see in the graphs above there’s a noticeable increase in CO2 and temperature, but no PM2.5. None. (The CO2 rise is significant but on the order of what my body produces when I sit down near the sensor.)
I trust this sensor; here’s the PM2.5 levels from the same sensor (but 40 feet away) yesterday. We browned some meat about 7pm, which does create soot. I think that’s why people think their gas stoves create soot; they burn something and then blame the fuel, not the food.
Note this is a propane stove, not natural gas, and that may make a meaningful difference. Propane is pretty much pure C3H8 and as long as there’s enough oxygen it burns clean, producing CO2 and water. There is an incomplete combustion that produces carbon monoxide and soot; that shouldn’t happen in a house and in fact the CO could kill you if it’s bad enough. Natural gas is a more complex fuel with various hydrocarbons. I don’t have a natural gas stove handy to test with.
There are other reasons to be concerned about gas stoves. Primarily global warming; that CO2 it puts out is a problem. An electric stove powered by renewables is better for the climate. But in a typical gas powered American house the gas stove is a relatively small contributor to CO2; the gas heater and hot water heater are far bigger contributors. Heat pumps are a higher priority than induction cooktops IMHO.
The other problem with gas stoves is other pollutants, particularly NO2. I’m not quite sure where that comes from, the fuels themselves contain no nitrogen, but presumably there’s contaminants or maybe some side effect with atmospheric nitrogen. From what I’ve read this threat is mostly theoretical and can be managed just by venting your stove to the outside.
I’d be remiss to not point out this article which directly says gas stoves alone put out PM2.5. That contradicts what I’ve read and my own measurement. More complex is their link to this study which finds that homes that cook with gas tend to create more PM2.5 when cooking. But the study is mixing several factors together: energy source, cooking oil type, cooking methods. It’s not hard to imagine that a screaming hot wok on a gas jet would put out more soot than a pot of soup gently simmering on an induction burner. As with all things environmental, the details get complicated.
Anyway: it’s your scorched bacon that’s making soot in your home, not the gas burner.
My phone is a Pixel 3 running the latest Android. It mostly sits idle at home on wifi, I use it maybe 30 minutes to an hour a day at most. A couple of days ago I set it up on NextDNS, an ad blocking DNS provider. One nice thing about NextDNS is it gives you stats about the DNS queries. Here’s some data after about 45 hours.
It’s a lot of total queries! 6000, or about 130 an hour. It gets much quieter at night; the lull in the graph below is between 9pm and 7am. My phone has DND enabled from 10pm to 6am, I suspect that has more to do with the pattern than my actual usage.
31% of the queries were blocked as ads or trackers. Google is by far the biggest surveillance on my phone: Analytics, Ads, and Doubleclick. Urban Airship is second, then Crashlytics. I don’t know if that’s because I’m running Android, own a Google-built phone, or if I just mostly use Google services. Probably some of each, also Google’s monopoly power.
Outside ads the biggest source of DNS queries is still Google; Federated ML is top, Google Play (for the store?), and www itself. The other players are Yelp (geolocated to Japan), something called Rainbow API from the Washington Post (Germany), and Syncthing (India!). No idea why the geographic scattering. These are all services I use regularly, although it’d be nice if they weren’t quite so spammy with DNS. 5 queries an hour for something I don’t directly use seems strange. then again these DNS entries are all set up to expire in 1-5 minutes. And hey, DNS is cheap.
All in all not a lot of huge insights other than the magnitude of DNS traffic. But it’s an interesting view into something I’ve never looked at before.
BTW I like NextDNS. It’s more or less the same as AdGuard’s DNS. But it feels more like a real product. You can also customize exactly what’s blocked with some granularity, there’s a lot of OpenDNS-like features too for safe browsing, parental controls, etc. Blocking Parked Domains is a particularly provocative feature. The free tier gives you 300,000 queries / month which I think is enough for two phones at my current activity level. Unlimited usage for a personal account is only $20/year.
Now that I have a few months of data some of my Grafana graphs were getting slow. I realized I’d made no provision for data rollups. I’m recording data every few seconds. Great for a detailed graph of the last 24 hours, but far too fine grained for a report for a full year. Clearly I need some data aggregation / rollups, just like rrdtool did 22 years ago.
Joke’s on me: there’s no easy way to do aggregates or rollups in Grafana + InfluxDB. It’s a frequently requested feature, this discussion from 2016 is the most complete I’ve found. No clear answer but the fact it’s still not present (even in InfluxDB 2.0) speaks volumes. To be fair, doing a general purpose rollup is kind of hard, lots of weird corner cases.
InfluxDB does have reasonable support for creating a rollup table yhourself; see the Downsampling and data retention docs. You set up a continuous query to populate records and then a retention policy to delete old data. (Hysterically, the docs suggest you create the retention policy first; those only run every 30 minutes so you’ll probably get lucky!) But that amounts to creating a second table for the downsampled data. Whatever queries that data is then responsible for selecting the right table (or worse, merging data). There’s a variety of hacks for working with this in Grafana; the usual suggestion is to make the Grafana query select from the value of a variable rather than a static data source, then populate the variable appropriately. I imagine this can be made to work but what a PITA!
Looking at my own problem again I realized that I only had a million points at worst; that’s not awesome but why is the system choking on that? InfluxDB is super fast! Turns out my problem was the weird dashboard I’d imported didn’t have any sort of group_by clause defined. The ordinary Grafana boilerplate includes a group_by($_interval) as part of the query. InfluxDB is still having to read all the records but at least it’s only shipping a rolled up version to Grafana. Once I added that back my existing dashboards got speedy again. Problem avoided. That won’t work for a system with a lot of data, but for a small data system it’s fine.
I bought a new gas cooktop, a Wolf Professional Gas Cooktop (CG365P/S). It has “dual stack burners” for low temperature control: in addition to the main burner there’s a lower second burner with smaller holes just below the main burner. Having tested it I’m skeptical how useful this feature this is.
The dual stack presents a question when cooking: do I use the main range or the low range? Where do the temperatures intersect? I tested it by putting on a pot of water and waiting for it to come to equilibrium. This is for the small burner, of which there are three. There’s also a medium and large burner. I tested with the Liquid Propane version of the cooktop; it may be natural gas is different.
160F: Main burner, full low 167F: Low burner, full high 142F: Low burner, full low
So there you have it; the lowest high setting is about the same temperature as the highest low setting. It’s more or less a continuous dial. There’s not a lot of range of temperatures on the low burner.
I should note 160F is really low for cooking. Well below boiling water, of course. Well below a simmer too, that’s about 200F. Here’s some reference temperatures. These might not compare exactly to the temperature I measured in the pot of water. (The temperature on a dry or lightly oiled surface is going to be different than the temperature in water.)
You could sorta sous vide something with this burner! Or use it instead of a double boiler (as the marketing suggests). Honestly, it’s very rare I’d ever need to go below the 160F of the main burner. The only thing I cook this low regularly is French-style slow scrambled eggs (which are delicious but takes patience.)
What I really want is fine control over the temperature range. Gas cooktop manufacturers have started to understand this. While they still market themselves on max output (and hot can be good!) they often talk about low temperature performance, too.
That being said the knob on this cooktop is really not helpful for fine control. There’s a total of 60 degrees given to controlling high to low; on my last cooktop I had 270 degrees. There’s more like 90 degrees of control for the low range, but then there’s so little temperature variance there that’s unnecessary. It’s just a bad UI.
Knowing all this now I’m not sure I would have chosen the dual stack burners from Wolf. Maybe it’s more useful on the larger burners. They’re fine, but they aren’t as useful as I had hoped. Also no doubt they complicate the plumbing. The igniter mechanism is the weak system in these products but now there’s a complicated valve that could go wrong, too.
I should add the environmentally correct position these days is to not buy gas cooktops in the US. Burning gas puts out CO2 and contributes to global warming. It’s not the biggest source of CO2, at most 9% of a typical house, house and water heating are by far the bigger contributions. However gas stoves also put out a lot of NO2, a pollutant that’s not healthy to breathe. That’s a real problem although venting to the outside mostly takes care of it. (NO2 is not a greenhouse gas, although N2O is.) Induction is the new hotness and has excellent precise heat control.
I wrote my first systemd unit file today. It’s a thing that runs code to import stats from Starlink’s GRPC into InfluxDB using this Python code. Nothing remarkable about this but it’s the first time I’ve ever used systemd like this.
OK, the remarkable thing is Restart=always. I was having trouble with the script crashing after running a long time. OTOH it turns out it was crashing because Starlink’s protocol changed and the code had to be updated; no number of restarts would fix that. That’s what those StartLimits are for; if it fails to start 5 times in 5 seconds then systemd gives up trying.
Also I’m naughty and run this as myself, not some dedicated system user.
In this post I build up an absolutely minimum working Hugo theme for my blog based on the files generated by hugo new theme. The result isn’t a blog I’d publish, but it’s a useful start in understanding how Hugo works.
I’m still wrestling with learning Hugo. Clearly the simple thing is to use someone else’s theme. But I need something custom and specific and also I want to understand what Hugo is doing. So I’m making my own. It’s slow going. There’s no great examples to crib from (all the “minimal blog” themes I could find are elaborate things that include lots of styling and extra features.)
One useful resources is the lookup order page buried deep in the Hugo docs. It explains the basics of how theme template files are used. The best part is where it says “The examples below look long and complex.” Yes, yes they do. But then it also then tells you that in fact there’s 4 templates that are most important:baseof.html,. list.html, single.html, and index.html. Most of my notes here are going to focus on those files.
One useful thing to know about is partial templates. These are HTML snippets intended to be included in other HTML templates. They’re kind of like subroutines, but for templates.
I’m going to follow this tutorial on creating a Hugo theme. It adds some extra stuff (some partial templates for inclusion, CSS, Javascript, a menu) but at its core are those 4 files listed above. I’m going to skip the parts I don’t want and document what happens along the way.
This whole process started with Hugo’s quickstart. I did that first and got my blog working with someone else’s theme. Then I removed the other themes I was using and created my own.
Content
I’ve seeded my blog with a bunch of content (1771 posts) in directories like content/weblog/tech/good/ and content/weblog/politics/. I’ve tested this content works OK with other people’s themes. My blog has several top level directories: politics, tech, culture, etc. For simplicity I put all these directories not directly under content/ but in a single subdirectory (weblog/). This results in a /weblog/ in the URL I’d rather not have but it renders the whole blog in one giant list. With subdirs I was getting one list per top level category. I think this has to do with Hugo Sections, something I don’t understand yet.
config.toml
Before you create a theme you need to configure a blog. I did this in the quickstart.
“theme” is the name of a directory under themes/ we’ll create in a minute. Note the baseURL matters: it’s going to be hardcoded in a lot of output files. (Although Hugo seems pretty good about supporting relative URLs where possible.) I made a mistake at first and had it set to https://www.somebits.com/weblog/; but that causes duplication of /weblog/weblog/in the URLs given the section setup I did.
An empty skeleton theme
Step 1 is running hugo new theme nelson. This creates a skeleton theme. There’s 11 files that creates but they have very little in them. In particular index.html, list.html, and single.html are all empty. baseof.html does have some HTML boilerplate with a <html> tag and inclusion of some partials for page headers and footers; those partials are also generated as empty files. There are no template files for XML or RSS.
You can go ahead and build a Hugo blog with just this skeleton theme but not much happens. In particular no HTML is generated, despite Hugo saying 4 pages were created. But Hugo will create some XML. Two identical RSS 2.0 files under index.html and public/index.xml, both containing all 1771 blog posts entirely. My whole blog in one XML file! Also two empty RSS 2.0 files for “recent content in tags” and “recent content in categories”. Finally a sitemap.xml with 1775 URLs in it, presumably my individual posts and a few index pages. All in all it looks like Hugo has some default blog XML generation. That’s handy but I’m surprised those aren’t implemented with a generated template file. They can be overridden though.
You can also try to load URLs by running “hugo serve”. The suggested URL http://localhost:1313/ contains an empty <pre> block and nothing else. There is no .html file for this in the static blog, nor anything in the templates, so I guess this is something the Hugo server does. http://localhost:1313/index.xml does load and gives back the RSS contents that were generated. Useful URLs for individual posts like http://localhost:1313/weblog/tech/electrify/ from the sitemap give 404s; they weren’t generated, afterall.
Formatting single blog posts
So how to get posts rendering? The absolute simplest thing is to put any content at all in single.html. I put 3 bytes in that file; “Yo\n”. Rerunning hugo results in 1775 pages being created, 1776 files. The 4 XML files from before, the sitemap, and all 1771 blog posts. Nice! Every blog post is at the expected URL and all have the content “Yo”. Note that the HTML in baseof.html did not appear, that’s a little strange.
The next step is to make single.html a little more complex. {{ define "main" }} Yo {{ end }} Regenerating with this also creates 1776 files that all say “Yo”. But now the “Yo” is sandwiched inside the HTML template matter in baseof.html. So that’s a bit magic; apparently Hugo does something different depending on whether that “main” block is defined in the page template or not. (Note that the “main” section is used by baseof.html). Almost all the docs for templates always suggest defining a “main”, so that’s the ordinary thing, and it is shorthand for “slot this into baseof.html”. I wonder if this is explicitly coded behavior or if rendering baseof.html fails with no “main” defined.
Finally I replaced my single.html with a useful template that shows post content:
Regenerating with that and I get something that’s starting to look like a real blog. Each post gets a title and the post content. Nice!
It’s worth noting at this point that Hugo’s preference for “pretty” URLs means that all your blog posts are in files named “index.html” in subdirectories named after the post filename. Ie, you get a tech/electrify/index.html, not tech/electrify.html. This behavior is configurable.
This was all more confusing than necessary; when I first generated my new theme I could not understand where my posts had gone. If it were me I’d make the new theme command generate something like my last single.html, not an empty file which then means don’t generate pages at all. But then maybe that would confuse people trying to use Hugo for something other than a blog.
Lists of blog posts
Having gotten single posts working it’s time to visit lists. Starting as before, I put just “Hi\n” in list.html and regenerate. Unsurprisingly, this creates a file with just “Hi\n” in three places: weblog/index.html, tags/index.html, and categories/index.html. Putting the “Hi” inside a {{ define "main" }} gets it to use the baseof.html template, just like single posts did.
Moving on to an actual useful list, I took a page out of the tutorial I’m following and put this in list.html
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ range .Pages.ByPublishDate.Reverse }}
<p> <a href="{{ .RelPermalink }}">{{ .Title }}</a> </p>
{{ end }}
{{ end }}
And voila! Now http://localhost:1313/weblog/ loads with a list of all 1771 posts. As the template suggests, each post is rendered inside its own <p> tag with a Title and a relative link (no hostname) to the Post. It’s like I have a real blog now! Well, the basics.
The magic is thanks to that {{ range }} in the template. The range Hugo function is incredibly important, it’s the hidden loop in templates. It stands for “iterate over this whole collection of things and insert stuff one by one”. Range. I read Hugo docs for hours before I found this key concept.
Gestalt
We’re not done yet but I’m going to declare victory with this ultra minimal blog. In summary, all that was necessary was the create a new theme template, then put some very basic stuff in single.html and list.html. There’s plenty more to do. The tags/index.html and categories/index.html files are still empty; I’d like categories to be populated by directory name. I’d also like to generate monthly archive pages. Could do with some pagination too, not to mention more formatting and breadcrumb navigation. But now at least I understand how to render a list of blog posts in Hugo. And I’ve got it rendering a useful top level list.
The main thing I learned in this exercise is what Hugo does by default with very little templating. It renders every content item through the single.html template (and usually, baseof.html). It also renders list.html for the basic list of all blog posts; it’s up to you to use the range function to build and render that list. As an aside Hugo is also doing some basic RSS and Sitemap creation for you. And that’s it!
I’m trying to port my blog to Hugo. It’s not going well. The problem is Hugo is complicated. And nothing out of the box does quite what I want (admittedly, my blog is pretty special snowflake stuff). So now I’m diving in trying to learn how to create my own custom theme, control pages generated for indices, etc. It’s a mess.
What doesn’t help is Hugo is incredibly complicated. Right now I’m struggling to learn Go’s template language, which is the basis of Hugo templates. It’s confusing and gross and I don’t want to learn yet another ad hoc programming language. It’s really confusing because I still don’t have the gestalt of how all Hugo fits together. Like at its core there’s some thing that reads a bunch of content blobs and renders those to HTML along with some list pages of things. Where is that simple structure expressed? Somewhere, but I still don’t quite get it.
Not helping things at all is weird magic. I kept trying things in a simple shortcode and getting the result ZgotmplZ inserted. WTF is that? It looks like a mangled C++ class name or something. No, turns out that’s Go Templates saying “you have used a thing in an unsafe context”. So that’s super confusing. Now I have to learn what contexts are, what safe means in this context, and how to make unsafe things safe. If it’s even possible.
Maybe I should give Jekyll a shot. I already tried Pelican and didn’t love it.
I’m working on (finally) converting my Blosxom blog to something modern, probably Hugo. One problem I have is that I was bad and wrote blog posts in different encodings. (These probably render wrong on my blog nowadays). Here’s a Linux command line to find all files that are not ASCII or UTF-8:
The heavy lifting is done by file -i which prints out MIME types, including a guessed encoding.
I thought all my files were ASCII, UTF-8, or ISO-Latin-1. But in fact a few are CP1252 thanks to Windows “smart quotes”. CP1252 doesn’t seem to be identified by file; it shows up as charset=iso-8859-1. It is a strict superset of ISO-Latin-1 so in my Python code I’m just going to pretend all the files that aren’t ASCII or UTF-8 are in CP1252.
One of the dramatic effects you can do with a plotter is printing in bright inks on black paper. The ink has to be opaque for this to work well; you want to completely hide the black paper below it. Here’s some experiments with some new pens.
Three kinds of ink in the top sample: Uniball Signo 1mm, a Pentel brush in the middle that totally didn’t work, and Kuretake ZIG Metallic Calligraphy pens. Most all of these look good on black paper. The Uniball Signo is a pretty solid low cost choice, a rollerball. The white ink is clumpy though, you can sort of see it in the top left sample. Uniball Signo Silver works better; that’s what I used for the plot at bottom.
Photographing black paper is tricky. The above image is straight from my Pixel 3. Shooting in full sun was clearly a mistake. Needless to say it looks more like black in real life, and the lines pop pretty nicely.
White ink is particularly problematic: see here or here for example. That second post is from someone using Rotring Isograph Pens, fancy technical pens you fill yourself with drawing ink. That lets you choose from a wide variety of ink colors; Rotring sells 5 including (unusually) a white. Some folks use fountain pens for fancy white ink, too (including I think the first post.) There’s even a White Ink product experiment going on right now: Wink.
But I’m not messing with liquid ink yet. For cartridges see this plot featuring a Pentel hybrid gel pen. Or this one with a Sakura Gelly Roll. The silver Uniball Signo I used here works pretty well but the white is not reliable.
More adventures in irrigation systems. We wired up a new controller (our third) for a few valves, programmed the system, and let it run. The next morning every irrigation valve was open, water running everywhere. We don’t have enough water pressure / well capacity to actually run that so more like things were trickling.
I think I found my answer on this web page. These valves are designed to close automatically if there’s no power. But if an air bubble gets trapped in the valve diaphragm it can get stuck open. I think many of my valves were in this state. The solution for that the pagesuggests is to manually open the valves (with the bleeder valve or by unscrewing the solenoid). I did that and I think managed to get all 23 valves to close.
How do air bubbles get in? The article talks about this happening after you’ve drained the system for winter and restarted it. In my case I think what might have happened is the new controller was programmed wrong (or clocks out of sync) so that two different high flow sprinklers were running at the same time. And that overwhelmed the water pressure and let some air in, but maybe only a little. The worst thing is this is a cascading failure; with valves stuck open there’s only going to keep being intermittent water pressure.
I asked two different irrigation experts if they could understand this, they were mystified. Both kept wanting to blame something electrical. Sort of makes sense; if your expertise is water and plants and dirt then the computers probably seem a little unpredictable. But all the controllers were literally off. Also 3 disconnected control systems, no way they would have all failed the same way at the same time. The only common connection was the water. Systems thinking helps here.
Now I have to carefully test all this before I trust it again; it’s not OK to leave town with an irrigation system that may fully fail open. I have the water supply turned on but all valves shut off and all controllers unplugged. Going to let that sit for 24 hours and verify it’s dry. Then watchfully turn controllers on again and run the valves manually and verify they turn off and on. Then turn on the programs again. Probably just the two old controllers first, verify that doesn’t break anything, then if that’s working re-enable the new controller last.
So I’ve been using noise functions in my plotter art. One thing to be aware of with noise functions is the output distributions aren’t uniform. I don’t just mean the smooth variation of nearby points that you’re using a fancy noise function for, but even if you sample uniformly from a large space the values are still closer to a normal distribution than a uniform distribution. To put it more concretely; these noise functions all return values in the range [-1, 1]. (2d Perlin noise is [-0.7, 0.7] ish.) But results near 0 are more common than results near 1 and -1. See below for some histograms.
This isn’t necessarily bad. You can always scale the output up to a uniform distribution or whatever you want. Although that requires knowing what the original distribution actually is. Perlin noise looks like a real normal distribution but both Simplex and OpenSimplex noise have a weird boxy distribution where results are uniformish in the range of -0.5 to 0.5.
More than the usual caveats apply; this is sloppy code and I might have gotten it wrong. Histograms are for 1 million samples drawn from OpenSimplex and caseman’s Perlin and Simplex noise. 2d noise in each case; the coordinates were uniformly sampled in the range of [-100_000, 100_000]. (A small range because caseman’s code seems to be using 32 bit floats). I did not alter the scaling or octave parameters at all, library defaults. My code is in this gist.
Update: I asked about this on the Plotter Art Discord and someone suggested empirically measuring the distribution then doing a correction. They offered this matlab snippet:
p = randn(1000,1);
p2 = (p-min(p))/(max(p)-min(p));
x = sort(p2);
CDFp = linspace(0,1,numel(p2));
pUnif = interp1(x,CDFp,p2);
Ever since I got a CO2 sensor I’ve been low-key interested in my CO2 level. Partly just because it’s interesting, partly because CO2 is related to cognitive ability (here and here), and partly theoretically because CO2 is a proxy for air circulation in general and thus, potentially, Covid prevention. That latter point is apparently making waves in schools.
Here’s some benchmark numbers for CO2 levels. These numbers are all ppm, parts per million. The important number is 420ppm, which is what you get outside right now.
CO2 as a proxy to air circulation for disease prevention is a newer idea. Honestly it used to be too hard, but now that you can carry a $100 CO2 sensor with you (or in your kid’s backpack) it is much easier. It’s really not clear what the “right” level is. CDC’s 800ppm recommendation seems reasonable but also possibly challenging.
CO2 in my house in Grass Valley
My house is well sealed and insulated. I’ve learned that during the day CO2 at my desk gets to about 800ppm. The wacky thing is it doesn’t drop to 420 overnight, even if I’m in another part of the house sleeping peacefully.
24 hours of CO2 with no one home.
I left the house at 11:30am, came back the next day. CO2 had just about returned to 420.
Anyways, now I open a window when I can. It doesn’t keep the CO2 down much at my desk while I’m in my office, but the air clears out pretty quickly when I’m away for a bit.
This is all for summer / fall. The air conditioner may be running and doesn’t seem to affect things. But the heater isn’t. I believe last winter I noticed the CO2 fell every night even with all the windows closed and I suspect that might have something to do with the heater or outside temperature, but I don’t have the data to back that up. I’ll know in a few months.
Home HVAC systems typically don’t have anything designed to supply fresh air. The air systems are closed to prevent having to condition outside air. Older houses are so drafty it’s not a big problem. But it is possibly a small problem for a new, well insulated house. I asked my HVAC guy and he said an outside air intake vent could be added for $2500 or so. Presumably it’s not open all the time (like a window), that has a significant cost in temperature and humidity.
Commercial buildings are designed to standards including air changes per hour. Nominally, an ACH of 1 means that all the air is replaced once an hour. ACH standards are 4 ACH at the low end to 20 or more for places that generate lots of pollution, like kitchens and paint shops. I’m not quite sure how to convert my CO2 information into ACH; this presentation suggests it’s possible but maybe a novel idea. Presumably there’s some sort of half-life calculation involved.
The main conclusion I draw from all this is it’s good to open a window now and again.
Once again contemplating moving my blog away from the ancient Blosxom setup I have. Static generators are clearly the way to go. Here’s what I found among Python options.
Pelican looks to be the most popular. Nikola is also compelling. Lektor may also be an option. Cactus and Hyde are abandonware.
USB charging is even more of a mess than ever before. I thought USB-C and USB Power Delivery was the be-all and end-all of charging. One common protocol, buy a charger that claims 45W and a USB-PD device would charge at 45W. Ha!
I bought a nifty little USB charging tester. It shows you in real time what the current voltage, amperage, and thus wattage of the charging current is. Finally a reliable way to tell what’s going on! Assuming the presence of the tester doesn’t disrupt the USB charging, that is.
The charger Amazon sent me is called a KWS-1902C, there’s a nice review here. It claims to support up to 150W, 4-30V, and 0-5A. The first look on the blog is from October 2018, for a sense of product age. I’m assuming it does not support USB 3.1 gen 2. But it may not need to, maybe it will do that with the right cable actually providing the E-marker chip. It apparently has a display bug if you go over 65.536W.
My Samsung Galaxy Tab S7+ (aka SM-T970) claims to support up to 45W of charging. But when I plug it in via USB-C to an Anker Power Port Atom III, advertised as a 60W charger, I only get 15W. 9V at 1.67A. Actually a little less than that, like 14.3W. I’ve tried two USB-C cables, also an A-to-C cable using the A port on the charger. Always 15W. So what’s going on?
First off, the Anker charging port is not actually 60W. It’s 45W. And that only at 20V. At 9V the max is 3A, or 27W. But still I’m only getting 15W.
Second, Samsung’s support for “fast charging” relies on a USB spec called “Programmable Power Supply” or PPS. That’s a newer thing where the device just requests an arbitrary voltage and amperage and the charger provides it. At least one other Samsung device wants to be charged at 10V and 4.5A. Samsung’s own 45W charger will do PPS up to 11V at 5A. But if it falls back to ordinary USB-PD 3.0 then it maxes out at 9V at 3A.
But that’s still 27W. I don’t know why the Anker charger is only putting out 15W. A failure to negotiate a higher amperage? Even basic USB PD 3.0 supports 9V/3A but I’m not getting it. Maybe the device deliberately charges itself slowly to preserve battery life? I haven’t tried charging from a dead battery.
My motherboard’s USB ports charge the tablet at 5V/1.5A. I believe that’s the minimum to be a USB-C port.
Back to PPS, Anker does make a couple of 65W PPS chargers but they seem to be newer and/or more expensive. This review suggests it’s capped at 3.25A so at 9V you’re limited to 29W. Every charger brand seems to have one or two PPS chargers but most chargers don’t support it.
How about charging other devices?
My Google Pixel 3 phone should support 5V/3A or 9V/2A. I get 9V at 1.2A. So that’s confusing. It’s variable too; 1.1-1.3A. I’m beginning to doubt the accuracy of my tester. Although again, maybe this is a battery preservation strategy? (Not USB, but wireless charging tops out at 10W.)
My PS5 controller can’t be charged by the Anker charger, there’s no orange light. The official specs say it can do 5.1V at 2.8A. When plugged in to the Anker charger I see it’s getting 5V and 0.1A, which is the basic USB 2.0 draw for a low power operating device. Plugged in to the PS5 in rest mode (with the meter) it does charge, at least the orange light is throbbing. But it’s still only 5V and 0.125A, very low power. So it may not be charging well. (Update: after six hours it was still looking like it was charging. Maybe the tester screwed it up?) Also I note the D- data line is at 2.76V; for most devices both D+ and D- have been at 0V when charging. Presumably that’s related to why the controller can’t be charged by the Anker charger, must be some odd protocol.
Bottom line: absolutely none of my devices are charging at the rated spec. Anker in general makes good products, so I’m not inclined to blame the charger. Although at least for the tablet it’s clear I need a PPS charger to get maximum charging.
I wonder if it’s my cable to blame. I’ve tried several decent cables, including an Amazon Basics cable. But they’re a couple of years old. Apparently the new hotness is USB-3.1 Gen 2, which has an active chip in the cable itself for negotiating USB-PD and supports 10Gbps data, 20V/5A charging. (Keyword: E-marker chip.) I am going to buy this one and see if it makes a difference. Amazon Basics makes one too. Not clear it will make a difference, from what I’ve read it only becomes important when you want to go over 5A.
Update: the new cable makes no difference.
Update 2: there’s been some controversy over Google Pixel Pro 6 charging, see Google’s explanation. I just measured charging my phone at 30% battery and got 8.7V/2.14A, or 18.6W. Google says their max is 23W. I tend to leave the phone on my original Google wireless charging stand so don’t much care.
I’ve written a little tool to show me the status of Syncthing on the command line. I now rely on it to get my files off of computers that will then be turned off and inaccessible. I didn’t have any way to know if it was really working. I don’t have a reliable outage monitoring system for all my personal tech crap. (I mean, who does? Hmm..)
Anyway this turned into a bit of a yak-shaving exercise. Syncthing does not really have a command line tool. There is a syncthing cli command (and formerly the syncthing-cli third party tool) but they don’t report the status I need. What syncthing does have is a very nice REST API for querying status, so I wrote a tool to check that.
The other tricky thing is defining what it means for syncthing to be synced. I’m not sure I got this right. The algorithm I’m using is it enumerates all folders and all remote devices and checks completion on each one. In practice folders seems to catch outgoing changes, remote devices catches incoming changes. It ends up being O(n) HTTP calls, not ideal, but here we are. It might be possible to get it down to 3; I didn’t quite understand how the bundling in rest/db/completion worked.
Anyway, the Python script below mostly works. I wonder if someone else has already done this and I reinvented the wheel? One last wrinkle; when to run this. I was originally thinking in MOTD (hence my earlier post) but for now I’m running it in .bash_login.
#!/usr/bin/env python3
"""
Status report for syncthing, suitable for including in /etc/motd.d. By Nelson Minar <nelson@monkey.org>
Note that this will show "completely synchronized" if a file was very recently created or altered and
syncthing is not yet aware the change has been made. See the scanning and fsnotify docs in Syncthing for details.
"""
import json, urllib.request, platform, itertools, sys
from pprint import pprint
"Configure the URL endpoint and API key based on hostname. API key is in Settings."
HOST = None
API_KEY = None
config_table = {
'ub': ('http://127.0.0.1:8384', 'XXXXX'),
'Nelson-Win10': ('http://127.0.0.1:2103', 'XXXXX')
}
def st_api(command):
"Call the SyncThing REST API and return as JSON"
req = urllib.request.Request(f'{HOST}/{command}')
req.add_header('X-API-Key', API_KEY)
resp = urllib.request.urlopen(req, timeout=2).read()
return json.loads(resp)
def main():
global HOST, API_KEY
try:
HOST, API_KEY = config_table[platform.node()]
except:
# Exit silently if we're not configured
sys.exit(0)
folder_report = []
device_report = []
try:
# Explicit error handling for first REST connection. Others are YOLO.
devices = st_api('rest/config/devices')
except Exception as e:
print(f'Syncthing: Error connecting to {HOST}.')
sys.exit(0)
# Check completion for all remote devices
for device in devices:
completion = st_api(f'rest/db/completion?device={device["deviceID"]}')
device_report.append((device["name"], completion["completion"]))
# Check completion for all folders
for folder in st_api('rest/config/folders'):
completion = st_api(f'rest/db/completion?folder={folder["id"]}')
folder_report.append((folder["label"], completion["completion"]))
# Show a short status message
if all([c == 100 for n, c in itertools.chain(folder_report, device_report)]):
print('Syncthing:', f'Completely synchronized.')
else:
incompletes = ((n, c) for n, c in itertools.chain(folder_report, device_report) if c != 100)
print('Syncthing:', 'Incomplete.\n ', '\n '.join(f'{n}: {c:.2f}%' for n, c in incompletes))
print(f'Details at {HOST}')
if __name__ == '__main__':
main()
sys.exit(0)
I was trying to figure out how Ubuntu systems print the Message of the Day at login. In ye olden days this was a static file, /etc/motd. But it’s dynamic now.
The online references I found talk about the update-motd package. That was indeed how it worked in 2008 or so but is no longer the case in 2021. I don’t even have it installed on my Ubuntu 20.04 system.
The newer Debian docs seem to be correct. The motd is being created and shown by pam-motd. PAM is the code that defines what all happens when a user logs into a Linux system. It has this configuration:
# Print the message of the day upon successful login.
# This includes a dynamically generated part from /run/motd.dynamic
# and a static (admin-editable) part from /etc/motd.
session optional pam_motd.so motd=/run/motd.dynamic
session optional pam_motd.so noupdate
That first line means “run the scripts in /etc/update-motd.d and write their output to the file /run/motd.dynamic. Then display the output.” The second line means “don’t run anything, just display the contents of the default file /etc/motd.”
The actual messages come from scripts in /etc/update-motd.d. You can use run-parts to run them all dynamically. This most fork like 100 processes every login shell, what a waste! But it’s sure flexible. 10-help-text is the one that prints the URLs advertising Ubuntu stuff. I removed mine.
There are some other motd things too.
sshd has an option for PRINTMOTD. The docs say it only prints /etc/motd.
systemd does not have any MOTD code, surprisingly. Ubuntu does have a systemd timer configured to run 50-motd-news a couple of times a day.
login has a couple of options for .hushlogin files to suppress the MOTD.
The ubuntu package show-motd drops a script in /etc/profile.d which will display the MOTD once a day. It does this using update-motd, not PAM, but it seems to work the same way with the /etc/update-motd.d scripts. It has various triggers to stop it from printing the MOTD:
.hushlogin
a MOTD_SHOWN environment variable (PAM sets this.)
Timestamp on $HOME/.motd_shown: only show if it’s the first shell after 00:00
If the shell is not interactive. (It does not check if it’s a login shell.)
WSL doesn’t run login or PAM for shells so some of this stuff doesn’t happen in the WSL context. But WSL seems to install show-motd by default and so you get a MOTD once a day.
I’ve got a bunch of automatic irrigation in my lawn, all Irritrol equipment. (What a brand name!) Some notes on how it works. This little video is very good.
The valve is a diaphragm ordinarily held in place by finely balanced water pressure. There’s a solenoid as part of the system that ordinarily is in a closed position so water can’t flow out a dump port. When the solenoid gets electricity it raises that stopper so a small amount of water is released. That lowers the pressure on the diaphragm, allowing the main water flow to go down the pipe. I think a spring is involved somewhere to hold the solenoid valve closed.
The key thing here is that the solenoid isn’t doing a lot of work. It’s moving a small part that controls a small water flow; it’s not turning a big valve or somehow manipulating full water pressure.
The solenoids are controlled via a 24V AC wired signal coming from an irrigation computer. When the computer turns the water on it supplies continuous power at about 0.5 amps. That’s a lot of power! But I’m not sure how many watts it really ends up being; I’m finding things that suggest it’s about 2W, not the 12W I’d naively assumed.
The nice thing is if the power is cut the valve automatically closes, there’s no need to energize it to get it to close. Also the 24VAC solenoids are standard; any ordinary irrigation controller can control any brand’s solenoids and valves.
The wires are usually direct buried in your lawn. You know, right under all the shovels and other tools. Hopefully they’re buried deep enough that they aren’t broken but in practice they get broken frequently. Guess why I’m reading about this? (Although in my case I think it’s a gopher, not a shovel.) PVC conduit is about $50-$100 for 100 feet, so next time I run a wire I might splurge for some protection. Irrigation wire tends to be fairly hardy plastic but not metal armored. Mine has 5 strands; 4 wires for signal, one common neutral. I believe these systems are grounded through literal ground.
Irrigation wiring is often a mess. I paid someone to trace a lot of wires. We found one run goes maybe 800 feet through four splices. That we found, those four were in boxes.
Unfortunately irrigation valves require power, which in practice means a wire. There are very few consumer solar controller options and what I could find is expensive; $100 or more for a single valve. There are multivalve solar controllers but they seem hard to find and priced for commercial use.
Battery powered irrigation controllers are more readily available. But two experts I talked to don’t like them. Partly because just being outdoors means they aren’t going to last forever. Also the realities of batteries. One guy suggested you need to change the batteries at least twice a year. And if you forget and don’t notice, your plants die. Also the battery powered controllers require special 9V solenoids.
TIL about OpenSprinkler, a modern open source sprinkler controller with a web interface. It looks to be a serious supported product, too.
Sometimes it’s useful to set a clock to UTC. Say, your camera when you’re travelling; better to label all the photos with one consistent time IMHO. Some consumer UIs don’t let you choose UTC or GMT since they aren’t attached directly to a geolocation. In that case I always set the clock to Atlantic/Reykjavik time; they haven’t done daylight savings since 1967.
The full list of UTC-like timezones are Africa/Abidjan, Africa/Bissau, Africa/Monrovia, Africa/Sao_Tome, Atlantic/Reykjavik, and America/Danmarkshavn. (Not clear many places would recognize that last one, it’s pretty obscure.) I found these by searching the database for ^\s+0:00\s+-
The timezone database is a thing of beauty as Jon Udell so nicely articulated. Sadly the text contents of all the fascinating comments aren’t easily available as a web page; I should do a project to make a static site of them.
I have a CO2 sensor, a Kaiterra Laser Egg. Home Assistant has support for getting data from it but I don’t much like HASS UI. Or data retention; I was hoping it had stored a year of data but I learned the little sqlite database has a 10 day expiration. Oops. Anyway I decided to roll my own collector using Telegraf, for InfluxDB and Grafana.
The Kaiterra doesn’t have any LAN API I could find. Instead the devices upload to the cloud and they have a decent API service. It’s mostly pretty straightforward REST. One trick is you have to find your device ID. I can’t find that in any UI anywhere, I finally got it by having Kaiterra mail me my data, the data dump included the device ID.
There’s an official Kaiterra Python client but it’s 2 years old and pretty wonky. It also uses an old API endpoint which among other janky things has invalid JSON (single quotes, ugh). So I just wrote my own code using urllib and json in Python. One goal here was to make this not depend on any virtual environment, so stock libraries only.
It’s 2021 and Python still has no built-in way to import the common ISO-8601 timestamps included in every JSON file, like 2012-04-23T18:25:43.511Z. Plenty of third party libraries to do it. There’s a datetime.datetime.fromisoformat but the joke is on us, it doesn’t support the trailing Z. There’s a years-long argument about why that’s OK, basically the Python authors don’t actually want to support all of ISO 8601 in the method named “from ISO format” nor do they recognize the value of parsing the most common text format in the world. Fortunately you can just chop the Z off and it’ll probably work.
I’m running this as a Telegraf exec agent, outputting data in Influx format. That’s mostly pretty easy with the wrinkle that they want unix-epoch-like timestamps only expressed in nanoseconds. So I’m appending 000000000 to my time outputs, lol.
I think it’d be possible to not write any Python code at all and use a cleverly configured Telegraf http agent with a JSON parser, but I didn’t want to try to debug that so I wrote Python code instead.
Anyway, here’s the telegraf config snippet and the python code. I’m still tweaking the Grafana layout and don’t feel like pasting a giant ugly wodge of Grafana config anyway.
#!/usr/bin/python3.8
"""Telegraf / InfluxDB client to import data from a Kaiterra LaserEgg
Does not require any venv or external libraries. Does require Python 3.7 features.
"""
import urllib
api_key = YOUR API KEY HERE
device_id = YOUR UUID HERE
endpoint = 'https://api.kaiterra.com'
def urllib_client():
"Simple HTTP request for Kaiterra Laser Egg data"
import urllib.request, json, datetime
url = f'{endpoint}/v1/devices/{device_id}/top?key={api_key}'
expected_types = {'rco2': 'ppm', 'rhumid': '%', 'rpm10c': 'µg/m³', 'rpm25c': 'µg/m³', 'rtemp': 'C'}
# Make the request
req = urllib.request.urlopen(url)
json_text = req.read()
json_data = json.loads(json_text)
# Parse the data into a simple Python struct
record = {}
record['ts'] = json_data['data'][0]['points'][0]['ts']
for d in json_data['data']:
assert d['units'] == expected_types[d['param']]
point = d['points'][0]
assert point['ts'] == record['ts']
record[d['param']] = point['value']
# Convert ISO time with appended Z to Unix timestamp
record['unix_ts'] = datetime.datetime.timestamp(datetime.datetime.fromisoformat(record['ts'][:-1]))
return record
r = urllib_client()
values = ((f'{k}={r[k]}') for k in ('rco2', 'rhumid', 'rpm10c', 'rpm25c', 'rtemp'))
field_set = ','.join(values)
ts = int(r["unix_ts"])
print(f'laseregg {field_set} {ts}000000000')
I switched note-taking apps to Joplin. It’s total overkill for what I do, all I really want is a markdown editor that doesn’t require me to remember to press “save”. Joplin has a zillion more features than that. Also it’s a 200MB Electron download, so that’s a bit much. But it seems to work well and simply.
Originally I was using SimpleNote. It’s really nice! The only reason I switched away is because it doesn’t support encrypting notes on their cloud storage and I was doing things like pasting passwords into my notebook.
Then I used Standard Notes for a few years. And paid for it. But they hiked the price to $50/year and that seems like a lot of money for something so simple that I use occasionally. It also reminded me just how bad and klunky so much of Standard Notes is. Its reliable on Markdown plugins for the editor, none of which quite work right. Mediocre cross-note search and no in-note search at all (except with one plugin). It often feels slow. Just overall not excited to be paying so much for it. (Base Standard Notes is free but you need to pay to use even the most simple advanced features like a decent Markdown plugin.)
Joplin is free software and free to use, including a variety of self-hosted syncing options. (Which are encrypted). They do offer a cloud sync service at 24€/year but they also have a robust set of free sync options you can set up yourself. You’re mostly paying for convenience. And they don’t lock other basic features behind the price.
I’m using SyncThing for sync. Joplin will sync via files in a directory; it is then the user’s problem how to sync those files. SyncThings works great for that. The sync is a little delayed (5 minutes?) and getting it set up on Android was awkward because of the opaqueness of the file system. But it all worked.
There’s a zillion note-taking apps out there. Unfortunately most of them seem to be too complex and offering too many features, just like Joplin does. Everyone’s like “Evernote is bad and too complex” and then is going down the road to becoming Evernote. To Standard Notes credit they are not doing that; neither is SimpleNote. Anyway some of the other options I didn’t try are QOwnNotes, Cryptee, and SilentNotes. Joplin seems to be the nerdy consensus for the best so I didn’t even try the rest.
Migration wasn’t too bad btw, thanks to Standard Notes for having an export feature. (Which reminds me; data portability matters, don’t ever use an app that traps your data.) There’s a way to convert Standard Notes exports into Evernote format, which Joplin can then ingest. Lost a bunch of metadata, most importantly which notes had been archived. So I had to go in and re-sort my notes. It was time well spent actually, but if I had thousands of notes that would have been a problem.
I’ve been using syncthing a couple of years now and finally trust it to manage all of my source code. Part of that is getting it to sync files on my WSL Ubuntu images. They’re more or less like standalone Linux VMs and need their own syncthing, it won’t work to just sync files on the Windows host system.
Syncthing mostly just works in WSL, no drama. The challenge is that WSL doesn’t have a systemd or cron so there’s no easy way to start syncthing at system boot. Also syncthing itself is not really written as a daemon; if you just run “syncthing” it writes to stdout and listens to signals and stuff. Awkward.
There’s lots of advice on how to deal with this problem and most of it doesn’t work. The real problem I ran into is something weird about WSL, at least the WSL 2 I’m using. This GitHub issue discusses it: even with nohup and other efforts, background tasks launched by wsl.exe will sometimes disappear. You can write a script that looks like it runs a background process fine and test it in Linux and it works. But if you invoke the script via wsl.exe whatever processes it spawned disappear. No, nohup doesn’t help. This is all very mysterious and it’s worth remembering that WSL only started supporting background tasks a couple of year ago.
The solution that worked for me is to use the daemonize program. There’s an Ubuntu package for it. It’s pretty straightforward, it does all the Unix stuff you’re supposed to do for a daemon but don’t bother with (like cd / so that filesystems can be unmounted.)
Here’s the Linux shell script I use to run syncthing. The weird GUI port is because I also have Syncthing running on my Windows host.
It’s not ideal. If I’m logged in and just launch the shortcut it works pretty nicely. A command shell window briefly pops up and disappears; if that annoys me enough there’s kludges to workaround that.
There’s a bigger problem on system startup: the console window pops up and hangs for ~30 seconds. I thought it was broken at first but it eventually goes away on its own. While that was going on I also tried to launch a WSL terminal window to see what was happening; that hung too, until the syncthing starter window closed. My guess is that WSL 2 actually has a significant hidden startup time at Windows boot. Normally a WSL window pops up the moment you ask for it, but maybe Windows actually sets up the VM first time in the background and hopes no one notices. Not really sure though, will need to keep an eye on it.
Update: I asked on Reddit and this delay at startup does seem to be a thing that happens to others.
It’s real nice having my source code auto-synced. I sure hope SyncThing never breaks and deletes all my files. (I do have backups.)
I normally frown on time spent customizing coding environments. But since I’m switching to VS.Code I figured it was time to also consider trying proportional fonts for coding again. It’s ridiculous how we still write code as if our I/O devices were line printers and ttys (or worse, literal punched cards.) Proportional fonts are certainly idiosyncratic for coding but there’s a growing community of folks doing it. GoLang gave it a lot of legitimacy; Rob Pike has been using proportional fonts for decades and who’s going to say he is wrong?
Here’s where I’ve landed so far. To get there I had to set up VS.Code to deal nicely with proportional fonts, then adopt a Python code formatter that put out code that looked good in my setup: YAPF, not Black.
The first chunk sets the font. Note you have to set the terminal font to a fixed width font: by default it will inherit the editor fontFamily and proportional fonts do not work at all in a terminal window. They never will work well, too much Unix console UI assumes fixed width.
The rest of the settings are for making proportional fonts look nice for my Python code. Read below for details.
Font Choice
The nice thing about proportional fonts is you have so many to choose from. Want to program in Zapf Chancery? Go right ahead. (No, don’t do that). One thing to look out for is a few characters special to programming. You want 0/O and l/1/| to be distinguishable. The { braces} and [ brackets ] are also important and often overlooked in non-coding font design. Another thing to think about is the overall width of characters; many programmers want a narrow font to get more on the screen. I don’t.
I started with Calibri;. I like how it looks, it’s calm and innocuous. It’s not designed as a coding font but it’s not bad for the purpose. I’m currently experimenting with the five new Microsoft candidate fonts that fell off the back of a truck. They all look pretty good. None are designed as coding fonts but they all seem to work OK. The screenshot above is Tenorite.
I’d still rather use a proportional font designed for coding. There are precious few of those. Input is the standout and it is a very thoughtful font, including proportional options. I just don’t like the way Input Sans looks. Purely a subjective opinion. The Go Fonts are another good option but again don’t like how it looks, it’s a very opinionated design.
(PS: font installation still sucks in every OS. After you install new TTF fonts in Windows 10, close and reopen the Settings program or else it will hang / crash randomly. You also have to restart VS.Code to make it aware of newly installed fonts.)
Update: since taking the screenshot I added the letterSpacing. It’s a kerning kludge, to add 0.6 pixels of space between all letters. Text was just too tight, particularly things like the empty string ‘’. A single fixed value isn’t ideal for this but it helps.
Tabs vs Spaces
You can just change the fonts in VS.Code and start coding, things will mostly work. But the indentation isn’t awesome. The space in a proportional font is so narrow that the typical 4 space indent ends up being too narrow (and 2 spaces is impossible).
So I switched to tabs. Yeah, really; this is my embarrassed face. I’ve spent nearly two decades expunging tabs from all my code (except Makefiles and other monstrous systems that require them.) I had clearly chosen sides in programming’s stupidest controversy. But in the back of my head I always knew tabs were “theoretically” better; tab is a semantic character, saying “this is a new level of indentation”, and the fact it’s 2 or 4 spaces shouldn’t matter at all. The tab character is the way to express that logical structure. It’s also the practical way to make Visual Studio work, because it lets you customize the look of the indentation without changing the bytes in the file.
So the second block of my VS.Code setup is setting the tab size to the size of 8 spaces. That “looks right” to me in Tenorite. It happens to also be the standard. For Calibri 12 looks better to me. 12 would look terrible in a fixed width font but you make sure your output only ever has tabs (not 12 actual spaces) and it’s fine. Wouldn’t it be nice if this setting were in terms of an em-space or en-space instead of the tiny space character? In real typesetting spaces are variable width.
Code formatting: YAPF, not Black
Automatic code formatting pairs nicely with proportional fonts. You’ve given up the ability (or requirement) to vertically align blocks of comments and code and stuff. Might as well use a tool to just format everything for you. Again the Go community is a guide here; gofmt is a standard tool. The same principle works for Python too!
I switched to using Black a few days ago and loved having a formatter make choices for me. However Black is very serious about making specific choices and they are very clear they won’t support tabs. Nor anything but 4 spaces. That’s Black’s whole shtick and I kind of like it, right until I don’t.
So I switched to YAPF, Google’s formatter. It’s a whole lot like Black but it’s more configurable. Out of the box there are some slight differences I prefer (fewer vertical lines for braces, etc.) but it basically does PEP8 more or less like Black does. But YAPF invites configuration. I tried to use a light hand here, I really wanted to not do anything too personalized.
The second chunk is all about using tabs instead of spaces for indents. You have to tell it to use tabs twice; for most things, and then specifically for continuations (with the cryptic value valign-right). I’m not positive that the indent_width setting even means anything.
The column limit is.. I don’t know what’s right. 80 columns is very narrow, one nice thing about a proportional font is it typesets a good deal narrower than fixed width. 132 would be a natural choice with precedent. But I’m going to go to (near) infinite. We’ll see how that works out. 999 might be a better choice to catch pathological cases.
The last two entries are preference things for me, idiosyncrasies. I figured hell I’m customizing YAPF already, why not go whole hog!
(PS: if you want to understand what YAPF styles are, look at the --style-help output. The code for making styles is also interesting.)
Drawbacks
As I write this I just set this up today; I haven’t lived with it. We’ll see how it goes.
The primary drawback is interacting with other programmers. Folks would right be mad at me if I submit a 2 line patch to some code when 800 other lines changed reformatting the code. It’s always more important to follow an existing style! But right now I have the luxury of mostly working alone on my own code so I can experiment a bit.
The other drawback is interop. Much of the Unix world (and my own environment) is designed around monospace fonts and 2 or 4 character indents. Things like my .bashrc look weird in this new setup, at least until I convert them to tabs. It’ll never look right in a terminal window which has to be fixed width for most things to work right. I think writing code in an editor is the important use case, so I’m OK optimizing for it, but we’ll see.
I’m also a bit uneasy that this setup is so Python specific, relying on the code formatter. I guess most languages have formatters now though.
Update (Jan 2022)
This setup has worked great for me. I’ve basically used it unchanged since I posted this and am much happier. My code looks nice! The only real problem I’ve run into is YAPF has some bugs where it seems to reformat my code slightly incorrectly sometimes, something about comments and multiply nested blocks. It’s purely cosmetic and I mostly just ignore it.
Update (Nov 2023)
Still working with proportional fonts, still like it. Thanks to this discussion I now know a new term for right-aligned comments that don’t work with my setup. “Hanging comments”. There’s a nice writeup of a solution for this called elastic tabstops; basically you make the editor capable of tabbing comments to a second left-aligned column. Unfortunately there’s no plugin to do that in VS.Code with a proportional font, and the discussion in the feature request implies it’s not easy to add as a plugin.
After years of using Sublime Text 2 I decided to switch to a newer code editor. The tipping point was wanting to use the Black Python formatter; ST2 doesn’t have support for it. (ST3 does but I don’t own that). VS.Code seems to be the new hotness so I’m giving it a try. So far I like it! Some thoughts:
Good: it feels very fast. It’s amazing how slow so many programs feel on my very fast desktop computer. VS.Code feels fast.
Good: the extension store. There’s a rich ecosystem of addons. I’ve already lost track of what all I’ve installed: Python, WSL, SQLite ... I’m still looking for a good JSON extension (the one I tried is very very slow). I’m still understanding the extension model; I keep having to install black and pytest and pylint in every project’s venv. That’s awkward but kinda makes sense.
Bad: It’s an IDE. I don’t like IDEs, I just want a tool to edit text.
Good: It’s an IDE! I can code with tools as good as the Turbo Pascal environment I used in 1986. VS.Code is notable for being a cross-language IDE. It’s also a fairly low impact IDE, you can mostly use it as a text editor to start and it’s fine. But I’ve started making peace with the Python IDE stuff and it works fine. It runs unit tests nicely (albeit without support for continuous testing on save.) The debugger works.
Mixed: linting and PyLance warnings. These are enabled by default and mostly don’t seem to show up. But I just got a warning from PyLance because os.getenv can return None and I was passing its output to a function that needs a string. But I was anticipating that and already had a try/catch block for that. At least you can suppress warnings on a line by line basis with the comment # type: ignore
Good: black. It’s instantly freed me about worrying about code formatting. My only complaint with the default black setup is it does weird multiline formatting if any lines go over 88 characters by default. You can change the line length but the whole point of black is one standard consistent style, so I hate to change that.
Mixed: Intellisense suggestions. It’s very nice when exploring but the default settings are awfully chatty. Currently trying out these settings to tone it down some:
Good: The command palette UI is nice. VS.Code didn’t invent that but seems to lean on it heavily. Emacs users used to typing M-x will feel right at home.
Bad: preferences. For years the only way to change preferences in VS.Code was editing settings.json. There’s now a GUI for it but it’s clearly generated from the JSON specs and it shows. It’s clumsy.
Good: Settings sync. You log in via Microsoft or GitHub and VS.Code syncs your settings, UI state, etc. It’s optional.
Mixed: the look and feel. Something about the very spare UI chrome and the color schemes feels wrong to me. Maybe I’ll get used to it. I’m using the Dark+ theme now and it’s mostly fine, I just feel a bit dislocated. I have a particularly hard time with the filename tabs. This customization might help:
Great: git integration. I don’t think it’s trying to be a full git client but it has a nice UI for quickly seeing what code has changed and staging and committing code. The diff viewer is terrific.
Good: I can launch VS.Code from a WSL shell with code . It automatically loads the VS.code project file for me. It also seems to detect my venv/ directory and use it.
???: security. Every time I load files from a new directory VS.Code asks me if I trust the files in the directory. WTF? I guess VS.Code or some extensions will run code snippets it finds in files you are editing in some circumstances. That seems like a terrible security risk and passing it off to the user is not good.
I have my TV plugged in via HDMI to my Windows machine for occasional gaming. When I want to play games I need to swap the display resolution to one for the TV and also change the sound output device to the HDMI device. I’ve got it set for display mirroring; gaming as a second display sorta works but gets confusing and can require trips back to the mouse and keyboard.
Anyway I got tired of doing it by hand so I scripted it. The key is Nirsoft’s program NirCmd. It gives you a command line interface for doing all sorts of Windows desktop and system manipulations. Here’s the batch file I use to get into desktop mode:
I still play the amazing generative graphics game No Man’s Sky. One nice thing is the game has 11 different kinds of planets with different biomes. Each biome has a list of different names the game might use to describe them. It’s not always obvious what biome a name describes. So here’s a list of them all for easy searching. See also here and here for other sources, or my data as a spreadsheet.
This data is current as of September 2021 including the Frontiers update of NMS (3.6).
Somehow I’ve done generative art experiments for 30 years without every really understanding noise functions. I mean I’ve certainly used some but never directly, generally by incorporating someone else’s noise-derived textures or something. So here’s some notes.
Noise functions
Processing’s noise function is probably how most generative artists first encounter noise. It is straight up Perlin noise, the classic 1985 algorithm. It’s defined for any number of dimensions but let’s just focus on 2D noise for now. You give it an x, y and it gives back a random number 0-1. The key feature of Perlin noise is it’s smooth; two x, y points near each other will have a similar value. Note there’s an implicit scale in Perlin noise; is (100, 100) “near” (0, 0)? Or do you have to go as close as (10, 10) or (1, 1)? This scale factor is not very interesting but you do want to dial in a scale that has features of the size you want. Perlin noise implementations often provide other tuning like how many octaves to calculate and how much each contributes.
Perlin noise has a problem in that it’s somewhat directional; you can see horizontal and vertical artifacts in the top 4 images above. (Taken from this blog post). The bottom 4 images are similar treatments of OpenSimplex noise. Simplex noise is a different algorithm Ken Perlin made in 2001; see here for an explication. Unfortunately Simplex noise has some worry about a patent (expires January 2022!). So that’s why there’s OpenSimplex: it has similar features but was designed to be avoid the patent. (Patents on math: so stupid.) In addition to being isotropic both kinds of simplex noise are also faster to calculate.
FastNoise is really a collection of different noise functions with an emphasis on fast implementations. Includes Perlin, Simplex, and a bunch of other choices. The project is ambitiously multi-language and has several iterations as the author has supported SIMD first and then rewritten everything as FastNoise 2. Note the author Jordan Peck works on No Man’s Sky, one of the most ambitious procedurally generated videogames out there. It’s full of noise functions.
There’s a bunch of other noise functions out there too. Worley noise, Fractal noise, Gabor noise... It’s like after Perlin got an Oscar for his noise function everyone wanted their own ;-) There’s also a lot of work in making fast implementations, running on GPUs, etc. I’m getting in the weeds now so I’m just going to look at some simple things to use with Python implementations.
Python implementations
perlin-noise, a basic Python implementation of Perlin noise. Works with any number of dimensions.
noise, a native code implementation of Perlin noise and true Simplex noise. 1-3 dimensions for Perlin, 2-4 for Simplex. Also includes a GLSL implementation for shaders that I did not test. This code is mostly 9 years old! But there’s no reason that should matter for something this simple. Note it has no API support for setting a seed. You can override the entire random integer function though which would let you also control seeding.
pyfastnoisesimd is a SIMD optimized, parallelized implementation of FastNoise. There’s no simple API for generating a single sample; it’s designed to generate large grids of numbers all at once (very quickly).
I’m currently using OpenSimplex in my projects, mostly because it’s the first library I found. It’s easy to use and fast enough for me.
Benchmarks
I don’t really much care about speed in my applications but I was curious, so here’s some simple timeit statistics to generate a single 2d noise sample.
Constant
50000000 loops, best of 5: 0.00469 usec per loop
math.random()
10000000 loops, best of 5: 0.0359 usec per loop
OpenSimplex
100000 loops, best of 5: 2.34 usec per loop
perlin-noise with 6 octaves
5000 loops, best of 5: 90.6 usec per loop
noise.pnoise2
5000000 loops, best of 5: 0.1 usec per loop
noise.snoise2
5000000 loops, best of 5: 0.0844 usec per loop
So there you have it. About 0.1 microseconds per sample for the C implementations, 2.3 for OpenSimplex (Python), 90 for Perlin (Python). To it it another way, that’s roughly 10M samples a second for the C code. For comparison pyfastnoisesimd says it’s a few nanoseconds / sample, or 200M+ samples / second.
Using noise for art
Noise functions are just random number generators; how do you make art with them? Ha, as if there were a simple answer to that question.
I did make one simple demo that a zillion people have done; making a grid of OpenSimplex noise and then visualizing the number with a short line segment rotated by the noise value. You have to fiddle the scaling to get it to look interesting. Here’s a result that looks pretty nice plotted, although drawing all ~5900 line segments took 90 minutes.
Another classic plotter use of noise is to draw “flow fields”. It’s a simple physics simulation; you drop a particle at a point and then interpret the noise value as an angle of force. Then you draw the trace of the particle as its buffeted around your grid. I’ll probably do that next, it’s a classic with a lot of interpretations.
Seeds
An aside on seeds. It’s nice to use words as seeds instead of numbers. There’s a zillion ways to do that but one easy way to turn a string into an int is zlib.crc32(seed.encode('utf-8')). Note that’s a 32 bit int; 64 would be nicer. Oddly there are precious few 64 bit checksum and hash functions, I don’t think any are installed into Python by default.
I’ve been thinking how nice it’d be to have a higher DPI screen. My current monitor is 109 dpi which is just low enough that I can run things at 100% scaling and it’s all readable. (Sometimes I bump the font size up +1 on things). But I’d love to get a 200 dpi or higher screen so everything looks crisper. This works great on MacOS but historically has been a mess on Windows, in large part because sometimes you are running 20 year old code that is rendering pixels on its own and is totally DPI unaware. But things have improved.
The testing below is with Windows 21H1. I learned a lot from this blog post which explains how to configure Windows high DPI, in particular how to override settings on a per-app basis. I haven’t needed to do that but it’s nice that it’s an option.
I set Windows to 125% scaling and tried a bunch of things. For me my metric of “works OK” is “readable” and “works right” is “readable and not blurry”. Example blurry window to the right. (Note that the app itself works right; only the installer is blurry.)
Most of the apps I use just worked right. A few had to be restarted; they were blurry or in the case of Steam just didn’t work right at all. A few apps were slightly blurry: not “pixel scaled 125% blurry” but more like “awkward font size”, maybe just something not quite optimized. A few older apps worked but were blurry like 125% pixel scaling: Audacity 2.3.3, NZBGet 21.1 (Win UI), SFTP Net Drive. The only thing that was consistently blurry was NSIS, the Nullsoft installer system a lot of software use. There might be a fix package builders can use. Don’t much care anyway, you run an installer once and forget about it. I didn’t test very many games, most games are fully doing their own thing with rendering anyway so I expect they are unaffected by the DPI setting in Windows.
I was honestly surprised at how much did work perfectly. So that impressed me. 125% scaling works almost everywhere in Windows now. None of it feels quite perfect and there are some rough edges but then that’s typical of the Windows UI experience in general. It’s fine and totally usable.
Microsoft has put more thought into display scaling than I reazlied. This helpful developer doc shows the evolution; there was reasonable support starting in Windows 8.1. Windows 10 1703 stabilized on “Per-Monitor V2” with various APIs. The part that surprises me is “Desktop applications must tell Windows if they support DPI scaling”: without that Windows just bitmap-scales and makes for bluriness. I’m surprised almost all the apps I tried are apparently DPI scaling aware. It seems to work even with very old Win32 APIs, you don’t have to use fancy new UWP apps to get scaling. This guide makes it sound not very hard to write basic scaling-aware apps although it does take some extra work to do it nicely.
There is a way to inspect the scaling-awareness of running apps. Oddly a couple of apps (Everything, the PowerToys launcher) say they are “System” status which means basically unaware and yet they look right on my screen. There are a few apps that are fully “Unaware” but they are mostly things like Steam that seem to have their own bizarre rendering for everything.
One thing I can’t tell easily is if the apps are non-blurry because they aren’t scaling at all. I think PingInfoView may be like that; it says it’s “System” scaling but the window was non blurry and the font seemed too small. But the difference from 125% to 100% is not easy to be sure about. I’d care a lot more if I’m running at 200%.
I wish I had a simple program that called the various APIs for inspecting display characteristics and just showed me the info. I guess I could write one.
Higher DPI monitors
Anyway the software mostly seems to work. Now I need the hardware. I currently have a 34″ 3440x1440 monitor that I bought for about $1000. I like it very much. It’s 31 x 13 inches for 109 dpi. There are a bunch of higher density displays but they get pretty pricy.
5K monitors may be more reasonable. Here’s a couple, the first is pretty much a straight DPI upgrade on my existing screens ize.
LG 34″ 163 dpi, 5120x2160, 32″X14″, $1224. LG 27″ 218 dpi, 5120x2880, 24″x15″, $1600.
Newegg has a lot of choices for 4k gaming monitors, some 16 at 3840x2160 (for a 16x9 aspect ratio).
Looking at this another way... a 43″ 3840x2160 monitor is a pretty common size for $1300 or so. That’s 105dpi, so basically I’d get a bigger monitor at the same dpi. Not interested. To go higher density there’s 32″ 3840x2160. That gives 138 dpi, or about 25% more pixel density. These monitors are 27″x15″ and I’d definitely the loss of width.
What would be a clear DPI upgrade on what I have now is a 5120 x 2160 monitor. That gets me back to that LG 34, I think it’s the closest to a direct dot density upgrade. It’s one of only two monitors in this size; the other is the MSI PS341WU.
The other thing I should consider is pixel depth; 10 bits is common now although I don’t know of any software supports it. And also refresh rate; I like my GSync up to 100Hz. The LG 34″ that looks like a good match for me is 10 bit and supports 75 Hz. No indication of GSync or FreeSync support though. The MSI monitor is 60Hz only.
Just for fun, Apple’s Pro Display XDR is 6016 x 3384 for 218 dpi at $5000 (!). The screen is 28 x 16″. I can’t find anyone selling another brand with this panel.
Bottom line, the LG 34WK95U-W looks like the best option for me and a fairly unique one at that. $1224 on Amazon is not a lot but I don’t think it’s a big enough upgrade to warrant replacing my existing monitor.
I just finished a first playthrough of a really great early access game, Dyson Sphere Program. I don’t normally talk about games here but this game is so much like programming it seems relevant. Also it’s pretty and it’s fun.
DSP is a Factorio clone. Or to be more fair, a “factory automation game” since it’s now kind of a genre. But DSP is a lot like Factorio and it’s quite apparent when you play.
The big innovation is that it’s a lot more beautiful, as the screenshot above demonstrates. Full 3d graphics. And it’s not just a gimmick; not only does it look great but it performs well. And you even play in 3d a bit, the conveyor belts can be woven at different altitudes letting you make some nice bus designs. Also planets are actually spheres which has some implications.
The other big change is that it’s a multi-planet game. You start out building a factory on a single planet but there’s resources you’ll need to go to another planet in your system for and later on, you’ll bring in rare resources from other stars. Honestly this doesn’t add a lot of complexity but it does add some beauty and variety. (There’s a good Factorio mod called SpaceX that creates something similar.)
And the third big change is there’s a grand goal, swallowing the sun in a Dyson Sphere to generate power. You can see my nearly completed sphere rising over the planet in the picture above. The Sphere gives a purpose to all the construction that’s a bit more tangible than Factorio’s “build a rocket”. Also it’s real pretty and makes a useful power resource when it’s complete.
One nice improvement in DSP is a lot of quality of life stuff, UI improvements that make building things easier. OTOH the game is still in early access - the blueprint system only was released a week ago and has some rough edges. One of my favorite features is the devops dashboard, er, the production monitoring graphs. Here’s some details of the growth of my empire over the 65 hours it took me to win.
The game is really impressively implemented. It’s simulating a lot of individual components. And rendering them in 3d. It runs smooth on my fairly high end PC with a 1080Ti GPU. I read somewhere the Dyson sphere components themselves, tens of thousands, are being simulated with GPU code. Makes sense. Folks complain that this part greatly slows their PC but I didn’t have any trouble at all; maybe an artifact of how beefy a GPU they have.
The game is still early access and is missing some things I’d like to see. Some UI for monitoring and controlling the logistics network would be nice, it plays a bigger role in DSP than Factorio. It’d also be nice to have more game systems to design; there’s no analog to fluids or trains, for instance. Also the DSP folks have promised to add some defense / military aspect of the game. I’m fine with a peaceful builder but it could be interesting to have the challenge. Finally there’s no multiplayer, not even one promised, that seems like a mistake to me.
There’s a small but active mod scene for the game. No official mod support yet but the game is in Unity which is fairly amenable to hacking. There’s a few resources for writing your own mods. One point of confusion; there’s a global scoreboard called the Milky Way and various rumors that some mods keep you out of it. I asked on the Discord and was told there’s no whitelist or anything. Instead the game has its own cheat protection, it inspects its own data structures and if something modified them (say, a mod) then you are disqualified. That means info-only mods are OK and it’s determined by behavior. Unfortunately there’s no published list or info on which mods are allowed or not, you have to guess.
My friend Tom has been playing with GAN art, AI generated images. Thanks to him I was able to try out a working system; you just provide a text input prompt and out pops some art. I don’t really know how it works, something along these lines apparently. keywords: VQGAN, CLIP. The results are awfully neat though.
Update: you can play with it yourself in this notebook. No support provided, sorry.
Anyway I played around with it. Literally all I did was provide some text prompts, all the art is coming from the software. Which raises an interesting question about artistic input. I give the large majority of the credit to the folks who developed these techniques and trained the networks. But there’s a lot of skill in tuning the systems (something I think Tom is expert at). Of course the original image input creators have an influence too but when your input set is literally all images on the Internet, well, the credit gets a bit diffuse. A lot of these images are kinda samey but by no means are all of them. I imagine there’s a lot of latitude in how you train and tune these things.
Technical notes: it’s a giant pile of Python software with PyTorch as a big piece, also OpenAI CLIP. It’s running on Google Colab with a GPU at a free level so presumably a modest amount of compute resources. The small images take about 5 minutes to generate, the slightly bigger ones take 10.
Here’s the images I made. This is all of them, so you can see failures as well as success. I’m putting the ones I like first.
Known Unknowns
De Chirico landscapeYves TanguyAustralian aborigine artchurch pixel artGay OrgyGay Orgy #2Homosexual PartyStatue of NarcissusMalevich squareClassic male nude bathingWater slidesRotten bananaDyson sphereHas Anyone Really Been Far Even as Decided to Use Even Go Want to do Look More Like?When the moon hits your eye like a big pizza pie
Now that Starlink is working reliably I want to bridge the network between my two houses to make it easier to share stuff across. I have an elaborate setup of ssh tunnels and autossh for NAT busting and it’s awful. A VPN would be better. Some notes on getting there, this is very WireGuard 101 stuff.
The SF network is at 192.168.0.0/24 and is on fast fiber. I have a NAT router but I completely control it so with port forwarding it’s easy to set up a server. The GV network is at 192.168.3.0/24 and is behind double NAT; my own and also Starlink’s carrier grade NAT. The latter prevents listening on sockets pretty much entirely, so running a server behind it is awful and even elaborate NAT traversal seems dicey.
At first I thought I wanted a full bridging setup so the two houses appear in the same place. But in retrospect I think that is a mistake. It’d be bad for Sonos, for instance, it seems to use LAN broadcast to discover its own stuff and I’d much rather it found the local server for music files than tried to use the VPN. Same goes for Plex video too. OTOH I would like some discovery-based things to work; Windows filesharing for sure. I don’t really understand what I need.
To start simple I decided just to create a basic tunnel on a new subnet (192.168.7.0/24) between Linux boxes in the two houses. Doesn’t really solve my problem but those tunnels could later be gateways for house traffic. I am ignoring my Ubiquiti routers entirely. Folks have gotten various VPN solutions working on that, including Wireguard, but I’m concerned at the longevity of any hackery solutions for doing that. Maybe later.
Anyway setting up a simple tunnel between two Linux boxes is easy. I used WireGuard for this, apparently the modern VPN solution. It really is a breeze both to install and to understand. I mostly used this guide with some consulting of this other guide. Note WireGuard itself doesn’t really have good docs. For instance I cannot find anywhere a man page style reference for the conf files that wg-quick uses, never could find a definition of exactly what “Address” or “Endpoint” means. It’s sort of clear from context and examples but...
Anyway following the guides it all basically just worked. Very simple too. Wireguard’s model is peer to peer; peers are identified by a public/private key pair (and an internal ID). Tunnels between peers then get created as needed and each end of the tunnel is given an IP address. The guides are written in terms of a client/server setup so I’ll use that language from now on.
The main gotcha I had is when I first set up the server in 192.168.0.0/24 I gave the Wireguard tunnel itself an IP address in the same subnet, 192.168.0.0/24. That’s definitely a bad idea; my Linux box decided to use that new route instead of the ethernet and I had to reboot it. That’s why I put the Wireguard tunnel in a new subnet (192.168.7.0/24) instead. The other gotcha is I set SaveConfig=true. It’s a neat idea; you configure the thing on the fly with the command line and then the config file is updated. But at the same time I was editing the config file to fix things and restarting WireGuard and my changes kept getting clobbered. Pick one or the other style of creating a config, don’t do both.
Anyway, now I have a working tunnel so my two Linux boxes can talk to each other. The next step is using this tunnel to do “other things” like mount Windows fileshares, etc. Still not sure how I’ll go about that.
Updates below
I’m going to keep updating this post as I hack more. I don’t feel like having the discipline to mark every update, so just expect stuff to be added over time.
I realize I don’t really know what I want from this VPN setup. I don’t want full bridging; I want some things like media servers to not be discovered over the WAN link. I do want a lot of transparency though. I’m going to start now by making sure every device in SF (192.168.0.0/24) can talk to every device in GV (192.168.3.0/24). I’ll worry about broadcasts and discovery later, if at all.
Several folks have asked “why not Tailscale”? That is probably an excellent answer; Tailscale is a nice VPN product built on top of WireGuard. I was under the impression it was client oriented, not network oriented, so you had to install Tailscale on every device. But that’s not really true; they have a “subnet router” capability that works for other devices. At this point I’m mostly not using it because I got WireGuard itself running OK and I want to tinker more.
Starting to think I should run Wireguard on my Ubiquiti boxes afterall. One of my routers is a Ubiquit Dream Machine which is sort of different software: here’s a port of Wireguard to Dream Machine.
Netcat for testing
I want to be able to test if packets get through but without the full round trip ICMP ping requires. That’s what netcat is for. On the server side; nc -klu 3333. On the client side, testing sending a packet: echo foo | nc -u 192.168.3.75 3333. Note the client netcat doesn’t hang up after sending the packet, it keeps the socket open looking for input.
Routing the subnet
The basic wireguard setup gets a tunnel going. You can ping the tunnel endpoint IP address (192.168.7.3). But not the “real” IP address of the machine at the other end (192.168.3.75). To add that, we need a route. Doing this manually is a mistake (wg-quick does this...) but it was the first thing I tried and half works, so I mention it here:
route add -net 192.168.3.0/24 gw 192.168.7.3 wg0
Doing that is enough to let UDP packets through. nc -u 192.168.3.75 3333 works! However traceroute (and presumably ping) fails with the mysterious message send: Required key not available. Turns out that’s an error message from Wireguard and in my case is caused because 192.168.3.0/24 is not one of the “Allowed IPs” in the peer definition for the Wireguard tunnel. Wireguard is blocking the traffic.
The solution is to add the subnet to AllowedIPs. AllowedIPs = 192.168.7.0/24, 192.168.3.0/24. Add that and restart and pings get through and get replies. Moreover there’s no need to manually add the route because wg-quick does it for you. “It infers all routes from the list of peers’ allowed IPs, and automatically adds them to the system routing table”. Nice! Long story short, to get a single machine on two different subnets talking to each other via Wireguard it’s sufficient to add each’s subnets to the other’s AllowedIPs.
Next step: get the rest of the LAN on each side to know to route traffic for the other subnet through Wireguard. I know this means adding a static route (probably in my router). I’m less clear what, if anything, I have to do to configure the Linux box to act as a router that forwards the packets for that destination. When searching for info on this I found a lot of advice about using IPTables masquerading for a NAT setup. Yuck, no!
Update: turns out basic routing just works already with no extra config. It may help that my Linux box which is the Wireguard endpoint already has IP Forwarding turned on. Anyway on my Windows box I just did route add 192.168.3.0 mask 255.255.255.0 192.168.0.65 and now my Windows machine can talk to the other end of the Wireguard endpoint on its “real” address 192.168.3.75. Can’t talk to anything else on the remote network though, but that’s because they don’t know a route back yet.
Of course I don’t want to manually have to add this route to everything! A better solution is not to set the route on my Windows desktop but instead add a static route to my Ubiquiti Dream Machine. It’s hidden under Settings / Advanced Features / Advanced Gateway Settings / Static Route. The Destination Network is 192.168.3.0/24, the next hop is 192.168.0.65, where the WireGuard endpoint is.
C:\Users\Nelson>tracert -d 192.168.3.75
Tracing route to 192.168.3.75 over a maximum of 30 hops
1 <1 ms <1 ms <1 ms 192.168.0.1
2 <1 ms <1 ms <1 ms 192.168.0.65
3 60 ms 59 ms 59 ms 192.168.3.75
That’s it! Now everything on my 192.186.0.0/24 LAN can initiate connections to 192.168.3.75. Nothing else in 192.168.3.0/24 though because I haven’t added the route on that side yet. The big thing is my Windows box can now access the remote fileshare at \\192.168.3.75\. I doubt it will show up as discoverable but a direct connection works.
This is all working well enough now I’m close to needing to document the final setup and making it persistent. It may actually be persistent; I just did the systemctl enable command that gets wireguard to run at startup.
Having worked on rendering text on my AxiDraw, the next question is how to typeset text. The challenge is SVG 1.1 text elements are explicitly single line, no automatic wrapping. There’s no text flow in an SVG renderer, you have to do it yourself. (SVG 2.0 promises to add this, and I guess there was an ill fated effort in SVG 1.2).
There is a nice way to express multiline text in SVG using the <tspan> element.
<text class="verse">
<tspan dy="1.2em" x="10"
>How doth the little crocodile</tspan>
<tspan dy="1.2em" x="10" dx="1em"
>Improve his shining tail,</tspan>
<tspan dy="1.2em" x="10"
>And pour the waters of the Nile</tspan>
<tspan dy="1.2em" x="10" dx="1em"
>On every golden scale!</tspan>
</text>
Note the use of dy to do the line spacing; that’s nearly automatic. (the dx parts are for some fancy indentation. Not sure why x is being set explicitly every time.) All you have to do is decide where to break the lines! Ha.
I can’t find a Python library that will break lines for you or do more fancy automated typesetting. It is possible in Javascript, or at least you can write code to do it, using the getBBox() function to inspect the pixel size of some text and use that to break lines.
One approach in Python would be to calculate metrics for a font and then use that to estimate the width of a word. That won’t work if the kerning isn’t predictable. Also it’s a lot of work to do right for arbitrary fonts.
A second approach is to use something to render SVG in Python and use that to measure widths. Something like the pyrsvg wrapper for librsvg. That’s a lot of code to bring in though and I’m not confident it would perform very well. py3rsvg looks promising as a lighter / standalone option. See also this discussion.
A third option is to skip SVG text entirely and work directly with HersheyFonts generated paths in Python. The library has support for inspecting the width of glyphs; bounding box, etc. But this library is a separate work from the Evil Mad Scientist / AxiDraw code for Hershey text, the one that’s an Inkscape extension. They’ve done some nice work on fonts, etc so I’m not sure how much you’re giving up going with this other code instead. SVG Fonts, for one; I think the HersheyFonts library is using the actual Hershey format. That means no Unicode. I’m not sure the ESM HersheyText Inkscape code can be repurposed though, it seems to be written in a very Inkscape-specific way and relying on their renderer. I could be wrong about that though.
I think that last option may be best; it’s closer to the actual SVG I want to send to the plotter.
On the back of my text experiments I decided to give italic calligraphy a try. Unlike other calligraphy which requires managing pen pressure, italic calligraphy is done with a simple stub nib (or italic nib) of fixed width. The drawing end is a short line, not a circle. It’s usually held at a 45 degree angle so that both vertical and horizontal lines are wide but a 45 degree line is very thin. It looks beautiful when you draw curves.
Italic calligraphy is a whole art, one of which I am mostly ignorant. But this website has a good introduction to the basics and there’s lots more resources on line. For a pen I am using the Sakura Pigma Calligrapher; their Pigma Microns are my favorite ordinary pens (needle point).
Italic pen nibs need to be held at a specific 45 degree angle to work well, this adapter from AxiDraw makes it possible. Easy to install, although note it’s not compatible with their other pen-holding addon, the one that lets you adjust angles. It took me awhile to understand why they mounted it in the direction shown in the photos. That keeps the pen tip out from under the robot arm, a good thing. However it means you need to place the AxiDraw on the right edge of the page; if you’re used to the AxiDraw being above your design (“on top”) then you need to rotate your images 90 degrees. (This orientation is natural for the AxiDraw; it’s designed for A4 pages in landscape orientation, wider than tall.)
The hardest thing is getting the rotation of the pen correct. You want it positioned so the entire flat line of the nib is in full contact with the page. That’s very fiddly. What I found worked best for me was to set the pen drop height fairly high, like 50%, and position the pen manually and screw it down tight. Then go back and adjust the pen drop to lower, say 40%. That way it won’t ever drop the pen just barely above the paper, particularly if the paper is not entirely flat.
The other thing I learned on my first experience is it works better drawing very slowly, like at 10%. I don’t know if that’s a limitation of the pen I’m using or just a reality. I also suspect it would work better with more pressure, ie a weight attached to the pen itself.
Anyway, after about 15 minutes off fiddling I got some plausible looking things. Here’s a test pattern, also some simple test text. The text is a 10mm high font (with a 2mm wide nib) converted to a stroke font via Hershey Text, using the EMS Readability font. Those simple stroke fonts are a virtue if you’re getting interesting design thanks to the pen nib! The test circles show some ink flow problems I still need to work on. Also I think the font size is a bit too small for the nib.
Update
Made some nice progress.
I figured out how to align the pen more easily. Gently! Let the pen just drop to the page and find its own level. Then don’t overtighten the grip on it, since that will move the pen. It’s still really fiddly though! I also got some mileage from a simple pen-aligment test print.
The 2mm Pigma Calligrapher definitely needs to write slowly. Even 20% speed is too fast; 10% seems OK but very occasionally skips ink. I wonder if that’s a deliberate decision, calligraphy artists tend to draw slowly. Or maybe it’s a requirement of the very wide ink aperture. Anyway it’d be nice if it were faster!
Below, on the left, I made a nice font sample using 10mm sans-serif as my input to Hershey Text and a variety of fonts. All of these look decent, although not are all equally readable. The italic / slanted fonts look better (duh! italic calligraphy is usually written with a slant). The hand script fonts with curves look nicer too. 10mm with a 2mm nib is still too small. On the right is the same image shrunk down 75% (so, 7.5mm?) with a 1mm nib. Looks way, way better.
Anyway this all looks pretty plausible as a basis for fancy looking robot handwriting. I think my next interest is getting some nicer stroke paths for the pen to follow, something more like a real calligrapher would do. I feel this stuff is very well codified by instruction. I should try programming that myself from videos! Or look into digitizing an actual expert’s motions.
In the sample images above, the font for “10mm sans-serif” is EMS Pancake. I included that as a joke but actually it looks pretty good.
I love GoodReads. It’s terrific having a giant list of books I’ve read and my thoughts about them. Also it’s got a nice community, a low key social network. There’s a lot of reasons to complain post-Amazon-acquisition, particularly about how little development the site gets, but it’s still good.
I’ve never managed to get into Letterboxd, the equivalent popular site for movies. I’ve started using it again recently and am doing a little better but I sure wish I had notes on the 500+ movies I’ve watched in my life, particularly back when I was watching 3 movies a week.
So what about video games? I went looking and found various options. See also this list. “Reviews” refers to folks who at least entered a rating for the game. I’m using three games to compare user populations: Ratchet & Clank Rift Apart (2021), No Man’s Sky (2016), and Majora’s Mask (2000).
Main conclusion from that is GG is a much smaller userbase. Anecdotally, Backloggd shows up in recent discussions on ResetEra, etc. Grouvee and HowLongToBeat have been around longer. I also think it looks like Backloggd is as popular as Grouvee now but missed out a few years ago when No Man’s Sky came out. I like how many folks on these platforms rate Majora’s Mask, that’s a classic and sophisticated game for folks to know.
I like that Grouvee and HowLongToBeat already has the import and export features I want.
Update: Torena now exports Somnopose-style CSV data right in the app. Yay!
I’m interested in tracking the position my body is in when I sleep: on my side or back. mostly. I’ve found a good solution for that for Android, the app Torena. You strap your phone to your chest with a runner’s belt, run the tracking app all night (30% of battery), and it produces nice little reports. It’s a good app, well designed, and worth the $10 if you need this kind of tracking. Somnopose is a similar app for iOS.
Pretty straightforward. But to make this really useful I want to pull the data in to OSCAR, the CPAP / sleep apnea tracking app that’s also recording all sorts of information about my breathing patterns, my blood oxygen, etc. I want to answer questions like “does sleeping on my back cause breathing problems?” and “do apnea events cause me to turn over, or does turning over cause apnea events?”. I succeeded! Code is in this gist.
I made the import via OSCAR’s Somnopose CSV support. The code linked above converts Torena’s JSON export to a format enough like Somnopose data that OSCAR would import it. It’s a bit of an impedence mismatch. Somnopose basically just records the phone’s rotational position in two axes, so it’s a data stream like “-89 -93 -92 -73 -23 4 2 1” with timestamps (that’d be rolling over from one side to stomach). Torena classifies the raw numeric data and exports categorized data, like “Left... Back... Right” with timestamps. So I just converted that back to numbers, albeit coarse ones. One extra trick is I had to add some extra CSV rows to mark the end of old positions so that OSCAR would draw square waves, not sawtooths.
Next steps
I did this convertor as a one-off just to see if it’d work. It does! To make this useful there’s three options:
Turn my convertor into a nice reusable program
Ask the Torena devs to export an OSCAR-compatible Somnopose CSV in the app
Design a new input format for OSCAR along with the Torena dev
Option 2 is probably easiest, if the Torena dev is amenable. Option 3 would probably be better but requires some product design effort with the OSCAR team.
FWIW I think having the raw numeric data is probably more useful. You can measure partial positions that way. Also maybe infer movement activity from the magnitude of changes. But really the data display needs to be rethought: coding position as an angle from -180 to 180 is not intuitive. The classifying Torena does in-app makes sense here, but maybe it could be done in OSCAR instead.
Another specific problem to solve is time synchronization; Torena has its own clock independent of the CPAP machine and O2 sensor that OSCAR is getting data from. OSCAR doesn’t seem to have a good solution for that although you can at least input a manual offset for some things. It’s important to get it at least to the right minute, if not second.
tl;dr: I found a way to download arbitrary files off an ez Share, but no way to list the files. Also ez Share only runs as an access point with a DHCP server which makes it super awkward.
I’m trying to get a working WiFi SD card. This is a thing that acts like a normal SD card, typically for a camera, but also has an embedded system so you can download files from it over WiFi with the card sitting in your camera. I want to use this to get data off a device that writes to an SD card and has no network interface.
Eye-Fi pioneered this tech way back in 2005. They’re gone now. Transcend made a line of WiFi SD cards for awhile. So did Toshiba with their FlashAir. They’re all off the market or only buyable for ridiculous prices. The only thing left on the market is a Chinese product called ez Share.
Long story short, ez Share is not suitable for general file usage. It’s got a very restricted design that makes it only good for photos and only in an awkward WiFi way. I’ve got some detailed notes below on my hacking attempts. Meanwhile I fond a FlashAir I could get from Germany (via eBay) for $50 so I’ve ordered that, it should be more amenable.
ez Share limitations
The WiFi only runs as an access point. You can’t make the card act like a client on your existing WiFi network. That means you have to swap your WiFi adapter to its network to download from it.
The other big problem is the card only presents a Web UI. And that web server seems hellbent on making sure you only download images from specific directories. It only wants to serve files in directories named DCIM/100CANON or DCIM/EOSMISC. And those files need to have image or video extensions. See below for a partial workaround to download arbitrary files. But I can’t get a file listing.
I couldn’t find any sign of a firmware update capability. Too bad, that might be a way to hack the thing to be more useful. Update: Biorn says there’s a way to update firmware via USB and some details here.
ez Share resources
These ez Share cards have been around for 8 years or so, but surprisingly there’s precious little information in English from folks trying to hack them. Either because they weren’t sold in to the US/Europe or because they’re so inflexible. Here’s some links I did find:
A download script in bash. Seems to be written for a different firmware than I have, the methods don’t work.
A clever hack to use the card with a microscope that writes to another directory. He corrupts a FAT32 filesystem to create the equivalent of a hardlinked directory.
The ez Share creates a WiFi access point with SSID “ez Share”, password “88888888”.
My card is version 4.4.0. In detail: LZ1001EDPG:4.4.0:2014-07-28:62 LZ1001EDRS:4.4.0:2014-07-28:62 SPEED:-H:SPEED
Download files
I poked around at the web server trying to coerce it to give out more info than it wanted to. The big success is I was able to download arbitrary files with URLs like this:
Note the ..\ in the path name, to get out of DCIM. The filename has to be the 8 character version; it’s a FAT32 filesystem but the firmware doesn’t seem to know it. Also there’s no ftype specified; that’s needed to avoid the “file extension must be a .jpg or other image/movie format” code.
Unfortunately trying similar tricks to get a listing of files via the web interface at /photo did not work. Neither did trying to download a whole folder; you can do that with images in the DCIM directory but apparently not with arbitrary files.
Below are some very detailed notes on exactly what I tried / learned
I’ve been running the TIG stack monitoring my Starlink connection for about 3 months now. I made a couple of posts to Reddit recently about the results of that. Bottom line: both latency and packet loss have improved significantly. Latency to 8.8.8.8 dropped from 44ms to 37ms average around July 15. And in the last month or so packet loss dropped from 2.1% to 0.6%.
Here’s a copy of the two reddit posts.
Latency improvement around July 15: 44ms to 37ms.
Noticed something interesting in my automated monitoring; my latency has improved. I’m measuring with pings to 8.8.8.8 every few seconds using Telegraf. The average has been about 44ms for a long time, dropped to about 42ms starting July 9, and starting July 15 dropped to 37ms.
It’s hard to accurately measure performance with a connection as variable as Starlink, but I have enough consistent data I think this is a real trend. Graph is here: https://i.imgur.com/fwuG2Yc.png
I don’t know where latency improved. The changes in the graph don’t seem correlated to firmware updates. There’s no obvious change in bandwidth, although measuring that accurately is really hard. The latency improvement could well be in the terrestrial links between Starlink ground stations and Google DNS; that’s not very interesting. Or maybe it’s in the satellite network itself. No way of really figuring it out from here I think. But FWIW I’ll append a current MTR.
Packet loss improvement: 2.1% to 0.6% over three months
My packet loss has improved over the last three months: from about 2% to 0.6% by my measurement. Don’t get hung up on the absolute number but I think the improvement trend is real. See below for more numbers and the graph here: https://i.imgur.com/RCqI6mp.png
Nothing significant has changed at my site. What I’m seeing is consistent with what Starlink has been telling us: reliability should be improving as they fill out the constellation. My antenna is mounted on a roof in Grass Valley, CA with some minor tree obstructions. I’ve been hoping with more satellites that Starlink could work around the obstructions; there was a promise a few months ago of a firmware update to do that.
Anecdotally I’ve been using Starlink exclusively on my desktop computer for about 8 weeks now. It used to be annoying about 10 times a day to have to wait for 5-10 seconds for the network to respond again. Now it feels like 2 times a day. But that’s just perception, the numbers in my report say more.
Unfortunately I’m having a hard time getting a great graph of the trend but it should be visible in the graph linked above. I’m also seeing a similar trend in Dishy’s own reported drop rate. Here’s the average packet loss percentage from my pings along with Dishy’s average drop rate over 7 day periods starting at various times:
Week starting 5/1: 2.1% / 0.024
Week starting 6/1: 2.0% / 0.027
Week starting 7/1: 1.0% / 0.008
Week starting 7/13: 0.6% / 0.006
FWIW the same ping tests with my old fixed wireless WISP was about 1% packet loss. But those were just one-off lost packets. Starlink’s multi-second outages have been annoying. They’re getting better!
Appendix: my ping data comes from Telegraf’s ping plugin. I’ve got it configured to send 5 pings at a time, every second. As always, when measuring with ICMP ping all sorts of other things could explain changes in behavior. But in this case the ping data confirms my general perception and also Dishy’s own reported drop rate.
Obstruction improvement: 0.7% to 0.07% in the last month
Note these are Dishy’s own reported numbers, similar to the graph you get in the app. This trend is entirely consistent with my own monitoring with pings. I think in the last month the planed “Connecting to the Best Satellite” has finally come to full usage.
(One in a series; I’ve recently posted other posts here on packet loss and latency improvements. I’d like to do one more post measuring lengths of outages, those 10 second failures we used to get. I think that’s also improved significantly but they haven’t gone away entirely.)
A false bandwidth result
I noticed the following graph (that is false) of Speedtest by Ookla results showing bandwidth decreased around August 1.
I wrote a whole long ass exploration of why my Starlink bandwidth might have decreased. It’s all wrong! Turns out somehow Speedify got re-enabled on my server August 1, I don’t know how. And Speedify’s VPN servers typically cap out about 120 Mbps for me. That’s it, that’s why my bandwidth went down.
Unfortunately this invalidates all my network monitoring data from August 1 to August 6. Doesn’t invalidate any of the data posted above, that was all in July before this change. But I will need to remember going forward to ignore all the weird changes I started seeing August 1.
I’ve removed Speedify entirely from the Linux box.
I’m looking for some tools / inspiration for creating text with my pen plotter. The issue here is that most of desktop typography doesn’t apply to plotters because it all relies on filled fonts, effectively bitmaps. Pen plotters draw single lines. You can try drawing and filling the outline of a traditional TrueType font but that seldom looks good. OTOH there’s a whole art form of handwriting text with pens, so maybe some ideas from artists that can be borrowed?
Unfortunately traditional calligraphy is out because most calligraphy requires varying pen pressure to change line width and that’s something an AxiDraw and most other plotters simply can’t do. You can get somewhere using an italic nib (basically a pen tip that’s a wide line, not a point) but it’s pretty tricky. And it still relies on you having a font to draw the shapes.
The other quick solution is what’s called “Hershey Fonts” (after a Dr. Hershey!). AxiDraw has support for them as does this third party product but the actual classic Hershey fonts are, let’s just say, unaesthetic. The image below was plotted poorly with a bleeding pen on cheap paper, so ignore the dots and bleed, but nothing’s gonna fix these tragic shapes.
Update: when writing this up I neglected to talk about the EMS fonts, a series of free SVG fonts included for use with the HersheyText 3.0 plugin and SVG font format
The Good Stuff
So I asked on the drawingbots Discord for inspiration and got a couple of good suggestions.
A simple option is to just use better fonts. Single Line Fonts sells a handful of nice looking fonts for very modest prices, $20 or less. (And try the coupon TAKE25OFF). A bit heavy towards cursive scripts (but not true cursive, since the letters don’t actually connect.) There’s a very limited set of SVG fonts but a larger number of TTF fonts. I think those can be used with an AxiDraw OK, they mention that each line is drawn twice because of technical requirements.
A more sophisticated (and expensive) option is Quantum Enterprise’s single line fonts. There’s 59 fonts in a variety of styles. At $130 a font these aren’t cheap! But they’re nicely designed and have a lot of technical details on how to best use them with AxiDraw. Also these aren’t simple fonts; they have variant characters so that you can draw text without every single instance of a letter looking identical. They have a software tool (“Scriptalizer”) that will render variable text for you, demo it here. They also offer a service that will generate a custom font from a handwriting sample for $350.
Inspirations
One interesting point someone made is that a lot of what’s driving handwriting with plotters is marketing. Folks trying to mass-print mailers that look like they were hand written so you don’t just throw their junk mail immediately in the trash. I wonder if that’s part of AxiDraw’s business; you’d want a faster machine for mailing thousands of pages but it’s suitable for small runs of envelopes, etc. Anyway, sleaziness aside I’m glad to lift any approached they’ve developed. One interesting merchant in this area is Handwrytten, they sell robot-hand-written cards as a service ($3.25 a card!).
But what I really want to see is experimental / artistic plotter typography. Something like the explosion of interesting art folks were doing in the early 90s as desktop publishing technology made it so easy for artists to manipulate text. Stuff like this or this, only plotter-focussed. Someone must be doing this kind of work out there but I haven’t found it yet.
I’m also wondering what the state of the art is for true cursive script being generated in software. Something similar is essential for Arabic typesetting and is more-or-less a solved problem, so it seems likely that English cursive script could be doable?
Updates
There’s some good resources on the EMS Wiki also here. And some other stuff.
I tried taking a TTF font from vLetter (Hobbs), converting it to SVG font format with Convertio, and then using it with Axidraw Hershey Text (in Inkscape). Unsurprisingly this generates an outline font, not a stroke/engraving font, so each character is overdrawn twice (slightly off shifted). Probably no point converting the TTF to an SVG Font; the text to path tool in Inkscape can do the same thing. Anyway, my sample of 10pt text looked OK with a very tiny 0.05mm Staedtler pigment liner but it’s obviously not as good as a real stroke font. (Note the tiny hollow letters; that’s a fine nib on that pen, anything normal width would work better.) It’s not a bad option though if you want a quick handwriting look; vLetter has a lot of free handwriting fonts.
Playing with this made me wonder how hard converting a TTF outline font to a stroke font for SVG would really be. Taking the centerline of the font would be one possibility, although you would have to identify that with some heuristics (maybe following the TTF outline?) Also generating a path that’s inset a bit from the outside of the bitmap would work more nicely than centering the path on the edge; that would account for the width of the pen ink. For research, a program called SFEdit can do it but it looks like all it does is do centerlines for paths (not fonts).
BTW I’m a total novice at Inkscape, but the way it handles flowed text is confusing to me. I had reasonable luck flowing text to a circle and then converting it with Axidraw’s Hershey Font extension. First I had to do Text / Convert to Text to change the type from “text flow-in-shape”. Also it only worked if the text was left justified. Center justified ended up being positioned entirely wrong.
Mike Migurski reminds me his Skeletron project solved a similar centerline problem, for maps. Code is here. He says he designed it using ideas from this paper. Hand-waving a lot, the technique is to calculate Thiessen polygons (related to Voronoi diagrams) for the roads, then calculate the center of the edges of those polygons. The flowline for the center of the road goes through those polygon centers.
Some links on automating centerline creation in Inkscape:
I’m finally trying to go full cord-cutter and use Youtube TV instead of DirecTV and/or Comcast cable with a TiVo or other DVR. So far so good, sorta, the ads suck.
Youtube TV is a great product. $65 in the US gets you access to about 100 channels, mostly high quality content. Also you get local TV although you do have to prove to Youtube where you live (via browser geolocation, lol.) You can watch 3 streams at once. If you pay extra you can get premium channels, 4K streaming, offline viewing, more than 3 streams at once. The only real drawback I’ve seen so far is that it’s stereo audio only although they’re promising to finally add 5.1 eventually. (Youtube itself has this same problem; wtf, folks?) There’s one minor problem which is Roku officially doesn’t support Youtube TV anymore (they’re having a contract dispute), but Google solved that problem by shoving Youtube TV into the main Youtube app for now.
The bad thing is the ads. Youtube TV is full of ads. I watched a 48 minute episode of Top Chef last night and was forced to watch 10 minutes of ads, mostly in 2 minute blocks. Unskippable. The ads themselves weren’t too bad (and I have ad personalization turned off). But the volume was at least 10dB higher than the show content. And did I mention the ads were unskippable? Just awful. A way worse experience than pirating the show or watching on a traditional DVR where you can fast forward over the ads.
And that’s the confusion. If you watch Youtube TV shows via Video-on-Demand (VOD), the ads are unskippable. And placed later as separate content from the show. If you watch a show via DVR (a recording) you record the ads as the show is broadcast. But you can fast forward over them.
Youtube TV is making a distinction between “a show you have recorded” vs “a show we pulled from a library for you”. I’m sure this makes perfect sense contractually. Technically it’s nonsense. At least, I hope YouTube isn’t making a specific digital recording of a show just for me when I told it to record it. Surely they’re making one recording and sharing it to everyone? Maybe not; Sling’s exemption from copyright licensing relies entirely on getting a separate copy of the stream for every viewer, I don’t know how they record them. Anyway that’s all legal trickery garbage.
The real confusion is a UI problem. All the Youtube TV UI gives you is “add to library”. That both puts any VODs the show has in a special Library view for you (for convenience) and also starts DVR recording any new episodes that are broadcast. So when you first add Top Chef it looks like you already have all the episodes! But only VOD versions; you have to wait until something is broadcast to get the DVR version, the one you can skip ads in. Shows end up being twice in your Library, one VOD and one DVR, and you can choose which version you want. It’s pretty clumsy. Also there’s rumors that some shows / channels force you to watch the VOD version with its ads but I haven’t’ experienced that yet.
It’s all so dumb. The VOD experience is better in absolutely every way. Except for the ads, which Youtube and the content providers have chosen to be super aggressive about. (Apparently this varies show by show). I sort of accept that I should be somehow paying “extra” for VOD access, it is pretty valuable to have 10 years of a show all available to you at once to stream. OTOH I’m already paying $65/mo for access to this product and the VOD playback is consuming no resources, so why do I get punished by being forced to see ads? Mostly I’m irritated by the overlap with the DVR model.
I wonder how long this DVR exception will last. It’s clearly in both the content provider’s interest and Youtube’s interest to force me in to the VOD ad model instead. For that matter I should feel lucky the mute button still works in VOD ads.
Here’s what really worries me; the VOD ads are way more valuable. They can be updated any time. They are personalized to me via my YouTube login. And they are unskippable. I suspect these ads are worth 10x the value to the advertiser that a normal broadcast ad is worth. Expect this kind of ad to be the future, particularly as more people get rid of personal DVRs and cable subscriptions in favor of the clearly superior streaming on demand.
BTW I tried a little technical wizardry to block the Youtube TV VODs. In particular switching to AdGuard DNS. Didn’t work; I suspect Youtube serves all the video streams from the same DNS name. A filtering proxy or an aggressive firewall could probably block the VOD ads with packet inspection although SSL makes that harder. But even so there’s no reason the app would let you get away with it; it seems quite likely the Youtube TV app would just refuse to let you watch anything if it can’t force the ads into your eyeballs.
A little birdie tells me another way to skip Youtube TV ads is to stream on a computer with ad blockers installed. The fancier ones can block the VOD ads while still showing the show. The problem then is you need to get the video to your TV screen. Chromecast won’t work for that, because it just sends the URLs over to be played so you aren’t watching your computer’s ad-free stream. HDMI or video mirroring will work. But this all requires you have a PC in the loop. My goal here is to get the TCL Roku TV to do everything, no PCs involved. The downside is Roku isn’t about to let you install an ad blocker.
This blog post contains details on some hidden status method from Starlink’s user terminal, including what satellite it’s currently talking to.
I’ve been hacking around a bit with Dishy, the Starlink user satellite terminal. They provide some nice consumer tools for basic status: am I connected, what kind of bandwidth am I getting, a basic graph of history of outages. And a new feature, a fancy 2d map of where it thinks obstructions are (ie: the trees around you).
Behind the scenes Dishy implements a gRPC server with lots and lots of data. And happily the server supports reflection, so you can interrogate it for features. They keep adding new features! Mostly I’ve interacted with this using the starlink-grpc-tools package; it hides all the gRPC and just provides some command line programs for dumping data to CSV, InfluxDB, whatever. It’s quite nice! But it’s limited in that it only supports some of Dishy’s methods. There are others!
gRPC software
Ironically I have no experience working with gRPC. The hacking tool of choice seems to be grpcurl which lets you invoke methods via the command line. That’s a little low level so I am using grpcui which gives a simple web UI to gRPC servers that support reflection. There’s lots of other options for a tool like that btw.
So, what other gRPC methods are hiding in there?
dish_get_context
First try is a jackpot; dishGetContext. It mostly returns some stuff in other methods; device_info, obstructions, etc.
Update: lol that didn’t last long. Now when I call the method I get “PermissionDenied”, I think because of a firmware update. It was working on firmware a4908729. It’s now failing on firmware 4990ce8d.
But it also returns a bunch of information that looks to be about which satellite Dishy is currently talking to! It will tell me my cell ID (shouldn’t change?), a satellite ID, a gateway ID, and a “seconds to slot end”. It looks like Dishy swaps satellites every 15 seconds. The satellite IDs correlate pretty well with what a satellite tracker says. There’s also a “backup beam” that turns on sometimes after packet loss. It’s all super cool!
I went through all the other methods in the gRPC stuff. I skipped the ones that starlink-grpc-tools already supports like “status”, etc. Sorry to anyone else but for me I already knew what those did.
Unfortunately all the other interesting looking methods I could find returned errors suggesting they aren’t implemented. get_next_id, get_location, a bunch of wifi_ methods I suspect are in the router (not Dishy).
dish_emc: Fast Switching
One last method looked interesting, dish_emc. That API call seems mostly to be about RF radio state; channels, modulation details, etc. But there’s a fast_switching flag. Maybe fast switching is a frequency thing. But my hope is that it’s related to a promised feature where Dishy predicts obstructions and switches to new satellites to avoid them. My real hope is that this feature isn’t yet turned on and turning it on will magically make my Internet better.
So I turned it on: "dish_emc":{"fast_switching": true}}. I did that today around 11am on 2021-06-27. It didn’t immediately break my Internet so.. good? I’ll check back in 24 hours to see if it had any change. It may amount to nothing though.
Update: after 24 hours I think making this API call did nothing. Either the API isn’t implemented at all, or fast_switching was already on, or it doesn’t make a difference whatever it does. My money is on the “not implemented at all”. Here’s a graph of drop rate; I made the change right about the middle of the time axis here.
dish_emc looks like it returns status data too. But calling it, all the results are 0 or false. Maybe it’s not implemented or has some lockout. Here’s the result from that set call:
Windows 11 news came out today with a big surprise: it’s going to require TPM 2.0 support in your system. What the heck is that? “Trusted Platform Module”, a bit of extra hardware that’s used to store secrets for security and encryption. And a lot of Windows PCs don’t have it. But it can be added.
The easiest way to see if your system will run Windows 11 is to run Microsoft’s health check app. It’ll give you a simple yes/no. If it says “no” it’s likely it’s because your system doesn’t have TPM 2.0. To test for TPM specifically try running “tpm.msc” from the start menu (Win-R): it will tell you the status of TPM on your system.
Neither of my desktop PCs have it, neither my fairly new and fancy Asus X570-Pro nor my older cheaper Asus Z270-P. It seems pretty random whether a desktop machine has it or not. Hopefully most newer laptops do? I don’t know, I think my 2017 Razer Blade does.
You can add TPM hardware to some motherboards. There’s a 14 pin header for that purpose if you’re lucky. My X570-Pro has one, the Z270-P does not. If you have the header can then buy a little motherboard specific add-on module like this Asus one for pretty cheap, $15 or $20. I bet those are about to get scarce!
Some motherboards also support something called “fTPM” or “firmware TPM” (AMD) or PTT (Intel). This implements TPM in other parts of the motherboard’s hardware rather than a specific dedicated TPM. Perhaps that’s less secure, I don’t know. My X570-Pro has that ability. I turned it on in the BIOS and now my system is cleared as ready to run Windows 11. Not sure about the older Z270-P system, the manual has no info on TPM in it.
I’m curious why Microsoft is requiring TPM; given it’s not universal or may only exist behind an obscure BIOS setting this choice has to cut deeply into their market. They use TPM for BitLocker, their hard drive encryption product. I’ve never seen the need to use that myself so never looked in to TPM before. I wonder if TPM is good for anything else in practice? Linux supports it and can use it for some things like generating ssh keys.
One thing I like about pen plotting is how crunchy the materials are. I’m used to doing generative art and graphic design on screen where all the lines are pixel-perfect and if anything you try to hide the pixels, too. Ink and paper are much messier. Paper has texture and fiber. Ink bleeds and flows unevenly. There’s different kinds of pen inks, pigments that sit on top of the paper vs dyes that soak into it.
But despite liking all that crunchiness I also want control. I am particularly frustrated with the dot you get when the pen is dropped on to a page as the ink blots into the paper. Different materials have different amounts of bleed, consistency, etc. Sometimes you want something that works pretty much like pixels on a screen.
For paper I like this Neenah Exact Vellum Bristol, 8.5″ x 11″, 67 lb/147 gsm. It’s good heavy card stock. Paper is nicely flat but has just a bit of texture so that a swift moving pen leaves a slight graininess. (It’s not polished paper). It’s pretty cheap too, about $0.04 a sheet, so I’m using this for sketches that I expect to throw away.
The other paper I’ve used is this generic 5x7 note card 80lb / 216 gsm. The paper is a bit more polished than the vellum. I haven’t looked at cards too closely, mostly I just liked it came with matching envelopes and in small quantities.
Pens are a much bigger fun topic. I’ve tried lots but my go-to for basic solid line work is the Sakura Pigma Micron 05. My favorite thing is the very clean line it makes. Seriously looks like magic coming out of the pen, a solid smooth line. Almost no pooling / dots at the start or end of a line. I’ve never seen it smear or soak through heavy paper. The pens work great in a vertical orientation and ink flows cleanly at 50% speed on an AxiDraw; 75% starts being a little too fast. They come in a reasonable variety of colors, 15 in all, although the palette is a little heavy on the dark colors. The ink is advertised as archival quality. The 0.45mm pen (size 05) has the most color options and the line genuinely seems about 0.45mm thick. Parallel lines spaced 0.4mm show just a bit of white paper through, 0.3mm parallel lines make for a nearly solid color.
(I should disclose I’m a noobie to the pen plotter world, only been playing around with it on the side for a few months. There’s lots more to learn about materials!)
A little over a year ago I bought an Android tablet on a whim. I liked it so much I’ve already upgraded it, trading up from an Samsung Galaxy Tab S5e to an S7+. It’s kind of a dumb time to be buying this, Samsung is likely to announce the S8 line in a few weeks. But I got a good price on the 256GB storage model.
Really what I wanted was a bigger screen. The S5e has an excellent 11″ screen (245x160mm) but the S7+ has a 12.4″ screen (285x185mm). iPad Pro size, not iPad size. They’re both excellent AMOLED screens but the extra inch in each direction is great for media consumption. The real thing that put me over the top was reading comic books; juts a little small for old eyes on the 11″.
Other than that the S7+ is just an upgrade all around. More storage, more RAM (get the 256GB storage at least; the 128GB has less RAM), faster CPU (8 cores, good lord). Great battery; lasted 5 days with 8 hours of the screen being turned on. Fingerprint sensor hidden under the screen which is a nice improvement. Really it’s just a great piece of hardware. There’s a common meme that the Android tablet market is dead. It’s true there are fewer manufacturers than there used to be but Samsung is doing such a great job it’s fine.
Still reasonably happy with Samsung’s software, or rather the way it gets out of the way when you don’t use it. I switched to Nova Launcher again for the launcher and the rest of Samsung’s stuff mostly disappears. Except the parts I want, like the facial recognition unlocking. Samsung’s a little slow with Android releases, I think about 6 months behind? But they do get there and have a decent track record of support longevity.
And then there’s the S-Pen. I don’t know what to say about the S-Pen. This is Samsung’s big innovation, they’ve been at stylus support for a lot longer than Apple. It’s quite good at drawing, the pressure sensitivity is nice. Mostly it seems to serve to augment the UI, there’s all these gestures you can make with the pen both on screen and in the air to do magic things like take screenshots and scribble on them, zoom the camera, etc. I guess it’s kind of neat? But it requires you hold a pen in your hand; I’m perfectly happy with the touchscreen, thanks. And the pen gets in the way. It magnetically attaches nicely to the back of the screen but there it is sitting out. I have a case that holds the pen on the side and that’s OK too only the pen is thicker than the tablet, so everything’s unnecessarily bulky. I’ve already put the pen away permanently and now am looking for a case that doesn’t make any effort to leave room for it. Maybe if I were drawing art on my tablet I’d be excited to use it.
Sometime around June 3 Starlink pushed a handy new feature, a full map of obstructions in Dishy’s view. Previously it only told you about obstructions in each of 12 slices of the circle; now it’s got a two dimensional map.
That corresponds to what I expected; I have a tall tree to the Northeast. Not sure about the lesser blob to the north but presumably it’s a second tree. Unfortunately while these obstructions look small they really do affect my connection meaningfully. Dishy spends most of its time looking to the north so that side matters more.
FWIW the way this feature seems to work is a new gRPC endpoint in Dishy itself called dish_get_obstruction_map. The older 1752790c firmware doesn’t support it; I only started seeing the map when I upgraded to db6b5d22. That was release about June 3.
I’ve got my Playstation 5 plugged directly into my TCL 6 Series TV. That makes for what should be a great picture: 2160p resolution, HDR10 color. It looks great! When it works.
The setup started developing a problem where sometimes when I turned it on everything was way too dark. Like the whole picture was scrunched down to 0-50% brightness. It happened randomly and maybe dependent on the order I turned things on. But it got worse and worse until I just couldn’t use HDR anymore.
The fix is to reboot the TCL TV. No, seriously. TVs no longer turn off when they’re off, they keep running their computer in the background. So you need a full reboot via system menus (or power cord).
If you search you find lots of people online are having this problem, plenty of Reddit discussions. There’s also a bunch of other “HDR dark?” articles that talk about a different problem, which is the default picture settings for HDR are way darker than standard color. But this problem is a real bug and no amount of boosting brightness, etc will fix it.
Update: no, turns out reboots don’t always fix it. I’ve started from a soft reboot of both the PS5 and the TCL TV and gotten into the dim HDR mode. I haven’t tried a full hard / cold reboot (ie: unplug the damn thing).
I may have found another fix though, which is to go into a debug menu and select the “update dimming firmware” option. I don’t think the firmware update itself does anything, or rather maybe there’s no firmware to update. But it seems to cause the TV to reboot the HDR connection and twice now it’s come back at the right brightness. The magic sequence is HOME BUTTON (5X) - RW - PAUSE - FF - PAUSE - RW. This brings up the so called “platform menu”; there’s lots of hidden menus in Roku documented here and here.
There’s a classic style of visualization on the Web; “dots on a map”. You take a basic Google map or whatever and draw dots on top of it to indicate things: locations of stores, tourist highlights, demographic data, whatever.
Sniffies is a gay hookup app in the vein of Grindr or Tinder. It has a nice dots on a map Web UI so you can see people around you. Only instead of dots they’re little bubbles with user photos. This being a gay app, what that means is lots and lots of photos of intimate anatomy. Dicks on a map.
Image below is NSFW.
A MapBox map with many penises in location circles
I’m trying to synchronize data from Mendhak’s GPSLogger to other devices. I’m running the latest Android (11?) on a Pixel 3. GPSLogger supports a nice variety of sync options but none are quite right for me, so I thought I’d try using SyncThing on the data files on the phone instead. But I ran into a confusing permissions / security thing in Android where SyncThing couldn’t see GPSLogger’s data files. Here’s what’s going on.
First off, where are the files? The GPSLogger docs say they are in a folder with a name like /sdcard/Android/data/com.mendhak.gpslogger/files/. The first confusing this is that /sdcard prefix: apparently this is different on different devices. But the path from Android on down should be consistent.
If I access this files via the SolidExplorer Android file browser it shows up as a storage named “Internal Memory”, the default. (Presumably this could also be an SDcard or something). From there I can click Android and get three choices: data, media, and obb. Click data, search the giant list for com.mendhak.gpslogger, and there I am. Bottom line: GPSLogger stores its files in /sdcard/Android/data/com.mendhak.gpslogger under the root directory, at least on my phone. It’s just where the root is can be confusing.
If I plug in my phone and access it on my Windows machine as a USB drive, I can find my data with this path: This PC\Pixel 3\Internal shared storage\Android\data\com.mendhak.gpslogger Seems logically consistent; get to the root of the internal memory, then drill in on Android.
Unfortunately as of Android 11, ordinary apps can no longer access the data folder of other apps. This is presumably a security update, I guess the assumption is most of the time those files are private to the app and shouldn’t be visible. There’s an elaborate new system called “Scoped Storage” where apps can explicitly choose to share files but a lot of apps haven’t really caught up to that. It’s great that Android has a filesystem you can just access at all but over time they’ve complicated it.
There’s a couple of workarounds to the Android restrictions. A bunch of file explorer apps (including Solid) have hacked around it somehow to show you all the folders. Not sure how, I wonder if they’re using the opt-out procedure which is listed as “temporary”, a compatibly measure, and comes with other restrictions.
But this doesn’t help me with SyncThing; it doesn’t seem to support the workaround. All it shows me under “Android” is “media”, a sign that it’s stuck inside the scoped storage sandbox. Which is a little weird because I think it’s supposed to work thanks to including this patch. In particular there’s a “Use advanced Folder Picker: Select any folder on the device for syncing” that sounds like it should enable the workaround. It just doesn’t seem to work.
I also tried SyncThing-Fork, an experimental version. It has a little wheel next to the directory picker that gives you some “advanced” picker. It shows a data folder but that folder is empty. There’s so much drama getting Google Play Store approval I’m not sure it even can work. I briefly tried the FDroid version too (which is a bit more up to date) and it didn’t work there either. Anyway not thrilled at the idea of the fork, particularly if I have to install it via FDroid! So not pursuing that option further.
I finally gave up; the SyncThing app just can’t access that folder. Which is too bad. But fortunately there’s an easy other solution, which is just to get GPSLogger to write files to a different place instead. I chose to put them in /Documents/GPSLogger. Near as I can tell this directory is world-accessible. At least SyncThing can get at it, although IIRC I had to give it one-time permission to access it.
And so now I have SyncThing syncing GPSLogger’s files to my Linux server. Yay! Honestly it would have been a lot easier just to use SFTP or something from GPSLogger but I didn’t really want to set any of the GPSLogger options up. SyncThing seems to be working.
I did a bunch of work setting up Grafana to track my Starlink system and promptly forgot about it! Documenting it now.
I’m graphing Starlink stats using InfluxDB and Grafana. Telegraf is not involved.
The data collector is from starlink-gprc-tools. It runs as a background process and writes data in to InfluxDB. I haven’t changed the code from sparky8512’s repo, although I do have my own fork on Github.
I’ve installed a frozen copy in /usr/local/src on my Grafana server. Here’s the “collect” script that fires off the background process. This runs forever, no need for cron:
I haven’t really configured Grafana yet. I found some stock dashboard (in the repo?) that looks like the screenshot below. But it’s storing a lot more stats and I should drill into it at some point.
I finally got my TIG monitoring stuff to do a useful ping test of Starlink performance. See the graph below; it’s the result of sending 5 pings a second to 8.8.8.8 and measuring average response, packet loss, etc. I’m not positive but I believe the scale of this is 1 pixel = 60 seconds, or 60 samples. The way Grafana works, any time you see a red dot indicates there was some packet loss in that interval.
That’s an average of 45ms and 1.4% packet loss. 8.8.8.8 is just about next to the ground station at the other end of the satellite; if anything it responds faster to pings than the ground station that’s hop #2 on my traceroute.
Here’s a similar graph for the last 30 minutes, with 1 pixel = 1 second.
Within the 5 pings sent in one sample there’s not much variance in latency. But there is latency on the scale of minutes. Not sure if that’s me switching satellites, or me being buffered because of time division multiplexing, or what.
The really annoying thing is the packet loss, the red dots, particularly in an outage like at 18:30. Those correspond to real noticeable ISP outages of 5-20 seconds at a time. They seem to mostly happen when there are no satellites in view or when the only one is hiding behind a tree that’s in the way. That should get better as they add more satellites to the constellation.
45ms is pretty good for space based Internet! Sonic.net gets me 5ms on their fiber network, but they are astonishingly great. My fixed wireless WISP is more like 70ms.
I’ve been playing around with a Wellue O2ring, a wearable pulse oximeter. I’m using it to track my blood oxygenation while I’m asleep as a way to understand whether I have sleep apnea. The device works great! Some notes on it after a few days’ use.
Caveat: I’m not a doctor nor do I have any health or medical training. I’m just a software nerd who’s read some stuff about pulse oximeters. My only goal is to get myself better informed so I can talk to a real doctor about my health.
Hardware
The hardware is remarkable. Tiny little thing, about the length of a finger joint, comfortable and secure to wear. The pictures show it worn around your thumb but I’m a little thick for that and it works fine on most finger joints, I’m wearing it on the middle of my index finger. Note most pulse oximeters are duckbill sensors that fit over your fingertip; this is a little different.
The main sensor in it is the pulse oximeter. This is a fairly standard medtech; your finger is illuminated with a bright LED and the color of your blood is evaluated. Thanks to hemoglobin, oxygen-rich blood is bright red while depleted blood is darker. A simple sensor can measure the percentage of oxygen saturation in your blood reasonably accurately. In addition the O2Ring controls pulse rate and motion. The sensors record data every 4 seconds, or just about once every breath in a normal awake adult.
The device has a nice little OLED screen on it that shows time, current pulse, current SpO2. It also has a vibration function; you can set it to buzz your finger if you’re sleeping and your pulse rate or SpO2 drops to a certain level. It also has both USB and Bluetooth interfaces for exporting data. There’s a small touchscreen button to get its attention. The battery is charged via USB and lasts about twelve hours.
All in all the quality of the product is very, very good. This is a Shenzhen-designed product and it’s an example of the best of that engineering. My favorite feature is the device starts recording automatically when I put it on (sensing my finger) and works entirely standalone; no need to tether to the phone while recording. My only complaint is the rubber finger cuff that holds the product on isn’t replaceable, at least not obviously. But it seems sturdy though, I’ve read reports of people using these things nightly for a year+. I paid about $160 for the device; not cheap, but given the quality not unreasonable.
Software
There are two choices of software from the manufacturer, both of which download and graph data for you. The desktop app “O2 Insight Pro” is the better of the two IMHO; it gives a nicely formatted PDF with an overview on the first page with summary stats like “average pulse rate” and “time below 90% SpO2”. Then detailed graphs showing second-by-second measurements of SpO2%, pulse rate, and motion. The mobile app also shows a summary and a graph but the graph is limited to the device screen so you can’t see detail, just the general pattern.
Both apps have CSV export if you want to do your own graphing and analysis. The desktop app writes data in a binary format to your hard drive. There’s support in OSCAR (an open source sleep apnea app) for importing data under the heading “Import Viatom”. The source code for that is simple; basically a 40 byte header and then a bunch of 5(?) byte records all in basic little endian binary numbers.
What does the data mean?
I like the product but it comes with precious little material telling you what the reports actually mean. Here’s some notes on that.
Normal SpO2% while awake is 94-99%, which is nearly full saturation. Folks who have severe respiratory disease (say, Covid) are below 94% for long periods of time and this is dangerous. From what I’ve read being regularly below 94% is “talk to your doctor” territory and below 90% is “consider the emergency room”.
I’m mostly interested in blood saturation when I’m asleep. I’ve tried reading about that but I get a little confused because there’s three different measures: SpO2%, which the O2Ring gives. Then SaO2% which I think is a measure specifically of arterial blood? And people talk about PaO2, partial oxygen pressure. Various studies quote numbers in terms of one or the other and while I know they’re correlated, I’m not sure in what important ways they are different. But, soldiering on...
People with sleep apnea experience oxygen desaturation events, where SpO2 falls below 88% as they stop breathing. Check out Figure 1 in this paper for a detailed illustration of two minutes of this. In this patient SpO2 is often down below 70% and every 50 seconds or so bumps up to 95% briefly as they take a breath.
It’s tempting to think you could diagnose sleep apnea solely by measuring SpO2%. The O2Ring software sort of encourages this, with a simple summary that shows counts of “drops over 3%” and “drops over 4%”. But SpO2% alone is not how sleep apnea is diagnosed. Real sleep studies use pulse oximetry and pulse rate, for sure, but even the simplest at-home type IV tests also measure air flow. Fancy in-lab type II tests also have various EEG measurements. A real sleep study also requires a trained professional to interpret the results, the diagnosis is not reduced to a simple measurement like “X drops in SpO2% per hour”.
However at-home SpO2% monitoring with a consumer device like the O2ring does seem to give someone a relatively easy way to measure at least part of their health in sleeping. Also according to this paper ODI is correlated with apnea, but not perfectly. I’ve already found it a useful tool for understanding things like the effects of different sleeping positions. And like I said, my real goal is to get some insight into what’s happening with me while I’m asleep so I can better inform a doctor.
Bottom line: the O2ring is impressive hardware with adequate software. I’m finding it useful!
Finally made some purpose-driven art with the AxiDraw; a design for use on custom greeting cards. Materials are some Pentel felt tip pens on simple 80lb cardstock. Nothing fancy but I like the result.
Unfortunately the effect doesn’t photograph well. What’s here are a bunch of nested squares drawn in alternating colors. On the left is medium blue over pale purple, on the right is medium blue over a light orange. The effect is a weird op/art blending though, it looks like a complicated mottled texture rather than a bunch of distinct lines.
There’s one clever trick here.. the underlying color is drawn with straight lines, but the overlay color was drawn with some noise thanks to vpype’s squiggle filter. That gives the whole thing a less machine-drawn feel and lets a bit more of the undercolor seep out. I still wanted to have the feel of a page filled with color though, so there’s little to no white paper showing through.
I love some of the artifacts here. Particularly on the border, where there’s a software crop. The little dots of ink as the pen rests are great. I’m less excited about the dots in the middle. I used reloop to randomize their positions some but that only really works great on the squiggle layer (on the straight layer there’s only 4 possible start spots for each loop). I should try this with higher quality pens that don’t bleed ink at all, it’d look cleaner. Maybe the squiggle noise is all I need for crunchiness.
Here’s a closeup of a rasterization of the lines showing the squiggle trick. You want to zoom this image to 100% for it to make sense.
Before I had Starlink, I was downloading about 175 GB a month via my WISP. My data cap is just about double that, 350 GB, although I’m not sure they enforce it. Note this isn’t really all the Internet I would like to use; because it’s only 12 Mbps and I have the cap in the back of my mind, I avoid making really big downloads and truck files in with a hard drive sometimes instead.
As you can see from the months of March and April my usage of the WISP is way down now that I have Starlink. No surprise; I’ve shifted my heaviest uses of traffic (game console, TV, my desktop) over to it.
I’m stuck paying for both ISPs for awhile; Starlink isn’t quite reliable enough.
Wanted to give a shout-out for a great tool for working with SVG files and plotters: vpype. It’s a multifunctional tool for taking an SVG file you’re about ready to plot and then making it “better” for the plotter. Here’s an example of how I use it:
That’s a pipeline that does the following (in order)
Read my input SVG
Crop the SVG to the given rectangle.
Merge lines if points are within 0.05mm of each other. This “cleans up” the SVG and makes for faster plots with fewer, more complex paths.
Re-order loop lines so that each loop starts at a random point. This breaks up artifacts from the pen at rest blotting ink into the paper.
Sort the lines to minimize pen up travel distance. Axidraw does this too but supposedly vpype works better.
Write out the output SVG
It’s a pretty powerful tool and what it can do is confusing at first. But the docs are good. The feature overview is the best list of commands it understands grouped by theme. Beyond that check out the cookbook and the CLI reference. There’s also a handful of plugins; the one that caught my attention is occult which will emulate the masking you get if you put a filled polygon on top of other stuff in an SVG file.
vpype works by default as a command line tool. It also has a Python API and the ability to write your own plugins in Python.
Under the hood what vpype is doing is interpreting the SVG to build up geometries in memory. It’s sort of like rasterizing things on a grid, although not quite. It then uses that model to allow it to combine lines, simplify geometry, etc. Along the way it squashes all curves into collections of little short lines. (The plotter would do this anyway, so no great loss).
Bonus image: it has a fun “squiggles” filter which makes the lines not straight.
I’m downloading a big PS5 game right now (Returnal) which seems like a reasonable practical bandwidth test for Starlink. Here’s the router’s graph of throughput
Average: 123 Mbit/sec
So there you have it. An average of 120 Mbit/sec over 3 minutes, The graph shows throughput every 3 seconds so you can see the extreme variability; moment to moment the bandwidth swings between 20 Mbit/sec to 300 MBit/sec. Honestly I’m surprised TCP can cope with this kind of variance and converge to a reasonable speed! Other tests suggest there’s not a lot of buffering in Starlink’s infrastructure, so I don’t think that’s smoothing anything out.
Note the gap where bandwidth fell to zero at the start; that’s a legit failure and occurred several minutes after the download started.
And here’s a graph of the whole 56GB download period; average 160 Mbit/sec, took just about an hour. On my old 12 Mbit/sec WISP this would take about 13 hours (and possible cost me $1/GB in data overage fees).
Finally captured a rumored bug as it was happening. After Starlink Dishy resets itself, the home router can’t get a working Internet connection. (Note: this is not using Starlink’s router). Folks report various ways to fix it, often by plugging in Starlink’s router temporarily. I think resetting your home router alone is sufficient. Or even less intrusive; resetting the WAN port. Some folks on Reddit call this the “DHCP loop” behavior.
In summary; Dishy hands out a temporary IP address 192.168.100.100 with a very short DHCP lease. This seems to confuse routers which keep renewing the temporary address rather than getting a permanent 100.64.*.*/10 address.
Dishy behavior
Dishy is itself a DHCP server; it acts more or less similar to a cable modem. The reported behavior of Dishy is that right after it reboots and before its acquired satellites, the DHCP server hands out an address of 192.168.100.100 to any router that asks as a temporary address. Crucially, the DHCP lease on this is a tiny 5 seconds. It also has a gateway of 192.168.100.1 (Dishy itself) but this gateway doesn’t really work.
Once Dishy configures itself with Starlink it changes and instead gives out a semi-permanent CgNAT address like 100.71.6.46. It expects the router to switch to this new address, the published final gateway is something like 100.127.255.3. This DHCP lease is for 5 minutes.
Everything about what Dishy is doing makes sense to me and seems reasonable. The only slightly odd thing is the 5 second DHCP lease on the temporary, but presumably that’s set because Dishy knows it wants to swap the temporary address out quickly.
OpenWRT behavior
Unfortunately OpenWRT doesn’t react well to Dishy’s DHCP hijinx. In practice what happens is OpenWRT stays stuck at the old 192.168.100.100 address and never switches over. here’s a screenshot of the bad state in OpenWRT’s status panel:
I tried prying in to OpenWRT a little more closely to see what was going on. I’m fairly ignorant of how it works though, so didn’t get far.
The router is running a persistent process to maintain this DHCP lease:
That all looks normal enough. Unfortunately I wasn’t able to capture the DHCP traffic or otherwise debug the request/responses that were going on. However, syslogging was helpful:
Logs for normal operation, once every 2.5 minutes: Apr 7 18:05:16 OpenWrt netifd: wan (1527): udhcpc: lease of 100.71.0.14 obtained, lease time 300 Apr 7 18:07:46 OpenWrt netifd: wan (1527): udhcpc: sending renew to 100.127.255.3
First DHCP success after router reboots: Apr 7 18:15:15 OpenWrt netifd: wan (1527): udhcpc: sending select for 192.168.100.100 Apr 7 18:15:15 OpenWrt netifd: wan (1527): udhcpc: lease of 192.168.100.100 obtained, lease time 122 Apr 7 18:15:15 OpenWrt netifd: Interface ‘wan’ is now up
Afterwards, once a minute: Apr 7 18:35:37 OpenWrt netifd: wan (1527): udhcpc: lease of 192.168.100.100 obtained, lease time 122 Apr 7 18:36:38 OpenWrt netifd: wan (1527): udhcpc: sending renew to 192.168.100.1
So here’s the weird thing. The router was given a lease of only 5 seconds. But it seems to be ignoring that and just blindly renewing the lease every minute, pretending it’s a 122 second lease. Worse it’s asking to renew the existing address and Dishy is gamely letting it. What we want is for the router to get a new address, not perpetually renew the old one.
I suspect all this buggy behavior is triggered by Dishy’s slightly odd short DHCP lease. But without digging in to OpenWRT’s code I don’t really know.
/* paranoia: must not be too small and not prone to overflows */
/* timeout > 60 - ensures at least one unicast renew attempt */
if (lease_seconds < 2 * 61)
lease_seconds = 2 * 61;
I first tried to fix this by sending SIGUSR2 to udhcpc; that signals it to release the address. The release went through but OpenWRT wasn’t smart enough to then decide to get a new address. (Reading the udhcpc docs, I should not be surprised this did not work). I finally just clicked the “reset” button next to the WAN port in the OpenWRT UI; that caused it to fully reset the link and get a new working address via DHCP. And all is well.
Bottom line: something needs to convince OpenWRT to get a new IP address after Dishy is fully configured. That should be automatic but it’s not working. Manually forcing a new IP address fixes it.
Updates
Currently running busybox 1.30.1-6 (for udhcpc) and netifd 2021-01-09-753c351b-1.
For years and years and years I’ve been using Munin to monitor servers. Sure it’s old and limited but it still worked reliably and simply without too much software to install. But I’ve finally modernized, mostly so I could collect more data off my Starlink satellite.
I went with the combination of Telegraf, InfluxDB, and Grafana. The so called “TIG stack”. The end result is a system that works remarkably like Munin. Only instead of crappy Perl scripts there’s a clean fast Telegraf agent collecting data. The simple MTRR databases are replaced with InfluxDB, which seems a bit complicated for the purpose but works well. And rrdtool’s old busted graphs are replaced by Grafana, a very fancy enterprise-level dashboard construction system.
I followed a couple of guides for installing stuff: this one and this one. The install breaks down to “install some packages from third party repos” followed by “configure Telegraf and Grafana”.
The configuration is.. not simple. First you have to set up the database with a user, etc. Use the default names! They are baked in to things you will be using either. Then you have to set up Telegraf to log what you need. You can do this incrementally, you don’t have to get it all right at once, but there’s a whole lot of options and things to learn about. I think it took me almost two hours to tweak to what I wanted.
Grafana’s the real monster though. One nice thing about Munin is if you started logging a new number with a plug, the rest of the system would automatically figure out it should graph that number and show you. Not so with Grafana; instead you have to go through a very powerful but complicated web configuration to develop your systems. Fortunately Grafana is pretty good at auto-detecting variables and making some suggestions. The Explore query system is also good at figuring out what you might have in the database.
But the real win with Grafana is you can load other people’s dashboard designs from a community sharing site. For instance, I’m graphing most of my Telegraf system data using this dashboard. Notice how they helpfully supply a Telegraf config too; you can just copy and paste that stuff in and it will probably work.
Anyway, now I finally have some Starlink monitoring using sparky8512’s tools. It doesn’t use Telegraf but has its own little agent to log to InfluxDB directly, plus a sample Grafana dashboard. The dashboard is pretty limited, I’ll probably spend some time configuring my own eventually. But what’s there works for now.
I was inspired by this Starlink enthusiast and his speedtest charts. Ironically the Starlink setup doesn’t give any speed tests, but I’ve added that using this telegraf plugin. Note if you use that you must install SpeedTest.net’s own client, not the one in the default Ubuntu repos.
All in all I’m pretty happy with the TIG stack. Despite (or maybe because of) all the complexity the new system consumes a lot less CPU than Munin did. And it’s way more flexible and modern. Sometimes it’s good to update to new things. It’s a shame it’s so complicated to configure though; it’s hard to imagine how Ubuntu could ship this as an easy turnkey install.
Starlink doesn’t publish any sort of patch notes or update log. It’d be nice to have a community maintained list of firmware releases with whatever notes we can figure out.
Woke up this morning to my fancy new Starlink system not working. The culprit seems to have been the new firmware update. It applied but Dishy wasn’t working; lots of details in this Reddit post.
Annoyingly, the fix was to plug Dishy into Starlink’s router. It started working immediately. It’s still working, too, even though I plugged it back into my own router. (I haven’t tried rebooting Dishy yet.. I wonder if it will keep working?)
I sure hope Starlink doesn’t make their router mandatory. It’s really not suitable for anything other than the simplest home networks. It’s fixed at 192.168.1.*, has literally no configuration options other than the wifi password. I guess worst case I could put a second router in front of it and it’d be mostly harmless but it’ll add yet another layer of unnecessary NAT.
Update: a couple of Reddit commentors have said the real problem isn’t Dishy needing some magic config from the Starlink router, it’s that routers aren’t handling DHCP right. Read that linked post for a nice description of what Dishy is doing on startup. Before it’s got satellite lock it sends out the not-useful 192.168.100.100 IP address with a 5 second DHCP lease (very short!). Then it switches to a second IP useful 172.16.*.* IP address once it’s set up, with a 5 minute lease. The theory is some routers fail to update DHCP and switch to the new good address. I’m a little skeptical OpenWRT is doing something so dumb but since a couple of folks have offered it as an explanation I’d have to test it to be sure. Just have to wait for the next failure.
I finally figured out a networking configuration problem on my Ubuntu 20.04 system.
In theory all Ubuntu systems since 2017 have been configured with Netplan. It’s some simplified high level configuration language that systemd applies. Like any Unix thing built after 1993 or so I reflexively hate it, I kinda miss the old days of /etc/interfaces and hacking stuff in /etc/rc.local. But I gotta admit Netplan is pretty good. When it works; the problem I’ve had is my config gets overridden.
The first problem is cloud-init, some thing that Ubuntu ships to configure “cloud servers” from yet other files. I believe default Ubuntu systems are configured via /etc/netplan/50-cloud-init but if you edit that file, joke’s on you; it gets rewritten by something else. The solution is to create a file /etc/cloud/cloud.cfg.d/99-custom-networking.cfg with the contents network: {config: disabled}. That will prevent cloud-init from rewriting your files.
Having done that you can either delete 50-cloud-init or replace it with your own stuff. Note that config files are additive; I ended up configuring my ethernet twice until removing the cloud-init file.
The bigger problem I ran into is that I had a dhcpcd installed, the package dhcpcd5. I don’t quite know why, it’s probably something I did manually. But if that’s installed it will override the netplan files. You can have dhcp4: no right there in your netplan file and dhcpcd will still override your static configuration. I fixed this by uninstalling dhcpcd. I think the modern systemd world uses dh-client anyway.
Once that’s done netplan seems to operate as it’s supposed to, without mysterious other things overriding my configuration.
Trying to make my Starlink setup reliable enough to use regularly, I think I hit on a good consumer solution: Speedify. It’s a VPN service whose client on your desktop / laptop computer is smart enough to bond two Internet links. It can use extra links to boost speed or reliabilty or both. It seems to work. I’m using this to paper over Starlink’s unreliability. I imagine it’s particularly useful to bond crappy hotel wifi with a cellular hotspot (assuming you have two wifi adapters.)
Before I go on about Speedify I want to mention Multipath TCP. That’s a general technology for doing something similar. The Linux kernel has support and there’s various implementations but I can’t tell if any of them are really usable; a lot look like research projects. The emphasis on TCP is also a limitation, I’d like a redundancy solution for all IP not just TCP. Kind of a different problem though.
The main thing I know about Speedify is I was watching a Youtube video and had an open ssh session and unplugged my ethernet cable that connects me to Starlink. But the video never stopped and the ssh session stayed alive, presumably using the Wifi backup to my other ISP. That’s neat! Also speed tests show I’m getting the full speed of my Starlink, at least sometimes, so it’s not constrained to the lowest common denominator. So far I’ve lost 0.4% of pings to 8.8.8.8 over most of an hour; that’s better than I see using either ISP alone.
The Windows install experience is a dream. Installs smoothly, autodetects your links, sets it all up and you’re running on Speedify in seconds. There’s a free no-account-required option for initial testing, limited to 2GB. The UI is pretty slick too, with decent monitoring and configurability.
One drawback is that Speedify seems to require different actual network devices to bond. What I’d like to do is use a single ethernet adapter for both my ISPs and have Speedify bond two separate gateways. It doesn’t have the UI to do this. (Maybe there’s a way to set up a virtual ethernet device in Windows? Dunno.) I’m working around this by having plugged in a separate WiFi adapter that’s connected to one ISP, with the ethernet to the other. That works fine actually.
Another drawback is that Speedify is a VPN service terminated in a data center. In my case, Fremont CA. That adds latency. Also a bunch of video services like Netflix and Amazon now refuse to serve video to VPN datacenters because they’re so often used to work around country restrictions, etc. Speedify has a special “turn this off for video” feature, but of course video is exactly when you might most want to have Speedify. Finally some folks complain that Speedify makes their links slower than necessary. Speedify, for their part, says you should expect 200-300Mbps.
A final limitation is that Speedify doesn’t give a lot of control over what it’s doing. The user can choose the bonding mode: speed, streaming, or redundant mode. Speed and redundant seem to be two extremes: either maximize performance (but no redundancy) or maximize reliability. Streaming mode is a “smart” middle ground; it monitors each stream and decides when you need more redundancy. Mostly they’re talking about audio and video streams but the marketing copy mentions gaming, too, so presumably that’s also covered. There’s some more technical details here.
Here’s a couple of DSL reports speed tests. These aren’t the best I’ve seen; I’ve gotten 150/20 through Speedify, which is about the limit of my Starlink throughput. (Although I’d expected 50Mbps on the uplink, needs further testing.) I noticed on the download speed test it was only using the Starlink whereas on upload it saturated both my Starlink and my WISP. I think that makes sense. First, redundancy seems more important on the uplink than the downlink. Second, my upload was really limited during these tests and so the WiFi meaningfully could supplement it.
I wish they had a whole-network product! You can probably hack something up using their Linux support and a clever router, their product page indicates they indicate they’re sort of OK with you doing that but might charge you accordingly. That’s what got me interested more generally in multipath technologies for Linux; it’d be nice to have a router designed to do this. I think the easiest way forward with what Speedify has right now is to set up a Raspberry Pi with three ethernet ports; two for inputs from ISPs, one for output to a regular router. You might be throughput limited by USB speeds (for the extra ethernet ports) or encryption speed, but I’m not sure what the limit would be.
I’m really impressed with Speedify so far. I’ll probably sign up for a plan ($3 to $6 a month) for at least a year, to tide me over with Starlink. Gonna run out my free trial here first though.
Update: after most of a day of using it I bought a year of Speedify. $65 with the coupon DEAL10. It really does work as advertised. None of my sessions dropped; World of Warcraft, persistent TCP sockets, two hour idle ssh sessions all stayed open and working. Really solid.
I’m not positive the performance is great but I may be overanalyzing. I’m in Streaming mode and I should be getting at least my Starlink speed, if not better. In practice the speed tests tell me I get about 100/15. Peak is 190/22. Then again that’s just about the average Starlink performance now, so maybe it’s right. It seems pretty smart about using my slower WISP link a lot less but the backup has been there for me every time I needed it. Latency seems fairly variable too, seeing 20-80ms where I’d expect 20-50ms from Starlink. None of this is bad and compared to an unreliable link, it’s terrific. But it does make me think if Starlink gets to 100% reliability I may stop using Speedify.
Now I want a little 4 ethernet port Linux box to run as a Speedify bonding appliance in front of my router! That, or Speedify built right into a router. That should be doable in theory. For some reason Speedify has positioned itself as not a router; they’re real clear it’s a client product.
Update 2: OpenMPTCrouter looks like a plausible base for a roll-your-own alternative to Speedify.
Some collected information and what I’m doing about monitoring Starlink / Dishy’s performance. Note most of this stuff works with just Dishy, not the Starlink-supplied router.
Some facts
Dishy listens at 192.168.100.1 on ports 22, 80, and 9200. ssh, http, and gRPC. It also uses port 9201 for a different flavor of gPRC HTTP (for Android?)
The mobile app works by fetching web pages and/or gRPC data from Dishy.
Starlink’s router does gRPC on port 9000 and is the preferred source for the mobile app. It implements the ping interface, the thing that tells you your Fortnite lag.
You can view the stats direct from Dishy in any browser at http://192.168.100.1/support/statistics Note you have to open the browser window to max width; it’s formatting for the screen size, not window size.
How to ping on an alternate gateway: using nping to bypass ordinary routing. Useful for your munin host to monitor ping latency on a secondary route.
Software
pinginfoview: nice lightweight Windows tool for testing if the connection is down
Starlink gRPC tools: Python code for reading gRPC stats off Dishy This seems to give very complete data from Dishy, including the history of dropped packets
dishyworld: a working dashboard based on Prometheus and Grafana. Has ambitious goals of collecting data from many users.
starlink-cli: Go code for getting Starlink data. I think it’s the base for dishyworld? This seems to give less data than the Python library above, at least by default
Obstruction view. Takes the debug info from Dishy about obstructions and draws it. I know the mobile app can do this but I can’t figure out how to do it again!
This Python library seems to give more useful output than the other command line tool I could find so I’m pursuing it. The full list of commands: status, obstruction_detail, alert_detail, usage, bulk_history ping_drop, ping_run_length, ping_latency, ping_loaded_latency
Be sure to read the code / docs for detailed notes on what all the fields mean. There’s some surprisingly sophisticated analysis going on when it’s looking at data samples to, say, characterize the latency of the last 5 minutes.
Some useful examples:
$ python dish_grpc_text.py -v status
id: ut01000000-00000000-000353f7
hardware_version: rev1_pre_production
software_version: 848e54d2-015a-49cb-a814-34d7c5fc7e1a.release
state: CONNECTED
uptime: 130100
snr: 9.0
seconds_to_first_nonempty_slot: 0.0
pop_ping_drop_rate: 0.0625
downlink_throughput_bps: 9143.5830078125
uplink_throughput_bps: 4387.2421875
pop_ping_latency_ms: 29.5
Alerts bit field: 0
fraction_obstructed: 0.006759106181561947
currently_obstructed: False
seconds_obstructed: 266.0
# Dropped pings over the last hour
$ python dish_grpc_text.py -v ping_drop
current counter: 130202
All samples: 43200
Valid samples: 43200
Parsed samples: 3600
Sample counter: 130202
Total ping drop: 48.06441651657224
Count of drop == 1: 26
Obstructed: 23
Obstructed ping drop: 19.7899159938097
Obstructed drop == 1: 19
Unscheduled: 0
Unscheduled ping drop: 0.0
Unscheduled drop == 1: 0
# Bandwidth used for last 5 minutes
$ python dish_grpc_text.py -v usage -s 300
current counter: 131151
All samples: 43200
Valid samples: 43200
Parsed samples: 300
Sample counter: 131151
Bytes downloaded: 1327843
Bytes uploaded: 813427
Some of the ping_drop statistics are confusing; this github issue has notes on what they mean. “Unscheduled drop == 1” seems to exactly correlate to the stats UI’s “No Satellites” display, and “Obstructed drop == 1” is the Obstructed count. It’s less clear to me how to reconstruct the beta downtime statistics.
March 9 is the first day I use Starlink for real for a whole day from my desktop computer. I’m writing this blog post VIA SPACE.
I mounted Dishy on a J-mount that was already installed at my house. (An adventure in itself. Had to drill some holes in the mount’s pipe, then figure out how to lift Dishy up 15 feet on a ladder and place it in the mount. Then hold it in place, some 20 pounds, with one hand while trying to thread through the bolt with the other. I am not good at this kind of thing.)
After my ground experiments I was worried there’d be too many obstructions. Glad I tried it anyway; turns out to be fine. On the ground I think at worst it reported 1 hour of obstructions in 12 hours of operation and in general it was complaining things weren’t right. Up on the mount it’s reported 2-4 minutes of obstructions in 12 hours. That may still be unacceptable; if those 2-4 minutes are actual outages it will be quite disruptive. But it seems to be working well right now.
Optional Gateway setup
The network setup has been tricky. I got some good advice on Reddit about how to set up the Starlink as a secondary Internet gateway. I want most of my house to keep using my old ISP but have Starlink as an option on the LAN while I test it. Turns out to be relatively simple to set that up, the basic idea is to set up a router for the Starlink without DHCP and then manually choose to use that as your Internet gateway. But it does require a second router and some manual fiddling on the clients you want to use Starlink. Note the router Starlink sends you is not flexible enough to do this; you need something more hacker friendly. I’m using an old TP-Link Archer C7 running OpenWRT.
(Fun side fact; this old OpenWRT I have has a funky configuration on sshd. To talk to it I have to do this ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 root@192.168.3.233)
My regular LAN is 192.168.3.* with a router running on 3.1 serving DHCP in the range of 3.6-3.223. Dishy is plugged into the WAN port on a second router with DHCP and WiFi turned off. The router is configured with a static IP address of 192.168.3.233 and the LAN side of the router is plugged into the LAN ethernet switch with everything else. So other computers on my LAN work just like normal and are mostly unaware of the Starlink and its router. However if I want I can statically configure a machine to use 192.168.3.233 as its Internet gateway instead of the DHCP default of 192.168.3.1 and now it’ll be using Starlink. It’s a bit of a PITA; in most operating systems if you want to change any network parameters you have to go full static config. But that’s not too hard.
My current static config: 192.168.3.233: the Starlink router 192.168.3.230: my desktop PC 192.168.3.213: my phone
The first setup I had for Starlink was even simpler; I just used their router and gave it a different WiFi SSID. Didn’t plug it into the LAN at all. That meant any wireless device could choose to use Starlink in my house just by choosing the other SSID. But that doesn’t give my full LAN access. Handy hack, not a great long term solution. (I sure wish I could tell OpenWRT to run DHCP on the wireless network only, though.
A hilarious mistake the first time I set up the second router; the Starlink router had DHCPv6 turned on in a hidden setting I didn’t notice. All the Windows machines in the house noticed the new option and switched to IPv6 preferentially. Amazingly that all worked and all my PCs were suddenly about to talk to the IPv6 net via Starlink! Google worked great, but I think sites that were IPv4 only weren’t working in this Frankenstein configuration. I don’t normally use IPv6 ever.
The public address the rest of the Internet sees when I’m on Starlink is 206.214.236.64 at the moment. That’s a tiny little block that belongs to SpaceX: 206.214.236.64/27, or 32 addresses. Presumably they have more blocks?
I think I’m going to be living with this opt-in configuration for awhile. Right now I have to go statically configure every device I want to swap over; my desktop, my game console, my Roku... It’d be better if I had a smarter DHCP server that I could direct to give out a different gateway depending on who is asking. Pretty sure Ubiquiti’s DHCP server can’t do that, but I bet some Linux option is flexible enough.
Alternately I wonder if there’s a way to leverage VLANs to do this. Have one VLAN use one gateway, the other use the other. But I want my devices to all mostly be on the same LAN regardless, so that doesn’t make a lot of sense.
Static route for Dishy at 192.168.100.1
Dishy itself is set up kind of like a cable modem. It runs DHCP on its output port (the one plugged into the WAN) and is handing out an address like 100.65.6.117 with a big fat netmask of 255.192.0.0. Gateway is 100.127.255.0. Turns out that’s a reserved shared address space, a special IP block kind of like 10.* or 192.168.* but reserved specifically for the needs of carrier grade NAT. Yup, Starlink is CGNAT, in addition to your home NAT. (But see also IPv6).
Dishy also is listening on 192.168.100.1; that’s where all the diagnostic services live. (More on that later). That means it’s handy to set up a static route for that. Here’s how I set it up in OpenWRT on the Starlink router at 192.168.3.233 so that any device using that as its gateway could talk to Dishy.
Static route on OpenWRT
I tried adding a similar static route for 192.168.100.1 on my Ubiquiti main house router (with a gateway of 192.168.3.233). But while that route works locally on the Ubiquiti machine itself, nothing else in the house seemed to work right with it. Not sure what’s going on; packets for 192.168.*.* seem to be routed out my WAN interface and into my ISP! That’s not right and I have no idea why it’s happening.
On my Linux server I managed to connect directly to the Dishy diagnostics by doing this:
ip route add 192.168.3.0/24 dev eno1
ip route add 192.168.100.1/32 via 192.168.3.233
Weird I had to add the ethernet route for my subnet first! If I didn’t do that I got “Error: Nexthop has invalid gateway” because the routing table had no idea how to get to 192.168.3.233. This was the routing table my Linux box had before I touched it:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.3.1 0.0.0.0 UG 0 0 0 eno1
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
If I read that right all packets out of the Linux box were sent to the router, even for other hosts on the same LAN. Ping timings confirm that. That’s unnecessary, right? Adding an interface route for the LAN seems the right thing. I didn’t make any of this permanent; doing so is going to require messing with Ubuntu’s hideous network config mess.
Performance
Overall speed is highly variable; sometimes I see 20 Mbps, sometimes I see 150 Mbps. I don’t have a good feel for what’s causing that yet, need to collect more data. Here’s a DSL reports speed test I ran just now. (Hilariously you have to lie and say you’re on a WISP; it refuses to believe something this low latency is satellite). Note the upload speed was 40Mbps for the first half of the test.
153 Mbps down, 15Mbps up
Latency is also very good, better than my ISP. I left a ping to 8.8.8.8 running for about 3 hours last evening and got these results”
However.. I sent 11758 ping packets and only got back 11482 responses. That’s 276 lost packets, or 2.3%, or about one a minute. That’s not great. Using my desktop interactively I’ve noticed a few small periods of the network not working, web page loads failing. The Starlink mobile app shows little outages in that period too. So that’s no good. I have yet to determine if TCP connections break in these outages or if they just get paused for a few seconds.
Update: see below about TCP connections. More testing reveals a packet loss of about 1-2% over long period of time. Compare 1.2% for my WISP during the busy evening when it’s congested. The difference with Starlink is when there’s an outage it’s typically like 5 seconds, not just a single packet.
There were 21 pings that took longer than 100ms, and 5 that took longer than 1 second. Worst was 2088ms.
Histogram of ping times
So that’s some preliminary stats; I’m very impressed. We’ll see how it feels after a few days of regular use. I also have a whole ‘nother blog post coming with more detailed information gathered from Dishy’s own diagnostics. Apparently there’s a whole gRPC server there folks have reverse engineered, so you can get the same data the mobile app shows.
Speaking of which, here are some screenshots from the mobile app:
Bottom Line
(Update after most of a day of using Starlink as my ISP)
It’s impressive. It works well. It definitely has some outages right now that make it not suitable today for a 100% reliable Internet connection. I trust these will be fixed in the next few months as they launch more satellites. Web surfing, etc mostly worked fine; occasionally I’d get an error that a page couldn’t be loaded and then when I reloaded a few seconds later it worked fine. Continuous sessions did not work well; I got booted out of World of Warcraft like 4 times in an hour. Unacceptable. I also couldn’t keep an idle ssh session open, probably because of aggressive NAT connection expiration but maybe for other reasons. I haven’t tried Zoom yet but I’m guessing it’ll will have to reconnect.
Update 2: continuous sessions work better than I thought. Idle ssh connections drop after 10 minutes, but put even modest trafficon them and they last hours. So do unadorned netcat client/server connections with traffic. WoW does disconnect when there’s momentary Starlink outages but that may well be WoW’s doing, deciding if it hears nothing after a few seconds the game is down. Zoom worked fine through the outages; I’d get a few second hang but the call would resume immediately with no trouble.
I ran a naive ping monitor to 8.8.8.8, 1 ping a second. Over 5 hours I sent about 18,000 pings and 126 failed; 0.7% rate. That doesn’t sound bad except the failures correspond to outages where the whole network seemed down, it wasn’t just a hiccup.
Bottom line; it works great for streaming media and loading web pages. Real time interactive stuff suffers a bit. Latency is excellent, it really is the 20-50ms advertised. But occasionally the link goes down for 4 seconds and sessions fail.
Why does the link go down? It’s the beta period; Starlink says this is expected behavior. Dishy’s stats says I’ve had 3 minutes downtime from obstructions, 45 seconds because of lack of satellites, and 3 minutes “beta downtime”. Looking closer I think all of that downtime will stop happening once there’s more satellite coverage. At least, I hope so. I’ve been following along on https://satellitemap.space/ and every outage I’ve experienced is correlated with a gap overhead.
I’m a little less clear why sessions go down. TCP is designed to handle packet loss, but his is acting like the TCP sockets are actively terminated when the link is down for just a few seconds. That seems completely unnecessary! I’d love to talk to a Starlink engineer to understand why. Update: after some more experimenting, basic TCP sessions don’t go down. Idle TCP sessions get cancelled after 10 minutes, a common NAT problem. And some applications like World of Warcraft seem to decide the link is dead when Starlink has a 5 second outage. But active ssh sessions and simple netcat servers persist through the short Starlink outages.
I’m super excited about this new service. I’ll keep using it daily for awhile and see how it feels. Also curious now about bonding with another ISP link for more reliability. Speedify looks promising.
My house is just east of the Arbuckle ground station
Updates (March 18)
Since writing this post I’ve been using Starlink more and more and made some changes to make it easier.
My Linux server and my Windows desktop now route through the Speedify VPN. This bonds Starlink with my second ISP link to make a more reliable Internet connection.
I’ve set up isc-dhcp-server on my Ubuntu box to serve DHCP and have it handing out special Starlink gateways to hosts based on MAC address. No more manual configuration of each machine! (Fun fact: Roku devices are incapable of having their network adapters configured without DHCP.) There are more sophisticated ways to do this using the “class” configs, but this works for something simple.
I bought myself an AxiDraw pen plotter. Inspired by the work of my friends Joshua Schachter and Michal Migurski, not to mention the wide world of #PlotterTwitter, I figured I’d take a turn at doing some pen art. It’s been a long time since I programmed any original generative art of my own and I’ve never really worked with pens and paper, so it seemed fun. Here’s my first work.
Yes, its dicks. A lot of people’s first plotter piece is small multiples of things with slight variance. But why draw lots of circles when you can draw lots of dicks? I confess I still have the sense of humor of a 12 year old. Also I like dicks. I had in mind Keith Haring or something when planning this although I’ve quickly found owning a fancy plotter and knowing some Python does not make you Keith Haring. His dicks are so charming!
Learned a lot doing this. Most of it is about the fussiness of pen on paper. Pens all have different rates of ink flow and papers have different absorbancy. I was doing my first tests with sharpie on cheap printer paper which bleeds all over the damn place; the moment the pen dwells for even half a second you get a big blob. This is a somewhat inexpensive Lamy Safari Fountain Pen, a classic beginner fountain pen. Writes like a dream; I may switch to it for ordinary writing too! Good for thin precise lines. I also bought a whole bunch of other kinds of markers and pens including some meant to simulate watercolors.
The AxiDraw is a neat device too. It’s basically a metal framework with two very high precision servos (2800 dpi!) to move the pen to any X, Y coordinates. Also a simple pen-up/down device to lift the pen off the paper or let it rest on its own weight. That’s it; no pen pressure, no paper movement. Just pen up/down and move to x, y. It comes with an Inkscape plugin that can draw any SVG file you give it, and from that you can draw pretty much any vector graphics. The SVG interpreter has some limits; no masking. There is sort of hacked on support for text fonts and for fills, although really it’s about drawing lines.
This first piece I did in PyCairo, the classic drawing library. I don’t have much love for it. It’s very confusing about when you’re working in relative vs absolute coordinates and it has some vesitgal confusing path building thing that makes drawing arcs more confusing than it has to be. The big strength of PyCairo is you can draw in high level code and then render to SVG, PDF, various raster formats.. And it rasterizes beautifully. I don’t need all of that. My plan now is to re-write my dicks thing in a lower level SVG framework, maybe svgwrite. I want something like D3 for producing SVG drawings, just a little DOM manipulation help. An alternate approach is to do everything in Shapely, make an object scene graph. Shapely has SVG rendering support.
Beyond that I have a host of other arty projects in mind. Bringing in geographic data is an obvious thing; may be time to revisit my old watershed maps, rivers, even just a simple OSM map renderer could be fun. I’m hoping to get inspired by the messiness of the ink medium, I’ve seen some neat work from other artists that really leans into the aesthetic of slightly scratchy lines of slightly bleeding ink.
Thinking seriously where I will install my Starlink. I have an existing antenna mount that was for an old fixed wireless system that’d’ be perfect. But it has some obstructions to the north. From what I’ve read on /r/starlink obstructions are definitely a problem. They translate into short outages where you have no Internet. It’s still OK for bulk downloads, they just resume after the 15s outage. But I’d find that absolutely intolerable myself, particularly for anything interactive. That’s been my experience so far with a temporary ground installation. The roof mount will be better but not a lot; the ground install is experiencing 2 minutes of obstruction outages frequently.
The obstruction cone is going to get smaller over time as they add more satellites. I expect it’s worse down where I am at 39N, which is about as far south as they advertise service right now.
Here’s the worst of the obstructions. These trees will be good and leafy in a few months. And they’re right to the north, the worst place to be. Note the stuff in the dark grey area isn’t a problem, that’s below Dishy’s field of view. But everything above is.
The existing antenna mount. The pipe facing up is between 1 1/2″ and 2″ in diameter (it’s no longer round).
And a fun photo of my old 1 Mbps fixed wireless link (that was on that mount) with Dishy.
The flat platform that the bottom half of that mount is welded to is 5″ x 7″. The bolt holes are inset a small amount, roughly half an inch? I was wondering if I could use Starlink’s Volcano mount to mount to it. Their plate is bigger, 6″ x 9″. But I think I can drill holes to match my 5x7 mount; the plate bulges out to meet the pipe but it looks like there’s enough room. Willing to take the $24 risk at least.
BTW SpaceX is not providing detailed engineering drawings of all this mounting stuff. Dumb! There’s some fairly precise measurements of the pole in this reddit post. Here’s some dimensions on the Volcano mount. Also a popular photo set, someone measuring the stuff with calipers and displaying all the measurements upside down.
First impression on setup is mixed. The unboxing experience is fantastic. Setup is super easy; it’s all pre-plugged in, you just power it all up, wait for Dishy to acquire a connection in a few minutes, and connect to Starlink’s router. That all kinda worked for me. In reality though I had trouble finding satellites the first time, so after 10 minutes I moved it. While I moved it Dishy got unhappy and rehomed the dish. Fair enough, but then it stopped responding entirely. So I power cycled it and let it do its thing and ignored it for awhile. It told me it had an hour of uninterrupted decent connection. Great! First speed test on their suggestion of fast.com was 150/? Mbps, but second speed test on DSL Reports was more like 60/30. Fast again was 75. I looked and now Dishy was telling me there were obstructions. Given the obstruction is a tree with no leaves, I can imagine why it’d be inconsistent. Anyway, it all left me feeling like I can’t quite trust it. Then again I don’t trust anything wireless.
Speaking of wireless, Dishy has one big wire. A heavy shielded ethernet cable coming out of it, 100 feet. And it is hardwired, you cannot remove it. That needs to be plugged into a special PoE injector that has AC power. That injector has an ordinary jack for the second cable, the one that goes to the router. (Although apparently it is also PoE). The crazy thing is Dishy is drawing 100 watts; it’s a heavy thing and it has a motor to tilt. 100 watts is an awful lot for Power-over-Ethernet! The subreddit discussion says it’s a proprietary thing too, not like any other PoE.
Starlink ships a router device which by all accounts is not very good. It’s only minimally configurable. Apparently it also isn’t up to routing traffic as fast as you’d like; folks report their networks are faster without it. The good news is there’s no need to use their router. Dishy works more or less like a cable modem; it has a little DHCP server handing out a 100.78.*.* address (subnet mask 255.192.0.0). Most any router can use this if you plug Dishy into your WAN port on a regular router. Note that Starlink is using carrier grade NAT inside their own network, so most situations are double NAT.
The beta reality today is not great. They just opened up to Northern California (I’m at 39N) and coverage is not perfect, so you have a few minutes downtime a day. Maybe more because of system maintenance. So you can’t really use it as your primary ISP 24/7. I’m currently planning on hacking up some networking config so I can use it as an opt-in basis when I’m willing to put up with the unreliability. All this is promised to improve in just a few months as they launch more satellites.
Obstructions are a real problem for a proper installation. You have to put the dish somewhere with an unobstructed view of the north sky. That’s a 100 degree cone, so even though the tall trees are 20+ feet north of me they’re somewhat in the way. I imagine most rooftops in suburban areas will be OK, but now you’re mounting a dish on the roof. And Starlink has no installation support; you’re on your own. They do have a mobile app with an augmented reality camera display telling you whether your chosen spot is OK. (It’s confusing; wave it around to where it shows you errors like “turn left”, then start looking for the dark grey areas in the AR view. It doesn’t care about those. You want all the non-greyed-out areas in the AR display to be clear of obstructions. You need to move a lot to test everything.) The good news is the device will still work with some obstructions and the obstruction story is getting better as they add more satellites. The bad news is obstructions near the horizon are the worst, which is of course exactly where they are most likely to be.
I think it’s real strange they’re selling this service without any sort of support. They just ship you the dish in the box and say “good luck”. It’s mostly easy enough but mounting that dish with a good clear view is not something most homeowners are going to know how to do. I hope they have some sort of service or reseller program for ordinary folks who don’t know about dish mounts and running cable through their walls. I’m going to hire someone local who has experience installing WISP antennas and/or satellite dishes.
Overall despite a little rockiness at first I’m pretty excited about Starlink. I’m thrilled to finally have an alternative to fixed wireless in Grass Valley. The service plan on paper is good: 100 Mbps or more down, 50 Mbpsish up, 20ms latency, no data cap. $100/mo with a $500 initial cost. Compare to my WISP which is 12/2, 50ms latency, and also $100/mo. Looking forward to the competition!
Today I spent 30 minutes trying to get the exact right USB cable. I bought a USB 3.2 gen 1 external hard drive I want to plug into a Type-C port on a PS5. The best match cable I could find is a USB 3.1 gen 2 cable.
Here’s where it gets complicated. The cable is Micro-B Superspeed to Type C. That’s the big Micro-B with basically two cables; not the single small one. The cable has “SS 10” printed on it which is a promise it’ll do 10Gbps. I’m guessing the drive is USB 3.2 Gen 1x1, which is SS 5 or 5Gbps. There’s a chance it’s USB 3.2 Gen 1x2 which is 10Gbit but is not called SS10. In that case the USB 3.2 Gen1x2 device is probably not 10GBps compatible with the USB 3.1 Micro-B SS/10 cable. It should presumably fall back to 5 Gbps.
Given the drive is spinning rust, a 5 Gbps interface is about 50x faster than necessary.