Xavier Olive research teaching python blog til cli

The monthly digest #09

8 December 2019

It has been such a long time since last time I wrote a “monthly” digest that I feel a bit guilty about this naming. Past weeks were rather crazy and I am happy to see things cool down for this month, so let’s not think too much about how we name this page. Here goes:

Programming

Call me old school, but I stick to this 80 character per line rule when I program or write in my favourite text editor. Nick Janetakis seems to agree with me.

Digging a bit into Python source code, there is long memo about a particular sort called now “timsort”. Enjoy reading about benchmarking basic sorting algorithms taken right out from Algorithms 101, what I expect to read from scientific articles, all in plain text! ;)

Talking about Python, Lisa Roach did a nice talk about how to extend GDB for debugging Python. Slides are here, am still searching for a video of the talk.

Other topic, other slides. Ange Albertini takes us into the mysteries of the PDF format. More visualisation materials about many binary formats are available on github corkami/pics.

Writing tests takes time, and as we are all lazy, we miss a lot of cornercases. Static typing, and solutions like mypy in Python help finding errors, but not writing better tests. Hypothesis looks like a good option for generating relevant unit tests. I did not have the opportunity to try it yet, but that’s somewhere in my todo list.

I still like Vim. Even teach Vim. But now that I gave it a try to Visual Code, I take it to students. Shame me, I used to ignore students’ need for a decent UI by saying “do whatever you want”. I tried recently a full Python course and twisted students’ arm into using code, and I believe it was a success.

Here is my current plugin configuration: ms-python.python is installed automatically upon first edition of a Python file. ms-vscode-remote.vscode-remote-extensionpack enables a smooth and transparent remote edition. Forget about fuse ssh mounts. vscodevim.vim, because of course. esbenp.prettier-vscode helps with the formatting and I still have to try MarkLarah.pre-commit-vscode for my most advanced projects.

Programming is also about music and generative music. There are some excellent references out there. Maybe I’ll just try an interactive notebook in my style on this webpage one day. In the mean time, you may check this one for a first explanation, and this presentation using tone.js.

Other (potential) side projects for fun things to try when I have free time again to play with Software Defined Radio: a full tutorial for weather satellite reception and a nice step-by-step Python code for VOR decoding.

Visualisation

A notable book addition Fundamentals of Data Visualization with excellent examples, all written using the R language but without any programming inside.

This github uwdata/visualization-curriculum gathers many valuable dataviz Jupyter notebooks. Note also the release of kepler.gl for Jupyter Lab last summer!

Some nice visualisations randomly found over the net: a reworked map of Paris subway system by Jug Cerović, probably better than the original, and this New York Times essay on rising seas and cities under water.

Finally, do not miss this interview with Mona Chalabi who does great work at dataviz with political and societal motivations. Hats off!

Typefaces

A guide to recognising font styles. You probably know by now about serif, sans serif and monospace. Now you probably should know who Garamond is, why some fonts are Grotesque and the history of Futura. Not so unrelated, do not miss this TV series about Bauhaus if you can still make it when you find this page.

A nice finding of the summer was Chris Gaul’s Medium with two papers about how prisoners in Hong-Kong work on the city’s signages and give them a unique touch and another one about Satō-san making Japanese characters with duck tape

Miscellaneous

Finally, just ignore it for the time being: this is just an example of a jq piece of code I wrote that happens to be the most complex I did until today.
The data comes from the ICAO API data service.

jq '.[] | select(.airportCode | startswith("LFB")) |
{icao: .airportCode, city: .cityName, airport: .airportName} |
join (", ")' airports.json

which returns

"LFBO, Toulouse, Blagnac"
"LFBT, Tarbes, Lourdes-Pyrenees"
"LFBP, Pau/Pyrenees, Pau/Pyrenees"
"LFBH, La Rochelle, Ile De Re"
"LFBI, Poitiers, Biard"
"LFBZ, Biarritz, Bayonne-Anglet"
"LFBD, Bordeaux, Merignac"