Notes for Week 14 of 2021

My first full week off! I wanted to go into wider library gardening, but mostly got sucked into my Graveyard. The following weeknotes are going to be Python and MySQL focused. I also spent quite some time catching up with friends and ex-colleagues. Apparently, not everyone is completely worn down by video calls yet.


  • I’ve walked 28 km and rode 31 km. I’ve been active for 9.6 hours during 8 activities. This week’s max speed was 58.7 km/h.
  • I order to write the sentence above, I wrote few hundred lines of code based on HJ’s code. Worth it.
  • Learned about squoosh: Make images smaller using best-in-class codecs, right in the browser.
  • I started working with a new editor again, one that creates a hidden subfolder in every project. On a brand new computer, so I had to relearn the ignore setup:
    • git config —global core.excludesFile '~/.gitignore'
    • echo "/.editorfolder" >> ~/.gitignore
  • Google is running fuzzer as a service for select open source projects. Sounds very useful
  • Titles you put into airline reservations matter! „Miss“ apparently means you are closer to a kid than an adult in terms of weight and if that assumption fails, well, you may crash and die. Do not lie, people!1
  • I discovered CSS grid-template-areas. Super cool and readable! Understanding less and less what people need CSS frameworks for
  • I really enjoy this local alias:
alias rdocker="docker \
  --tlsverify \
  -H=mynas:2376 \
  --tlscacert=/Users/almad/.docker/daemon-certs/ca.pem \
  --tlscert=/Users/almad/.docker/daemon-certs/server-cert.pem \

This allows me to have only Docker CLI installed and run all docker commands on my NAS using TLS authentication. Great for occasional running of heavy images where you don’t want to care about storage.

  • This image from Margin gave me a pause. Are we getting to the point where new code will be written exclusively by data?

Garmin and Strava

I first wanted to clarify that this section is not, I repeat NOT driven by one of my siblings getting a Garmin watch and being ahead of me in points just after few months. I am a mature adult who’s not going to be manipulated by an arbitrary number and stupid gamification. I haven’t subscribed to all even remotely attainable challenges and this coding was not aimed at me keeping tabs. GAME’S ON ☠️ 2

  • Garmin rejected my API request because their API policy asks for „no personal use“. Wat. In addition, the support said that getting the data from the web version of Garmin Conect is a violation of Terms of Service. Whatwat. So I’ve learned how to make proper Data Subject Access Request (DSAR), send it to the fellow local EU Data Privacy Officer and will take it from there. In case you’d want to do the same and would like to skip support forms, the contact is
  • As a consequence, I’ve learned that no, you can actually get reasonably structured data using the email protocol. Go to account page, request data dump, get a link in your email. The downloaded files are nicely structured JSONs. In theory, you should get data from the device using FIT SDK, in practice that only contains activity data, not “wellness” data (like heart rate during the day or steps taken)
  • Strava API doesn’t support Proof Key for Code Exchange and hence for CLIs you need to work with the standard grant flow. I took it as a challenge and wrote a small library that correctly stores secrets and handles refresh tokens for CLI using keychain. Probably worth writing a blog post about


  • I had an old table:
mysql> describe mytable;
| Field    | Type        | Null | Key | Default             | Extra          |
| id       | int         | NO   | PRI | NULL                | auto_increment |
| datum    | datetime    | NO   |     | 0000-00-00 00:00:00 |                |

That would be a nice little table back in MySQL 3 times, but that datetime is no longer valid. I was able to change it to some arbitrary date, but then

mysql> describe mytable;
| Field    | Type        | Null | Key | Default             | Extra          |
| id       | int         | NO   | PRI | NULL                | auto_increment |
| datum    | datetime    | NO   |     | 1992-12-31 23:00:01 |                |

mysql> ALTER TABLE `mytable` MODIFY `datum` datetime(6) NULL;
ERROR 1292 (22007): Incorrect datetime value: '0000-00-00 00:00:00.000000' for column 'datum' at row 2230

What? Well, if you do select * from mytable, output row 2230 has an invalid entry in the datum field, ’0000-00-00 00:00:00.000000'. Took me a while to figure that one out.

  • From Django, I got OperationalError at /url/ (1038, ‚Out of sort memory, consider increasing server sort buffer size‘); this was new to me. It can be fixed by SET GLOBAL sort_buffer_size = 2560000000 in mysql console or sort_buffer_size = 2560000000 in mysqld.conf. I hit it while sorting a table with 403 rows. Of course, it happened because indexes were wrong and there was a full table scan.

Python & Django

  • In Django, you can use context_processors to inject „universally accessible“ into templates. This does not work transitively into the template tags you are using. Even if you set takes_context=True for them, you have to manually return variables you care about, although you can of pass through **context. Use include template tag if you need the context auto-delegation
  • My old Python habit of using check_call is obsolete, run is now the way
  • Python packaging guide has gotten much better over the years, although Python packaging experience is still…suboptimal

  1. I am not sure what to say here. Just imagine a burst of maniacal or hysterical laughter ↩︎

  2. Only my sibling of course. Their partner who’s casually running half-marathons after work is obviously cheating and not a worthy opponent ↩︎

Published in Notes and tagged

All texts written by . I'd love to hear your feedback. If you've liked this, you may want to subscribe for my monthly newsletter or . You can always return to home page or read about the site and its privacy handling.