Dataclasses and Type Hints
Yesterday I rewrote the Python version of tumblelog to use
dataclasses. I also started to add type hints, which I finished today.
I pushed version 6.2.0 of tumblelog to
GitHub after thoroughly
testing the new code.
Yesterday I rewrote the Python version of tumblelog to use
dataclasses. I also started to add type hints, which I finished today.
I pushed version 6.2.0 of tumblelog to
GitHub after thoroughly
testing the new code.
While testing tumblelog I came upon an issue with the calendar
overview for 2026: May
and later had no entries. After some checking I found the bug: the
Markdown file for Plurrrr had two times a date entry for the
24th of May! So i updated both the Perl and Python version
of tumblelog to detect this issue and pushed 6.2.1 to
GitHub.
Baron "Bear" Bailey breaks a novelty charm to force his co-worker Nikki Freeman to love him, but the supernatural compulsion warps her mind into violent obsession, trapping him in a nightmare he cannot wish away.
In the evening Jaiden and I watched Obsession. Jaiden liked the movie a lot, she called it the scariest movie she had ever seen. I liked the movie and rate it a 7 out of 10.
In the evening I pushed a lot of small cosmetic code changes I had
made over the past days to tumblelog to GitHub. Well, first I had to
pull 2 commits I had made via the GitHub site because of a patch by
Jan Neduchal. I used:
git pull --rebase
To get those 2 commits and to replay my 25 new commits on top of those 2. The updated version is now available on GitHub.
Orbiting a planet on the brink of war, scientists test a device to solve an energy crisis, and end up face-to-face with a dark alternate reality.
In the evening Jaiden and I watched The Cloverfield Paradox. Jaiden didn't like the movie and mostly didn't watch. I think the movie is OK, I watched it for the second time, and rate it a 6 out of 10.
Discover the unforgettable tales of one of science fiction and fantasy’s greatest authors in this bundle of Tanith Lee ebooks from DAW! Meet a Martian vampire desperate to evade the prying eyes of a private detective in Sabella. Follow people living on the dark side of a planet that might be about to contact another civilization in Day by Night. Explore the mysteries of a medieval-inspired world with a reluctant goddess in The Birthgrave. There are 26 books in total in this bundle from the master fantasist, so grab them all now at the price of your choice, and support BINC with your purchase!
In the afternoon I bought the Tanith Lee Collection Humble Bundle, 26 books in total. It included favorites of mine like Kill The Death, Tales from the Flat Earth, The Wars of Vis, and The Birthgrave Trilogy. Sadly, The Blood of Roses is not included, a book I really would like to reread.
After I mentioned a Jurassic Park anecdote the other day, I watched the movie again. I must have seen it at least ten times now. This time, I researched every computer/software I spotted.
Source: Jurassic Park computers in excruciating detail, an article by Fabien Sanglard.
In the early afternoon I watched photos of hardware used in the Jurassic Park movie. Because I owned SGI hardware in the past it was a little trip down memory lane.
Each time I open in vim my freeCodeCamp Python course notes, which is a
Markdown file, it starts folded. I prefer to see the entire file at
start up so I added the following to my vimrc:
autocmd BufRead *.md normal zR
With zR meaning: open all folds in the file. The opposite is zM.
While editing I prefer to toggle folding with za.
Peter Parker tries to stop Adrian 'The Vulture' Toomes from selling weapons made with advanced Chitauri technology while trying to balance his life as an ordinary high school student.
In the evening I watched Spider-Man: Homecoming. I liked the movie and rate it a 7 out of 10.
A supernatural entity reemerges to terrorize a family when the lights go out at night.
In the evening Jaiden picked Lights Out to watch together. I liked the movie and rate it a 7 out of 10.
Yesterday I learned how to change the margin of the PDF file Pandoc generates. But I forgot about the paper size. I live in the Netherlands and A4 is the common format here. First, I wanted to know how to check the current paper size of a PDF file. This can be done on the macOS command line as follows:
mdls freecodecamp.pdf |
grep -i page
This reports the number of pages, the height (792 for US letter) and width (612 for US letter). The values are in PostScript points; 1" equals 72 points or 8.5" × 11" for US letter.
How to change this? Well, it turns out that with one Pandoc variable one can control both the margin and the paper size:
-V geometry="margin=1in,a4paper"
So the command for generating the PDF via Pandoc in a Docker container and viewing the output in the Preview application on macOS becomes:
docker run --rm \
-v "$(pwd):/data" \
-u $(id -u):$(id -g) \
pandoc/latex freecodecamp.md \
-V geometry="margin=1in,a4paper"\
-o freecodecamp.pdf &&
open freecodecamp.pdf
Checking the dimensions with mdls reports 841.89 points ×
595.2760009765625 points which matches the dimensions of an A4 page.
In the evening I wanted to know at what time exactly I had run a
specific command on the command line of macOS. Could I get the history
of commands entered on the command line with each a time stamp? The
answer is yes, with fc (Fix Command):
fc -li 1
This lists (-l) the history from the start (1) with time stamps in ISO8601
format (-i). Note that without the 1 you get the last maximum 16
commands.
Now I could grep the output of this command. But wait, fc comes with
a match option (-m):
fc -li -m 'docker*' 1
This lists all events in the history that starts with docker and
shows the ISO8601 time stamp.
Today my copy of Effective Python Third Edition arrived. The book by Brett Slatkin has 125 specific ways to write better Python.
I browsed the book a bit and it looks very good! I like how the program listings have colors. After I have finished the Python Certification course on freeCodeCamp I want either start in this book or continue with the 2nd edition of Fluent Python by Luciano Ramalho. I have reread the first two chapters of the latter. Quite some time ago I managed to study the book until about halfway. But I want to redo this.
Yesterday I learned how to generate a PDF file with the official
Pandoc LaTeX Docker image on macOS. The resulting PDF looked good, but
has a huge margin around the body of text. Today I created a
header.tex file with the following contents to be passed on to LaTeX:
\usepackage{geometry}
\geometry{margin=1in}
Next, I ran the following command:
docker run --rm \
-v "$(pwd):/data" \
-u $(id -u):$(id -g) \
pandoc/latex freecodecamp.md \
-H header.tex \
-o freecodecamp.pdf &&
open freecodecamp.pdf
And with this command the margin was shrunk to 1"; much better.
Last week I started with the Python Certification course on
freeCodeCamp. I keep handwritten
notes on paper which I transfer later to a Markdown file using vim.
I wanted to convert this Markdown file to a PDF file using Pandoc. Because I have already Docker running on my Mac mini I checked if there was an official Docker image.
I first tried the Pandoc
minimal image. I ran into
an issue: Permission denied. Adding -v /tmp:/tmp to the command
solved this issue, but now it reported 'pdflatex' not found. This
version was too minimal!
So, next I tried the aptly named latex image as follows:
docker run --rm \
-v "$(pwd):/data"\
-u $(id -u):$(id -g) \
pandoc/latex freecodecamp.md \
-o freecodecamp.pdf &&
open freecodecamp.pdf
This downloaded the image (only the first time), generated the PDF and opened the PDF file in the Preview application on macOS.
In the evening Esme and I watched Enola Holmes. I liked the movie and rate it a 7 out of 10.
In the evening Esme wanted to watch La Casa de las Flores - La Película (The House of Flowers: The Movie). I didn't like the movie much, probably also because I haven't seen the TV series. I rate it a 5 out of 10.