N
Nayuki
nayuki.io · Personal blog · on HN since 2014
Nayuki's personal site with programming projects, tutorials, and libraries, including a QR code generator and articles on algorithms and x86 assembly.
What HN saysHN commenters recommend it warmly, citing its nice writing style, wide variety of projects, and the step-by-step QR code guide.
90HN people shared it
47linked it in comments
73stories submitted
3.1Kstory points
6 months agolast shared
2014people per year2026
Most-shared posts
- 1Designing better file organization around tags, not hierarchies (2017)17 people · 572 points · first shared 2017 · 226 comments on HN
- 2Creating a QR Code step by step11 people · 904 points · first shared 2018 · 46 comments on HN
- 3QR Code generator library (Java, TypeScript, Python, Rust, C++, and C)9 people · 6 points · first shared 2017 · discussion on HN
- 4Fast Fibonacci Algorithms (2015)6 people · 171 points · first shared 2015 · 49 comments on HN
- 5Homepage6 people · first shared 2017
- 6A fundamental introduction to x86 assembly programming5 people · 327 points · first shared 2016 · 74 comments on HN
- 7Summary of C/C++ integer rules4 people · 120 points · first shared 2019 · 95 comments on HN
- 8Common mistakes when using the metric system3 people · 44 points · first shared 2023 · 98 comments on HN
- 9Computing Wikipedia’s internal PageRanks3 people · 5 points · first shared 2016 · discussion on HN
- 10Unsigned int considered harmful for Java3 people · 5 points · first shared 2014 · discussion on HN
- 11Cryptographic Primitives in Plain Python3 people · 4 points · first shared 2018 · discussion on HN
- 12Project Euler Solutions3 people · 3 points · first shared 2017 · discussion on HN
- 13Poor Feedback from Readers3 people · 3 points · first shared 2015 · discussion on HN
- 14Optimal text segmentation for QR Codes3 people · 3 points · first shared 2018 · discussion on HN
- 15Pixel is a unit of length and area2 people · 145 points · first shared 2025 · 176 comments on HN
What HN people wrote when they linked it
Overdoggo · 2022-05-26
I FOUND IT! YAHOO! https://www.nayuki.io/
Absolutely give this blog a read if you haven't already. Definitely worth your time!
oenetan · 2021-09-05
https://www.nayuki.io/ seems good usually.
But yes, i would mainly recommend the standard lib of the language in question, but not all programming languages have a "standard lib" you can read.
cyanoacry · 2019-02-08
I highly recommend Nayuki's site: https://www.nayuki.io/
Lots of content (made mostly for themselves), but the writing style is pretty nice and there's a large variety of projects.
Zamicol · 2026-03-18
Very impressive work. Well done on the blog.
This reminds of of the sort of work Nayuki does:
https://www.nayuki.io
nayuki · 2025-05-11
> I'd like to find a way to repair QR codes in a reliable way.
Consider reading up on https://www.nayuki.io/page/creating-a-qr-code-step-by-step
And I highly recommend QRazyBox for manual painting with automatic decoding: https://merri.cx/qrazybox/ , https://github.com/Merricx/qrazybox
> that begins with collecting a bunch of broken and corrupted QR codes
Some ideas to consider: http://datagenetics.com/blog/november12013/index.html
tantalor · 2025-02-26
This site is the best visual explainer for QR code generation.
https://www.nayuki.io/page/creating-a-qr-code-step-by-step
It reproduces what the article is saying, with more detail.
pimlottc · 2024-04-02
This is really great, I didn't know you could switch encoding schemes within the same QR code. There's a nifty visualization tool [0] that shows how this can reduce QR code sizes. It can determine the optimal segmentation strategy for any string and display a color-code version with statistics. Very nice!
0: https://www.nayuki.io/page/optimal-text-segmentation-for-qr-codes
franga2000 · 2024-01-20
A very vaguely related thing that might be useful to someone: in QR codes, using ALL-CAPS actually saves you data, making the QR code less "dense" and so easier to read at smaller sizes.
The trick is in the "alphanumeric" encoding mode of the QrR standard, which lets you encode 3 character per 11 bit (as opposed to 1 character per 8 bits) if you limit yourself to just numbers, uppercase letters and a few common URL symbols [0].
Besides making the code less dense, you can also add more error correction at the same density, making the code more resilient to wear, damage and reflections.
For more QR code trivia, see this excellent demo: https://www.nayuki.io/page/creating-a-qr-code-step-by-step
[0] https://www.thonky.com/qr-code-tutorial/alphanumeric-table
cafxx · 2023-06-12
The funny thing is that no-one AFAICT has realized that the same content can be encoded in different-looking QR codes. Beside the obvious (different error-correction levels), the content itself can be changed while maintaining its semantic meaning (e.g. "https://example.com/foo", "HTTPS://EXAMPLE.COM/foo", or "HtTpS://eXaMpLe.CoM/foo" are all semantically identical) and even the QR encoding itself can be tweaked (e.g. by changing the version and mask, see the demo on https://www.nayuki.io/page/qr-code-generator-library). Each combination would yield a different-looking QR code that would encode the same meaning, and it could therefore allow the diffusion models even greater freedom.
I'm sure somebody will get to this soon.
robin_reala · 2022-12-06
This is probably the best starting point for understanding how to build the “QR code library” part of your question: https://www.nayuki.io/page/creating-a-qr-code-step-by-step
nathcd · 2018-09-01
I really think what we need for this is a new sort of file manager, and it should look more like iTunes or Kodi than Thunar or Dolphin.
I always enjoy reading this post about tag-based file organization, which feels like it would be a great foundation for this: https://www.nayuki.io/page/designing-better-file-organization-around-t…
executesorder66 · 2017-07-25
https://www.nayuki.io/
Lots of high quality code examples in a variety of languages.
i336_ · 2016-08-05
Wow, that's awesome.
You've probably heard of Coreboot, an open source BIOS that's been ported to a handful of systems (230 total different configurations, along with a QEMU target for playing with). It's also the foundation of all Chromebooks. This is very short but may be fascinating reading: https://www.coreboot.org/Developer_Manual
I'm not quite at the shellcode-comprehending stage yet, although I realize it's incredibly simple. Agh - I have a basic working knowledge of C, but nonexistent understanding of low-level hardware at this point :)
https://www.nayuki.io/page/a-fundamental-introduction-to-x86-assembly-… has been on my to-follow-up-on list for a while, along with http://beginners.re/. (Both found via HN)
Phemist · 2021-10-13
Just thought this would be interesting to share.
The base64 encoding in JWT's forces the QR-code to use segments in byte-mode. This will encode individual JWT characters in 8 bits of data.
The size of the characterset of a base64-encoded JWT is 65 (64-characters in base64 + '.'). Actually, in this spec, it is 66, including the `|`.
An optimal encoding would use Log2(66) amount of bits per character. Alphanumeric mode at 5.5 bits per character is too small, but encoding individual JWT chars as 2 numeric characters (at 3 1/3 bits each) results in a more optimal encoding (~20% space savings).
The mapping from the JWT char to 2 numeric coding is also quite trivial: take the ascii value of the char and subtract by 43.
```
def enc(c):
return "%02d"%(ord(c) - 43)
```
The fantastic website
https://www.nayuki.io/page/creating-a-qr-code-step-by-step
shows, for the JWT you posted, a size of 2164 bits needed to encode the data inside the QR-code at low error-correction (resulting in a version 10 QR-code).
If we run every char through the numeric encoding process, we get the following result:…
benrbray · 2021-04-30
I use roamlikes as a combined bookmark / note-taking system.
I tend to spend a few minutes every day taking some interesting links from HN or elsewhere (that I may or may not read that day) and creating entries for them in my personal wiki system.
(This is how I keep track of collections of related links -- for my post above, I just searched for [[knowledge-graph]] tags in my wiki system and copied the results into an HN comment)
I find this most useful for topics that I know I'd like to explore in the future, but just don't have time for right now. The Google search signal-to-noise ratio has lessened so much that I know I'll never be able to find a specific link again unless I remember the exact title, so it's useful to have a way to quickly assign tags to a URL and forget about it until later. Tagging systems are much better than a hierarchical bookmark system for recall later [1].
Then, when I take the time to read about a certain topic, I start taking notes in the .md file corresponding to the appropriate keyword or citation.
The best part is discovering new connections between topics -- sometimes I'll type a [[keyword]] in my notes, and see that several of my existing notes already link to it.
I'm still learning how to best use a system like this, it does take some effort to maintain. Right now what works for me is really short, concise notes about very specific keywords to start. Then I'll do a "synthesis" pass where I'll summarize the relationships between…
MaxBarraclough · 2018-07-02
> compile-time speed ups and potentially the use of the rorx instruction
Indeed, but the 'compile-time speedups' are a legitimate point in favour of the compiler. If they didn't occur to the assembly programmer, or struck them as too complex to pull off, then the compiler deserves the point.
Have to say I don't follow why the hand-tuned assembly doesn't use the rorx instruction. It's not mentioned in the assembly file, at least, but I thought that was the point? https://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly
Also, it's neat to see instruction-selection being so significant. Generally might expect cache/branch behaviour to be the kicker.
> It cannot be faster than the fastest assembly
Well, 'fastest assembly' is the domain of so-called 'superoptimisers', and has us pushing at the stubborn bounds of computability.
We were talking about hand-written assembly-code, compared to compiler-generated. Odds are that none of the binaries tested were the optimal assembly.
The only interesting question is whether the hand-tuned assembly code they tested, was the fastest available at the time. If not, the whole demonstration is a straw-man, of course.
Also I don't like that the winning Zig program runs for so much longer. A good benchmark should provide ironclad assurances that no candidate is getting an unfair advantage re. loading/'warm-up'.
tom_mellior · 2018-05-30
Thanks!
Grabbing the sources from https://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly and compiling them more or less as recommended (and unlike they are compiled in the talk):
$ clang -O3 sha256-test.c sha256.c -o sha256-test ; for i in 1 2 3; do ./sha256-test ; done
Self-check passed
Speed: 197.2 MB/s
Self-check passed
Speed: 196.1 MB/s
Self-check passed
Speed: 196.1 MB/s
$ gcc -O3 sha256-test.c sha256.c -o sha256-test ; for i in 1 2 3; do ./sha256-test ; done
Self-check passed
Speed: 209.7 MB/s
Self-check passed
Speed: 209.2 MB/s
Self-check passed
Speed: 209.1 MB/s
This is a baseline for us. It has nothing to do with Zig and nothing to do with Andrew's machine (hardware or compiler versions).
But wait, the page above suggests that adding -march=native might help. Indeed it does:
$ clang -O3 -march=native sha256-test.c sha256.c -o sha256-test ; for i in 1 2 3; do ./sha256-test ; done
Self-check passed
Speed: 255.6 MB/s
Self-check passed
Speed: 259.0 MB/s
Self-check passed
Speed: 254.3 MB/s
$ gcc -O3 -march=native sha256-test.c sha256.c -o sha256-test ; for i in 1 2 3; do ./sha256-test ; done
Self-check passed
Speed: 275.1 MB/s
Self-check passed
Speed: 268.4 MB/s
Self-check passed
Speed: 270.0 MB/s
In the talk Andrew suggests that the difference might be due to using rorx instructions, which Zig might be able to do due to aggressive loop unrolling.…
slig · 2025-11-07
This tool [1] let me figure that out couple of years ago. And on the printable pages of the sites I own, for instance [2], I use a all caps domain and identifiers so that all my QR Codes are tiny (e.g: `HTTPS://ABC.DE/ABCD/42`, with up to 10 chars in the path).
[1]: https://www.nayuki.io/page/creating-a-qr-code-step-by-step [2]: https://www.brainzilla.com/logic/zebra/pdf/blood-donation.pdf
password4321 · 2025-05-11
Next time, site:github.com that search and find a demo page like https://www.nayuki.io/page/qr-code-generator-library!
lemonwaterlime · 2025-01-23
See also:
- "Designing better file organization around tags not hierarchies" [1]
- `tag` - a macOS version of `tmsu` that uses the system tags (xattr-based if I recall) [2]
[1] https://www.nayuki.io/page/designing-better-file-organization-around-t…
[2] https://github.com/jdberry/tag
belter · 2024-11-17
The feedback he receives is quite fun: https://www.nayuki.io/page/poor-feedback-from-readers
redbell · 2024-11-17
Oh, I see how terrible managing a personal blog might be. You have to deal with all kinds of people. Fortunately, he also shares good/decent feedback: https://www.nayuki.io/page/decent-feedback-from-readers
bobtheborg · 2024-10-01
If you google "github qr code generator", the top result has a live demo that I've used quite a bit: https://www.nayuki.io/page/qr-code-generator-library#live-demo-javascr…
pxndxx · 2024-09-11
That line refers to the 'u' substituting for 'μ', the greek letter mu, not the L symbol. https://www.nayuki.io/page/common-mistakes-when-using-the-metric-syste…
omoikane · 2023-06-03
Related, this page has a step by step process of how the encoding process works:
https://www.nayuki.io/page/creating-a-qr-code-step-by-step
Previously discussed here:
2020: https://news.ycombinator.com/item?id=24119124
2018: https://news.ycombinator.com/item?id=18360847
vacuumcl · 2023-02-26
No. In Mathematica important operations like mapping functions over sets (arrays/tensors) at various depths have simple operators such as (/@, @, @@, @@@). You can do functional composition using @*, etc. You don't need to define your variables and functions before being able to write them in expressions. Often you want to have intermediate terms that have some temporary name, and which get substituted later on. The replacement rules in Mathematica are very powerful for this.
As another example, I googled some project Euler solutions in Mathematica and (pure Python) and found this: https://www.nayuki.io/page/project-euler-solutions. Compared to the pure Python solutions, the Mathematica code is typically much smaller. Of course this is not Sympy, but a lot of the Python syntax carries over to SymPy as well.
lifthrasiir · 2022-09-14
I probably know this only because back in time I wrote a QR code generator in JavaScript [1] which was also one of such libraries reviewed by Nayuki [2], and as I haven't actually implemented a decoder my knowledge stops there. Sorry :-)
[1] https://github.com/lifthrasiir/qr.js
[2] https://www.nayuki.io/page/qr-code-generator-library
lgvld · 2022-03-10
I guess it helps to understand how to generate a QR code: https://www.nayuki.io/page/qr-code-generator-library (see also the references at the end)
Good luck. ;-)
zuj · 2021-12-29
Naive question, isn't gobo, nix and other systems trying to make a tag based file systems at the end?
https://www.nayuki.io/page/designing-better-file-organization-around-t…
marcodiego · 2021-03-05
Svg supports the <script> tag. This allows for some very interesting usages.
Other examples:
https://www.scriptol.fr/xml/code/invaders.svg
https://www.nayuki.io/res/full-screen-clock-javascript/full-screen-clo…
https://upload.wikimedia.org/wikipedia/commons/6/6c/Morphing_SMIL.svg