Here’s my attempt at creating a useful Python script: a static site generator that converts a folder of Markdown files into HTML. This project uses Python 3.12, uv
for managing external dependencies, and supports either TOML or YAML front matter. We'll rely on mistletoe
for Markdown conversion and jinja2
for HTML templating.
The script makes use of the following:
- list for file handling
- pathlib for directory management
- dict for data storage
- f-strings for generating permalinks
Asianometry & Dylan Patel – How the Semiconductor Industry Actually Works - YouTube
The Complete Guide to Yakisugi (Shou Sugi Ban)
Python Programming Exercises, Gently Explained
What are some good python codebases to read? - Lobsters
The Composition Over Inheritance Principle
PyHAT-stack/awesome-python-htmx: A curated list of things related to python-based web development using htmx
miyuchina/mistletoe: A fast, extensible and spec-compliant Markdown parser in pure Python.
python: how to check if a line is an empty line - Stack Overflow
If you want to ignore lines with only whitespace:
if line.strip():
... do something
The empty string is a False value.
Or if you really want only empty lines:
if line in ['\n', '\r\n']:
... do something
Metaphor: ReFantazio - Rock Paper Shotgun
Rabbit Waves
Search for executable files using find command
answered by GreenGiant - Stack Overflow
On GNU versions of find you can use -executable
:
find . -type f -executable -print
For BSD (and MacOS) versions of find, you can use -perm
with +
and an octal mask:
find . -type f -perm +111 -print
In this context "+" means "any of these bits are set" and 111 is the execute bits. Note that this is not identical to the -executable
predicate in GNU find. In particular, -executable
tests that the file can be executed by the current user, while -perm +111
just tests if any execute permissions are set.
Create a new user who is a member of the same groups as the current user.
$ groups
users lp wheel dialout video audio render docker autologin
$ printf "%s\n" $(groups) | sort
audio
autologin
dialout
docker
lp
render
users
video
wheel
tr '\n' ','
translates the newlines into commas, converting the list of groups into a comma-separated string
sed 's/.$//'
uses sed (stream editor) to remove the last character (which will be the trailing comma from the previous step)
$ printf "%s\n" $(groups) | sort | tr '\n' ',' | sed 's/.$//'
audio,autologin,dialout,docker,lp,render,video,wheel
$ my_groups=$(printf "%s\n" $(groups) | sort | tr '\n' ',' | sed 's/.$//')
$ sudo useradd \
--comment "Hullo" \
--gid sudo \
--groups $my_groups \
--create-home \
--no-user-group \
newuser
# using short options
$ sudo useradd -g users -G $groups -m -N newuser

