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.
Random
- 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 \
--tlskey=/Users/almad/.docker/daemon-certs/server-key.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 euprivacy@garmin.com
- 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
MySQL
- 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
mysql>
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 bySET GLOBAL sort_buffer_size = 2560000000
in mysql console orsort_buffer_size = 2560000000
inmysqld.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 settakes_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
Recommended Readings From This Week
- A Game Designer’s Analysis Of QAnon: Excellent analysis! Mostly talking about the role and consequences of apophenia
- MIT AGI: How the brain creates emotions (Lisa Feldman Barrett): Few gems hidden. I think conversations would be more interesting if Lex would be more generally curious and not steering to AI so quickly. There are no hormones that developed to regulate emotions. Brain just optimizes for its own survival. We are networked animals: our hormones regulate not just our brains, but also brains of other people
- On canonical hours, comfort, and daylight savings: DST origins in monasteries and as intentional discomfort
- Things your manager might not know: Excellent guide for managerial navigation for juniors
- Super Hostile Takeovers: Harberger tax value is an interesting concept
- Et tu, Signal?: Good summary of the Signal drama. One problem though: so what is the monetization scheme for a messenger app?
- The Church of Interruption: This is such a perfect observation! Discovered during a conversation with a friend about how both churches break down on video calls because the body language cues are delayed
- Time for Next-Gen Codecs to Dethrone JPEG: Good overview of the new codec options
- Sadly, You Can’t Print Your Own (safe) mRNA Vaccine: Future is not here yet.
- The ghosts in the data: Every field has ghost knowledge and Vicki lists some of them for working with data
- Security Researcher Hides ZIP, MP3 Files Inside PNG Files on Twitter: Download a valid image from Twitter, rename to .zip and voila!
- Magecart Attackers Save Stolen Credit-Card Data in .JPG File: Clever use of stenography
-
I am not sure what to say here. Just imagine a burst of maniacal or hysterical laughter ↩︎
-
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 Weekly Notes and tagged graveyard • mysql • Weekly Notes