Showing 29 links. See a condensed link blog feed.
Flexoki — Steph Ango by Steph Ango on 23-01-2025 01:03
Steph Ango, the author of Obsidian, writes about Flexoki in this link, “an inky color scheme for prose and code. Flexoki is designed for reading and writing on digital screens. It is inspired by analog inks and warm shades of paper.”.
From time to time I like to give my website a fresh coat of paint and I'm wondering whether I'll be using the Flexoki colour scheme or not.
I included the base colour palette here, for reference:
PHP Markdown Extra – Markdown Inside HTML Blocks on 22-01-2025 20:33
This page documents “Markdown Extra”, an extension of Markdown that I use on my website. I'm blogging about this because the section “Markdown Inside HTML Blocks” shows how to tell the Markdown parser that I have Markdown nested inside HTML blocks.
This is particularly useful because sometimes I like to include code blocks inside the HTML tag <details>
.
The link shows that I have to add the attribute markdown="1"
to the HTML tag that will contain nested Markdown and the parser takes care of the rest (and removes the attribute).
Here's a tag <details>
that uses the attribute in the source code:
print("Hello, world!")
Here's what the same HTML + Markdown combo will look like without the correct Markdown Extra attribute:
Rules for Writing Software Tutorials · Refactoring English by Michael Lynch on 22-01-2025 19:12
In this article the author puts forward 16 rules for writing good software tutorials:
All of these rules made perfect sense to me and some of them I already try to enforce in my articles. The suggestions that resonated particularly well with me were those related to making your tutorial as easily reproducible and as easy to follow along as possible. To this end, Michael suggests several tweaks I can make to my code samples that make life much easier for the reader, which should be my end goal any way.
I'm happy to say that I have already been doing things in this direction. For example, I used to include lots of snippets of Python REPL sessions, like this:
>>> x, y = 1, 2
>>> x
1
>>> y
2
However, this was hard to work with if you wanted to copy my code and run it yourself.
A small change I made was to start writing everything as Python scripts and use the print
function instead:
x, y = 1, 2
print(x) # 1
print(y) # 2
This is much easier to copy and run for yourself. Not to mention the “copy to clipboard” button I added to all code snippets!
Webring - Wikipedia on 21-01-2025 10:50
Today I learned about webrings, which were popular in the 1990s and 2000s. A webring is a collection of websites that are linked cyclically.
using Linear Programming to find optimal builds in league of legends - annieversary by Annie Versary on 21-01-2025 10:45
In this post, the author uses linear programming to solve an optimisation problem in League of Legends, a computer game. This post is a great example of how one can use a problem from “real life” (at least, for those who play the game) to introduce technical topics or concepts.
The problem being solved has to do with the fact that a champion needs to buy items that increase three of their stats so that the champion's abilities evolve. What is the optimal build to achieve this? In other words, what are the cheapest items to buy that grant enough of these stats for the evolved abilities?
The author proceeds to use Rust and a linear programming package to compute the solution and then goes on to discuss whether the optimal solution really is optimal, because when buying items you want to consider the various stages of the game, and not just the single moment when your abilities might evolve because of the items you bought. The author then poses relevant follow-up questions and possible ways of answering those solutions but doesn't answer the questions, leaving them “as an exercise for the reader”.
ChatGPT conversation to automate testimonials on 17-01-2025 22:14
Today I interacted with ChatGPT to create a page on my website where anyone can leave a testimonial for my work. When you submit the form, a custom Grav plugin runs to convert the form replies into a suitable format that I can display in the wall of testimonials.
Since I don't know PHP, I got ChatGPT to help me with this and in the end we got a working solution. Just head on over to the testimonials page and you'll see what I'm talking about.
More search, less feed (via) by Austin Kleon on 17-01-2025 14:10
This short article gets you to think about the differences between browsing a feed, like a news feed or the feed of a social media app, versus browsing search results.
When browsing a feed, you browse random stuff that was pushed to you by the people, companies, and organisations that published those pieces of information. Typically, you didn't ask for that info on those topics; an algorithm just decided to present it to you.
On the other hand, when you are searching, you make a concrete decision of what to search for. You browse results of your search. You decide what to read and what not to read. You played a part in what information is shown to you.
“Livewired” book on Goodreads on 16-01-2025 23:45
I enjoyed learning more about the way the brain works and how it adapts and evolves. As an example, I enjoyed learning about all of the different ways in which people tried to overcome sensorial shortcomings they had, and how some tried to enhance their own senses, and the work that the brain puts in to start processing these new inputs and to make sense of them. As I understood, it looks like you can just “plug in” new inputs to your brain and your brain will learn to process them, much in the way it learned to process the input from your eyes, from your ears, from your skin, etc. It receives signals and as you interact with the world those signals change, so you learn useful associations, like hitting the door hurts or that petting an animal is nice. That's how I understood it, at least...
Welsh rarebit - Wikipedia on 15-01-2025 00:25
In Portugal there is a typical dish called “francesinha”, and the literal translation of the name “francesinha” means “little French woman”, which is a bit of a weird name for a dish. When I commented about this with a group of Frenchmen, and when I explained what the dish consisted of, they remarked “Oh, that sounds like the Portuguese version of a Welsh”.
After Googling for a Welsh and after finding out it's kind of similar to a francesinha, I find it amusing that the Brits and the French eat a dish called “Welsh” and we eat a vaguely similar dish called “little French woman”.
Masonry layout - MDN web docs on 14-01-2025 23:50
I was trying to implement a pure-CSS masonry layout for a page of my site where I'd display reviews and testimonials and I found the this masonry layout page, but apparently it's a very experimental feature. At least, at the time of writing this. You can get this in Firefox by manually enabling a flag and Safari has experimental support for it, but it looks like all other major browsers don't even support this in any way, shape, or form.
Jupytext documentation on 13-01-2025 20:56
Jupytext is a brilliant tool that I've used in the past to keep jupyter notebooks in sync with plain-text versions of those same notebooks. If I recall correctly, I used jupytext to keep Jupyter notebooks in sync with Markdown files that contained the same content.
I plan on using this again in the future to write a couple of books. For some of them, it's easier to write them as jupyter notebooks but then I need to convert those into markdown files so that pandoc is able to do its job converting the files into an ebook.
ELIZA effect - Wikipedia (via) on 12-01-2025 13:35
The ELIZA effect, named after the ELIZA chatbot, is the “tendency to project human traits — such as experience, semantic comprehension or empathy — onto rudimentary computer programs having a textual interface”.
With LLMs on the rise and with their usage spreading among non-technical people, I have a feeling that fighting this ELIZA effect will be both crucial and impossible. If the ELIZA chatbot was as basic as it was and it managed to affect its users in such a way that they named the effect after the chatbot, I can't imagine what LLMs will do to the general population...
#!/usr/bin/env -S uv run (via) by Simon Willison on 10-01-2025 15:43
I started using uv recently and I keep getting impressed by everything I can do in such a convenient way with uv.
I've been using uv to manage scripts and script dependencies but using the shebang #!/usr/bin/env -S uv run
in scripts and then making them executable (with chmod 755
) is on a whole new level.
Essentially, you want your scripts' header to look like this:
#!/usr/bin/env -S uv run
# /// script
# requires-python = ">=3.13"
# dependencies = [
# ...,
# ]
# ///
# code here...
If you think about it, what this means is that you get shell scripts written in Python with self-contained dependencies that uv manages for you...
Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions (via) by Nicholas Carlini on 10-01-2025 15:25
At the top of this article you are presented with a very basic rendering of a chess board and an input field where you're supposed to type chess moves:
Although this chess engine isn't very smart, since it fell for the Scholar's mate after checking me with a rogue bishop, the part of the engine that is computing what move to play is a series of 84,688 regular expressions... The full explanation of how the engine works is brilliant and is available immediately under the chessboard. For reference, I did beat the engine when I played 5. Qxf7#:
Never Split The Difference | Chris Voss | TEDxUniversityofNevada - YouTube (via) on 10-01-2025 11:16
This short TED talk by Chris Voss, author of “Never Split the Difference”, renewed my interest in his book. In this TED talk, he mostly talks about what he calls “tactical empathy”, the act of listening to others, trying to understand their feelings, and making them feel heard, without necessarily agreeing with what they are saying.
In this talk, Chris Voss tells two or three stories that show the value of practicing tactical empathy, whether with a terrorist – Chris Voss was an FBI hostage negotiator – or with someone from your family.
Reflecting on 2024: My Year in Books by Mia Bajić on 10-01-2025 11:12
I met Mia in a Python conference – possibly EuroPython – and was quite interested in seeing what she had read. My interest in her article increased when I realised she read some books that are in my "to read" list, like “Never Split the Difference” by Chris Voss or “How to Win Friends and Influence People” by Dale Carnegie. Reading her reviews also brought to my attention a couple of other books, like “TED Talks: The Official TED Guide to Public Speaking” by Chris Anderson.
Link blog in a static site (via) on 07-01-2025 17:02
One more “meta link” in this link blog, Redowan shares his approach to link blogging. Since he's using a static site, he has a markdown file where he blogs about all of the links for a given year. Then, somehow, the theme/tools he uses also turn that page into a nicer, shorter “feed” that allows to easily glance over all the links he blogged about.
This approach is different from mine. Since I have a dynamic website, I have a small markdown file per link and then the CMS I'm using (Grav, at the time of writing) takes all those short snippets and puts them together.
“Talking to Strangers” book on Goodreads on 07-01-2025 15:58
I picked this book up randomly in a Canadian bookstore thinking it was about the act of starting to interact with random strangers on the street or how to maintain conversations with people you barely know. The book isn't literally about that, but by the time my wife made her way back to me I was already hooked and I bought the book.
In my own words, and as far as my understanding goes, the book focuses on three main topics, namely
I enjoyed learning a bit more about human psychology and I found that most of the stories and examples shared of these principles in action, or of the rare counter-examples, were quite powerful... In the sense that they illustrate how things can go terribly wrong when we don't take into account the limitations we have when interacting with people we don't know.
Your Name in Landsat (via) on 06-01-2025 23:55
This page from NASA lets you type any word (they suggest you type your name) and the page will then spell out your name with satellite imagery from the Earth.
I gave it a spin with my name (Rodrigo) and with this website's name (mathspp):
Ready Player One book on Goodreads on 06-01-2025 23:50
“Ready Player One” came out as a movie directed by Steven Spielberg in 2018 and ignorant me thought it was just a movie. A friend told me it was inspired by a book and since I enjoyed the movie, he thought I'd enjoy the book as well.
I read the book and I enjoyed it even more than I enjoyed the movie. There were some clear differences, especially when it came to the progression of the Easter Egg hunt, which the whole book/movie revolves around. I preferred the challenges as written on the book, which appealed more to the geek in me, but I totally understand why they made the changes they made for the movie, which I think worked out quite well.
Next up on my reading list: “Ready Player Two”.
Can you prompt LLMs to admit when they don't know the answer? (via) on 06-01-2025 09:11
In this piece, Anthony Shaw talks about his attempts to make LLMs recognise their inability to answer certain questions and how, by default, LLMs will output a response that might look helpful even if it is complete gargabe.
The main example given was that of a game of Set where Anthony and his kid needed help determining whether there was a match or not, given a picture of the game. The LLMs prompted were very keen on creating garbage output, with most (if not all) mentioning cards that weren't even in play in the photo shown.
In the end, Anthony did manage to get better outputs by instructing LLMs to reply with a shrugging emoji in case they could not compute the answer reliably. (There is also a bonus snippet of Python code in the end that looks for matches programmatically. Maybe prompting the LLMs to write such piece of code would've been easier and more reliable.)
Duck Typing in Python (via) on 03-01-2025 17:35
I was preparing a webinar on typing (for the Python Mastery Guild) and I was thinking about duck typing and how to explain it. I had come to the realisation – which is kind of obvious in hindsight – that dunder methods are for duck typing. It's through dunder methods that you add the duck-like behaviours that matter to your own classes. Not surprisingly, Trey's article on duck typing presents the same conclusion in a later section of the article.
Write your Own Virtual Machine (via) on 03-01-2025 17:29
I have come to understand that I really enjoy learning about parses, compilers, VMs, and other things along these lines. For example, I really like implementing parsers. (I'm not sure why, though...)
I have very limited knowledge of C but it looks like the final program is simple and short enough (250 lines of code) that I'd be able to follow the full tutorial and implement it in C. I started reading it and the prose looks quite accessible, so if you're into lower-level stuff, give this a read!
Genuary 2025 (via) on 02-01-2025 13:56
The TL;DR is that this is a friendly challenge to get you to write computer programs that create generative art. They give you a guiding prompt for each day of January – which you are free to ignore – and then you share your creations online. I'm “pinning” it here as something I'd love to do but at the same time I don't consider essential enough to actually carve out the time to do it during January... Maybe I'll get to one or two...
Squared triangular number on 31-12-2024 19:05
With 2025 almost starting, I've seen a number of people talking about the fact that \(2025 = 45^2\), and since \(45\) is a triangular number, that gives rise to two fun formulas to compute \(2025\). First, since \(45\) is a triangular number, you get
\[ 2025 = 45^2 = (1 + 2 + 3 + \cdots + 8 + 9)^2 ~ .\]
The link to the Wikipedia page about squared triangular numbers also gives a beautiful geometrical demonstration that the formula above is equal to the sum of the cubes of the same integers:
\[ 2025 = 1^3 + 2^3 + 3^3 + \cdots + 8^3 + 9^3 ~ .\]
MacOS Setup Guide (via) on 30-12-2024 10:37
I've been using a Macbook for 2 or 3 years and there are things in this guide I'm doing/using already, but there are also other tips that I want to take a better look at and ponder about. In particular, the list of apps recommended and the customisation of iTerm2 look like sections I want to devote some time to.
Bron-Kerbosch algorithm (via) on 24-12-2024 17:39
This year I've been solving Advent of Code consistently and for day 23 I had to implement a small algorithm that finds clicks in a graph. My recursive function isn't particularly clever but stands at 5 lines of code:
def find_clicks(click, nodes, edges):
for idx, node in enumerate(nodes):
if click <= edges[node]:
yield from find_clicks(click | {node}, nodes[idx + 1 :], edges)
yield click
nodes
is a list of all the vertices in the graph and edges
is a mapping from vertex to set of neighoubrs.
Initially, call it with find_clicks(set(), nodes, edges)
.
The generator yields sub-maximal clicks but this was good enough for my purposes.
I was pleasantly surprised (but not too surprised) to find later that there is an algorithm that finds maximal clicks in a graph.
Link blogging with Grav on 24-12-2024 17:22
Keeping in line with the “meta” link blogging, this link should point to a series of interactions I had with ChatGPT to help me set up a new type of page that was suitable for link blogging.
My approach to running a link blog on 24-12-2024 17:14
I enjoy the stuff that Simon writes and in his newsletter he introduced me to a concept I didn't even know: “link blogging”. I decided to give it a try and so I thought it was only fitting to start by blogging about this link of his.
At least for now, I think I'll stick to a simpler workflow to see if I enjoy link blogging and in the future I might extend the way I go about this...