bieszczaders/kernel-cachyos Copr
CachyOS/copr-linux-cachyos
Frogging-Family/linux-tkg
MAKEOPTS=”-j${core} +1″ is NOT the best optimization
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 48 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: AuthenticAMD
Model name: AMD Ryzen 7 7700X 8-Core Processor
CPU family: 25
...
$ export MAKEOPTS="--jobs 8 --load-average 9"
CORDIC is an algorithm for computing trig functions like sin, cos, tan etc on low powered hardware, without an FPU (i.e. no floating point) or expensive lookup tables. In fact, it reduces these complex functions to simple additions and bit shifts.
githublog/2024/5/10/cordic.md at main · francisrstokes/githublog
On April 5th, xkcd released Machine, the 15th annual April Fools project I’ve made with them.
It’s a game we’d been dreaming of for years: a giant rube goldberg machine builder in the style of the classic Incredible Machine games, made of a patchwork of machines created by individual xkcd readers
Machine, Development notes from xkcd's "Machine"
From Caveman to Chinaman - Cremieux Recueil
Briefly, seasonality is primarily dependent on three factors. The first is the Earth’s tilt, or obliquity, which determines how hemispheres will be tilted towards the Sun in summer and away in winter. The other two factors are lesser-known, but they are nevertheless important. They are the eccentricity of Earth’s orbit, which is how elliptical it is, and the precession, which is about whether the Earth’s closest approach to the Sun happens in the northern or southern hemisphere’s summer season
Python Tricks: The Book
Sculpting a Python function - by Nobody has time for Python
Data Classes in Python 3.7+ (Guide) – Real Python
Make your own Tower Defense Game with PyGame • Inspired Python
Malcolm Gladwell and William Cohan on What Really Happened to GE
Life Lessons After 10 Years of BetterExplained.com – BetterExplained
‘Story Of Your Life’ Is Not A Time-Travel Story · Gwern.net
What “Drive My Car” Reveals on a Second Viewing
'Drive My Car' and 'Uncle Vanya': How Intertextuality Enriches a Film
Creating Isometric RPG Game Backgrounds - using Stable Diffusion techniques to create 2D game environments
Game Design Logs – LOSTGARDEN
Great game development is actively harmed by this assumption. Pre-allocating resources at an early stage interrupts the exploratory iteration needed to find the fun in a game. A written plan that stretches months into the future is like a stake through the heart of a good game process. Instead of quickly pivoting to amplify a delightful opportunity found during play testing, you end up blindly barreling towards completion on a some ineffectual paper fantasy.
A Skeleton Key to Ali Smith's Artful — The Airship, from the Wayback machine
The most beautiful thing about Ali Smith’s book Artful — at once a series of real-life Oxford lectures and a metafictional post-love story — is the way she carries us through her unnamed narrator's emotional progression
The Guardian review, theliterarysisters, #AliSmith
Google - We Have No Moat, And Neither Does OpenAI, discussion at Hacker News
Leaked internal document claims open-source will outcompete Google and OpenAI
the uncomfortable truth is, we aren’t positioned to win this arms race and neither is OpenAI. While we’ve been squabbling, a third faction has been quietly eating our lunch.
Development notes from xkcd's Gravity and Escape Speed #gamedev
Escape Seed is a large space exploration game created and drawn by Randall Munroe.
This was one of the most ambitious — and most delayed — April Fools comics we’ve ever shipped. The art, physics, story, game logic, and render performance all needed to work together to pull this off. We decided to take the time to get it right.
The game is a spiritual successor to last year’s Gravity space exploration comic. Our goal was to deepen the game with a bigger map and more orbital mechanics challenges to play with.
Andreas Fragner - Writing summaries is more important than reading more books
Ted Chiang's essay - Will A.I. Become the New McKinsey?, comments from Schneier on Security. previously, Ted Chiang - ChatGPT Is a Blurry JPEG of the Web
Out of Sir Vidia’s Shadow, Paul Theroux @LRB
Crossing the Blood Meridian: Cormac McCarthy and American History
The 'Dead-Internet Theory' Is Wrong but Feels True - The Atlantic
An app can be a home-cooked meal
Ian Rankin on Patricia Highsmith’s hunger for love and thought
Arundhati Roy, novelist with a sting
Benyamin on how he became a writer
Did I invade? Do you exist?
Lavender in a drawer
The Truth, by Stanisław Lem by Stanisław Lem, translated by Antonia Lloyd-Jones
Lem's 1964 story, published in English for the first time, tells the tale of a scientist in an insane asylum theorizing that the sun is alive.
The meditative empathy of Susanna Clarke’s Piranesi - Vox by Constance Grady
There is something meditative about watching Piranesi live, the purity of his life and the kindness of it. And Piranesi’s kindness is possible in part because he lives in such communion with the House, which is his world. He respects the House and knows how to live within it, and in turn the House blesses him with its bounties.
The Sellout won the Booker Prize. This blistering passage on white male privilege shows why. - Vox by Constance Grady
In the end we found it impossible to ignore the impassioned pleas of the Lost City of White Male Privilege, a controversial municipality whose very existence is often denied by many (mostly privileged white males). Others state categorically that the walls of the locale have been irreparably breached by hip-hop and Roberto Bolaño’s prose ...
9 Fictional Friendships that Explore Male Intimacy - Electric Literature by Jackson Frons
At the fulcrum of Roberto Bolaño’s kaleidoscopic epic Savage Detectives, are the poets Ulises Lima and Arturo Belano, the author’s alter ego. The mysterious leaders of the Visceral Realists, drift through Spain, Israel, North Africa, and Mexico sharing an unspoken and often inscrutable bond as they phase in and out of contact
‘Heartbreak is part of doing anything you want to do’ - Paul Beatty , Kate Kellaway interviews Paul Beatty
You are wary of other people’s questions. What questions do you ask yourself?
I don’t ask myself big questions. I’ve a friend who was struggling, saying: “I don’t know why I am here… what is the purpose?” I said: “There is no purpose.” If there were a purpose, then I would be frozen.
Considering the Novel in the Age of Obama by Christian Lorentzen
Environmental despoliation, economic regression, and enthroned sexism and bigotry are already on the cards. For all the turmoil on our streets and abroad, literary historians may look back at the Obama years as a time of tranquility ...
Joan Didion: Only Disconnect
Off Center: Essays by Barbara Grizzutti Harrison (1980).
I am disinclined to find endearing a chronicler of the 1960s who is beset by migraines that can be triggered by her decorator's having pleated instead of gathered her new diningroom curtains. These, and other assorted facts -- such as the fact that Didion chose to buy the dress Linda Kasabian wore at the Manson trial at I. Magnin in Beverly Hills -- put me more in mind of a neurasthenic Cher than of a writer who has been called America's finest woman prose stylist.
A Premature Attempt at the 21st Century Canon by Vulture Editors
A panel of critics tells us what belongs on a list of the 100 most important books of the 2000s … so far.
discussion at MetaFilter
The World According to Peter Thiel - Erik Torenberg's Thoughts
His claim is that we've had this narrow cone of progress around the world of bits—around software & IT — but not atoms. The iPhones that distract us from our environment also distract us from how strangely old & unchanged our current environment is. If you were to be in any room in 1973, everything would look the same except for our phones. This explains his old Founders Fund tagline: “We wanted flying cars, instead we got 140 characters.”
Zooming out, people don’t understand how important economic growth is. It’s the only thing sustaining the planet. Without it, we go into a malthusian war. Indeed: The only way our societies have worked for at least 250 years is by economic growth. Parliamentary democracies are built on an ever-expanding pie that they can continue subdividing. Once the pie is no longer expanding, everything turns zero-sum.
Cyberdecks For High-Tech Low-Lifes - The Dork Web
The term “Cyberdeck” was first coined in Gibson’s 1984 literary masterpiece, Neuromancer. He rewrote parts of Neuromancer several times after the release of Ridley Scott’s Blade Runner. Blade Runner was based on Philip K. Dick’s 1968 novel Do Androids Dream of Electric Sheep. Scott, Dick, Brunner’s The Shockwave Rider, Goddard’s Alphaville and work by futurists such as Syd Mead and Moebius make the title of “father of Cyberpunk” hard to hang on Gibson alone. But he’s clearly a very important character in the development of Cyberpunk culture.
Just as Shakespeare brought in new words to describe new worlds, 1980s Gibson is Cyberpunk’s Great Bard. The Cyberdeck is just one of Gibson’s literary gifts. It’s the tool that lets Console Cowboys jack into the Matrix of Cyberspace and start hacking.
The anthropologist in an economist world - Altered States of Monetary Consciousness
Anthropology starts from the recognition that a person - in the first instance at least - cannot exist apart from a group. Put differently, anthropology assumes that a human network always precedes its individual members, and that care and reproduction precede any form of solo heroics. Human babies don’t survive long if they are left to fend for themselves, and - even if they miraculously survived without others - they would not be able to speak language, which would make all future social interaction, relationships and trade near-impossible.
The age-old strategy of buying cheap shares is faltering - Hacker News
the article is behind paywall, but the discussion at HN is interesting (premii)
Why You Should Use Component-Based Design in Unity
Let’s say that any weapon will have a component for damage, range, and projectiles (optional). Using Unity’s UI, you could create a weapon by dragging these components onto any GameObject and customizing the values of each one. Then, if the way projectiles are handled changes further into development, all you need to do is change one script, and all your weapons’ functionalities will be updated instead of just those defined at one level of a tree.
Yay is a command-line tool to install and manage software from the Arch User Repository. It is included in the community repository of Manjaro Linux.
> pacman -Ss yay
community/yay 10.0.4-1
Yet another yogurt. Pacman wrapper and AUR helper written in go.
> sudo pacman -S yay
> man yay
> yay --help
# upgrade system
> yay -Syyu
# remove stale packages
> yay -Qdt
> yay -R $(yay -Qdtq | xargs)
# cleanup
> yay -Sc --noconfirm
# edit PKGBUILD
> mkdir ~/AUR_local && cd ~/AUR_Local
> yay --getpkgbuild julius-game
:: Querying AUR...
:: Downloaded PKGBUILD (1/1): julius-game
> ls julius-game/
total 12K
-rw-r--r-- 1 user0 user0 173 Sep 22 11:04 julius-game.desktop
-rw-r--r-- 1 user0 user0 145 Sep 22 11:04 julius-game.install
-rw-r--r-- 1 user0 user0 1.4K Sep 22 11:04 PKGBUILD
> cd julius-game
> vi PKGBUILD
> makepkg -si
# show foreign packages
# i.e those not belonging to official repos
# yay -Q --foreign
> yay -Qm
# info about AUR package
> yay -Si ktlint
:: Querying AUR...
Repository : aur
Name : ktlint
Keywords : None
Version : 0.38.1-1
Description : An anti-bikeshedding Kotlin linter with built-in formatter
URL : https://ktlint.github.io/
AUR URL : https://aur.archlinux.org/packages/ktlint
....
The World According to Peter Thiel - Erik Torenberg's Thoughts
His claim is that we've had this narrow cone of progress around the world of bits—around software & IT — but not atoms. The iPhones that distract us from our environment also distract us from how strangely old & unchanged our current environment is. If you were to be in any room in 1973, everything would look the same except for our phones. This explains his old Founders Fund tagline: “We wanted flying cars, instead we got 140 characters.”
Zooming out, people don’t understand how important economic growth is. It’s the only thing sustaining the planet. Without it, we go into a malthusian war. Indeed: The only way our societies have worked for at least 250 years is by economic growth. Parliamentary democracies are built on an ever-expanding pie that they can continue subdividing. Once the pie is no longer expanding, everything turns zero-sum.
Cyberdecks For High-Tech Low-Lifes - The Dork Web
The term “Cyberdeck” was first coined in Gibson’s 1984 literary masterpiece, Neuromancer. He rewrote parts of Neuromancer several times after the release of Ridley Scott’s Blade Runner. Blade Runner was based on Philip K. Dick’s 1968 novel Do Androids Dream of Electric Sheep. Scott, Dick, Brunner’s The Shockwave Rider, Goddard’s Alphaville and work by futurists such as Syd Mead and Moebius make the title of “father of Cyberpunk” hard to hang on Gibson alone. But he’s clearly a very important character in the development of Cyberpunk culture.
Just as Shakespeare brought in new words to describe new worlds, 1980s Gibson is Cyberpunk’s Great Bard. The Cyberdeck is just one of Gibson’s literary gifts. It’s the tool that lets Console Cowboys jack into the Matrix of Cyberspace and start hacking.
The anthropologist in an economist world - Altered States of Monetary Consciousness
Anthropology starts from the recognition that a person - in the first instance at least - cannot exist apart from a group. Put differently, anthropology assumes that a human network always precedes its individual members, and that care and reproduction precede any form of solo heroics. Human babies don’t survive long if they are left to fend for themselves, and - even if they miraculously survived without others - they would not be able to speak language, which would make all future social interaction, relationships and trade near-impossible.
The age-old strategy of buying cheap shares is faltering - Hacker News
the article is behind paywall, but the discussion at HN is interesting (premii)
Why You Should Use Component-Based Design in Unity
Let’s say that any weapon will have a component for damage, range, and projectiles (optional). Using Unity’s UI, you could create a weapon by dragging these components onto any GameObject and customizing the values of each one. Then, if the way projectiles are handled changes further into development, all you need to do is change one script, and all your weapons’ functionalities will be updated instead of just those defined at one level of a tree.
source: Fast inverse square root - Wikipedia
Fast inverse square root, sometimes referred to as Fast InvSqrt() or by the hexadecimal constant 0x5F3759DF, is an algorithm that estimates 1/sqrt(x), the reciprocal (or multiplicative inverse) of the square root of a 32-bit floating-point number x floating-point
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
return y;
}