'you should not just sit here reading'
Godsil and Royle briefly break the fourth wall to remind the reader that algebraic graph theory is not a spectator sport.
Mathematics, Lisp, Forth, Assembly, Emacs, Unix, etc. | Creator of https://git.io/texme, https://git.io/uncap, https://melpa.org/#/devil, https://susam.net/myrgb, https://susam.net/cfrs and https://susam.net/fxyt. | Play https://susam.net/invaders today!
'you should not just sit here reading'
Godsil and Royle briefly break the fourth wall to remind the reader that algebraic graph theory is not a spectator sport.
A test page with 2000 randomly generated entries to answer a question from the HN comments section:
https://susam.net/code/test/2k.html
Actual page size is 240 kB and the compressed transfer size is 130 kB.
@lens_r This is no bother at all. I'm delighted you're finding this little project to be fun. Updated https://susam.github.io/cfrs/demo.html#invaders-alien with your optimised version.
@lens_r Thanks for playing with CFRS[]. This is nice. Can I add it to <https://susam.github.io/cfrs/demo.html> if you don't mind?
My Coding Adventures in 2025: https://susam.net/code-2025.html
#programming #blog #post #indieweb #python #mathematics #webdev
Nerd Quiz #3 is out: https://susam.net/nq.html#3
#lisp #javascript #programming #webdev #indiedev #opensource
After years of neglect, I finally rebuilt my website. It’s only one page, but it’s flashy.
To the LaTeX crowd here: Which user-defined macros can you not live without?
I am perfectly happy to write unwieldy macro invocations like \mathbb{Q}, \operatorname{Sym}, etc. over and over again. But I cannot trust myself with the simple \cup and \cap macros. I've often made the wrong choice, leading to documents that were confusing to readers. As a result, now almost every preamble I write contains:
\newcommand{\union}{\cup}
\newcommand{\inter}{\cap}
Expanded my previous post here into a blog post: https://susam.net/fed-24-years-of-posts-to-markov-model.html
@aartaka This example uses a second-order Markov model over words, equivalently a trigram language model. The program itself is very small and simply takes the n-gram order as a parameter, so other values of n are possible.
Why do you suggest that Markov chains must operate at the character level? I am not aware of any such definition. A Markov chain is defined over an arbitrary state space. In this case, the state space has word-level n-grams, though in principle it could be anything.
Today I fed 24 years of my blog posts into my Markov gibberish generator and asked it to speak for me. Here's the result. Apparently, this is how I would sound if I ever took up speaking gibberish!
The gibberish generator lives here by the name Mark V. Shaney Junior: https://github.com/susam/mvs
#python #programming #algorithms #indieweb #opensource #blog
A minimum viable Markov gibberish generator in 32 lines of Python: https://github.com/susam/mvs
Over the years, my personal static site generator has evolved into a rather nice set of functions that I can mix and match easily to implement new features.
For example, today I thought I'd add a backlinks page to my website and it took only 15 minutes or so to write a new function that generates the backlinks page merely by invoking a few existing functions.
Commit: https://github.com/susam/susam.net/commit/c25990c
Result: https://susam.net/backlinks.html
@css Yes, this is nice too. I have talked about a similar solution here: <https://news.ycombinator.com/item?id=46167663>.
Fizz Buzz in 4 lines of CSS: https://susam.net/css-fizz-buzz.html
Triangle-Free Cayley Graph: https://susam.net/triangle-free-cayley-graph.html
@autisticplushy Thank you! This is a very nice technique. I'm going to use it in the future.
@autisticplushy Semicolon where? The following is a syntax error:
printf 'import sys; for i in range(10): print(i)' | python3
Do you have a working example of what you mean?
I was asked over IRC if my cosine-powered Fizz Buzz could be a one-liner. Of course it can:
printf 'from math import cos, pi\nfor n in range(1, 20):\n print([n, "Fizz", "Buzz", "FizzBuzz"][round(11/15 + (2/3) * cos(2*pi*n/3) + (4/5) * (cos(2*pi*n/5) + cos(4*pi*n/5)))])' | python3