Peteris Krumins
catonmat.net · Personal blog · on HN since 2007
Peteris Krumins writes about Unix tools, Vim, bit hacks and programming, and also runs Browserling and its online tools.
What HN saysCommenters call the blog excellent and like his comics, though one finds the spammy 'Top Posts' links and the online tools sites odd.
316HN people shared it
152linked it in comments
335stories submitted
15Kstory points
6 months agolast shared
2007people per year2026
Most-shared posts
- 1Why Vim uses hjkl keys as arrow keys14 people · 57 points · first shared 2019 · 61 comments on HN
- 2Here is why vim uses the hjkl keys as arrow keys11 people · 480 points · first shared 2012 · 98 comments on HN
- 3Lazy lists for Node.js11 people · 3 points · first shared 2008 · discussion on HN
- 4A proof that Unix utility sed is Turing complete10 people · 223 points · first shared 2019 · 106 comments on HN
- 5Low Level Bit Hacks You Absolutely Must Know7 people · 657 points · first shared 2009 · 171 comments on HN
- 6Good at programming competitions does not equal good on the job [video]7 people · 577 points · first shared 2015 · 166 comments on HN
- 7A Unix Utility You Should Know About: Pipe Viewer7 people · 240 points · first shared 2009 · 63 comments on HN
- 8Browserling goes viral with cheap phone users trying to use WhatsApp6 people · 492 points · first shared 2017 · 222 comments on HN
- 9My Top 100 Programming, Computer and Science Books: Part One6 people · 259 points · first shared 2015 · 60 comments on HN
- 10Follow Hacker News from the Console6 people · 95 points · first shared 2008 · 21 comments on HN
- 11Famous Sed One-Liners Explained6 people · 48 points · first shared 2008 · 4 comments on HN
- 12Ldd Arbitrary Code Execution6 people · 11 points · first shared 2021 · 3 comments on HN
- 13On Functors5 people · 118 points · first shared 2010 · 6 comments on HN
- 14Arbitrary code execution via ldd utility5 people · 101 points · first shared 2009 · 18 comments on HN
- 15Wanna learn JavaScript? Here are 15 video lectures (with key ideas written out)5 people · 64 points · first shared 2007 · 3 comments on HN
What HN people wrote when they linked it
gogopuppygogo · 2017-07-25
http://www.catonmat.net is excellent.
I'm also a fan of the comics the author Peter Krumins puts out https://comic.browserling.com/
danudey · 2026-01-22
Haven't heard of TCP_CORK, very interesting.
For people who don't feel like googling it:
1. You TCP_CORK a socket
2. You put data into it and the kernel buffers it
3. If you uncork the socket, or if the buffer hits MSS, the kernel sends the packet
Basically, the kernel waits until it has a full packet worth of data, or until you say you don't have any more data to send, and then it sends. Sort of an extreme TCP_YESDELAY.
See https://catonmat.net/tcp-cork for where I learned it all from.
LegionMammal978 · 2024-08-30
Those are some amazingly spammy "Top Posts" at the bottom of the page. From the same blog, I thought at first that the "left-pad as a service" [0] was a parody, but the whole collection of Online Tools websites is so elaborate that it might truly be in earnest.
Also, this should be (2010). The "last updated 3 weeks ago" is likely not real at all, every page on this blog was allegedly updated in a similar timeframe. (Maybe it counts every change to the list of links? Or maybe it's just bogus SEO nonsense.)
[0] https://catonmat.net/1000-paying-left-pad-users
tl · 2023-08-15
All 5 of those age better than React. Also, you are conflating languages and platforms.
Counterexamples / Retorts:
- https://catonmat.net/5-best-programming-languages
- https://stevelosh.com/blog/2018/08/a-road-to-common-lisp/
Choose ecosystems free of hamster wheels, friend.
pkrumins · 2022-04-26
That’s pretty great! I sold 1000 on the first day (http://catonmat.net/awk-book).
AnotherGoodName · 2021-11-05
The big FAANG do for what it's worth. They have entire ML pipelines looking at hiring. The following isn't about interview effectiveness but is one example of the analysis done:
https://catonmat.net/programming-competitions-work-performance
Twisell · 2021-01-20
Well I think the nice point of doing excercise in a web browser is that you can quickly switch to another tab and search for daring questions such as " by the way why on earth does this monstrosity want me to use hjkl? That don't make any sense!!!!"
https://catonmat.net/why-vim-uses-hjkl-as-arrow-keys
For a mostly data/SQL guy wanting to learn more about coding it still don't make much sense but at least I know why and I can move on. When I was trying vimtutor in a CLI interface I was less curious and more WTF F... this is pure madness kind of mood.
Dunno if I'll subscribe but nice first experience through this demo.
rubyn00bie · 2020-08-26
Two things that helped me more than anything with "learning" vim and or ever wanting to use it:
1. Remap your "capslock" key to "escape." Vi was written using an ADM-3A terminal and its keyboard, which you can see here: https://catonmat.net/why-vim-uses-hjkl-as-arrow-keys has the escape-key in a sane place. On modern keyboards, if you can, remap "capslock" to "escape" when pressed alone, and "ctrl" when pressed with another key.
2. Make your leader key something easy like the comma character "," E.g. to make a horizontal split, I press (not including quotation marks) ",h" or ",v" to make a vertical one.
Once I did those two things it all made so much more sense... It's also great because most editors these days support vim bindings, so even if you don't want to use vim you can still benefit from its really-awsome-once-you-figure-it-out UX.
throwaway8941 · 2020-07-26
>tree^H^H^H^Hgraph
If we pretend we're using readline here, ^W (yank previous word) and ^U (yank to the start of the line) should save you some key presses.
Some recommended bedtime reading:
https://catonmat.net/ftp/readline-emacs-editing-mode-cheat-sheet.pdf
https://en.wikipedia.org/wiki/GNU_Readline#Emacs_keyboard_shortcuts
marttt · 2020-06-16
Just for the sake of it -- a great discussion about ed from 2012:
https://news.ycombinator.com/item?id=4120513
And a cheat sheet linked there:
https://catonmat.net/ftp/ed.text.editor.cheat.sheet.pdf
ravoori · 2020-06-09
Shell - for bash, I'd recommend the Bash Guide from Greg's Wiki (https://mywiki.wooledge.org/BashGuide)
For awk
1. Chapters 1 and 2 from the Awk Programming Language(https://ia802309.us.archive.org/25/items/pdfy-MgN0H1joIoDVoIC7/The_AWK…
2. Awk one-liners (https://www.pement.org/awk/awk1line.txt)
3. Explanations for one-liners (https://catonmat.net/awk-one-liners-explained-part-one)
kace91 · 2019-10-01
I think there could be a huge market for a ux effort that brings the somewhat forgotten goodies of old modal editors into the modern world, combining them with new advances like fuzzy searching. I love vim, but it's appalling that we have so many historical baggage creating a gap for the users...
It's so obvious how vim's ergonomics are made for the [adm 3a keyboard](https://catonmat.net/images/why-vim-uses-hjkl/lsi-adm3a-full-keyboard.… (location of esc, control, arrow keys, etc) and yet we keep making layers of customization or force ourselves to the standard instead of doing the very needed reboot.
emodendroket · 2018-08-17
http://www.catonmat.net/blog/why-unix-commands-are-short/
> I was watching videos about my favorite topic, UNIX history, and found a talk by Hendrik Jan Thomassen. He's the UNIX pioneer in the Netherlands and has worked with Thompson and Ritchie in the past. He says the real reason why UNIX commands like ls, cp, mv, etc., are short is because PDP11 console keys were super hard to press. You'd get knuckle pain if you typed too much. So to save your fingers, all the commands were designed to be as short as possible. True or not, that's a fun story.
The page includes a video.
badperson · 2017-06-05
this guy has a blog that recommends a lot of great books
http://www.catonmat.net/blog/top-100-books-part-one/
godzillabrennus · 2017-01-31
Peteris Krumins - http://www.catonmat.net always has interesting bits on his blog.
JadeNB · 2016-11-29
I like Krumins's explanations series even more than the bare one-liners: http://www.catonmat.net/search?q=Perl+one-liners+explained . (That said, a good context-free Perl one-liner can always be enjoyed on its mystifying own.) Note that there is a book with the one-liners (and, I assume, their explanations): https://www.nostarch.com/perloneliners .
He also posted about Abigail's classic primality-testing one-liner at http://www.catonmat.net/blog/perl-regex-that-matches-prime-numbers .
eatonphil · 2016-05-15
For anyone reading "functor" and moving on, this (http://www.catonmat.net/blog/on-functors/) is a great post discussing how the term is used in a variety of languages.
leeoniya · 2015-09-26
this one is great, too. matches all printable ascii characters:
[ -~]
http://www.catonmat.net/blog/my-favorite-regex/
harperlee · 2015-04-27
Great visualization (as the rest from http://setosa.io , go have a look)!!
I wonder, though: I learnt OLS as standard math / symbolic logic; but, if kids and students learnt from these visualization, would they be better off, or worse off?
Because, at least for me, it is difficult to reason about this and other visual math examples (whereas there are others that are great as demonstrations, as the integer proof in http://www.catonmat.net/blog/visual-math-friday/ , this one, regarding OLS, confuses me).
It probably depends a lot on each person. Out of curiosity, does this particular example give you insights? Which ones? How?
ryanobjc · 2014-05-18
On the partition side of things... not really. Usually you end up with coordinated failures of various types.
For example, lets say you run redundant networks. Are the physical paths diverse? What happens if someone trips on BOTH network cables? What happens if the redundant network is on the SAME switch hardware? What happens if yes you use two network switches, but they are hooked up to the same UPS? Or both UPSs are on the same circuit breaker?
The classic reference on this is from google: http://www.catonmat.net/blog/wp-content/uploads/2008/11/thatcouldnthap…
There are a number of theoretical issues with these approaches, starting with the FLP result.
Also realistically, eventually all practical solutions fail, often due to user error.
2mur · 2014-02-27
For node + browser, I'm partial to substack's tape module[1][2] to output tap. Works great with browserify too.
[1] https://github.com/substack/tape
[2] http://www.catonmat.net/blog/writing-javascript-tests-with-tape/
tantalor · 2014-02-07
According to Leiserson, the qualities of "great software" are,
* performance
* modularity
* correctness
* maintainability
* security
* functionality
* robustness
* user-friendliness
* programmer's time
* simplicity
* extensibility
* reliability
* scalability
http://www.catonmat.net/blog/mit-introduction-to-algorithms-part-one/
retroafroman · 2013-12-04
Congratulations! I like to watch your blog[1] for interesting tidbits. I always pick up something I didn't know how to do.
[1] http://www.catonmat.net/
lunchladydoris · 2013-03-30
Doing this is definitely worth it -- in fact, it's how vi was meant to be used [0].
Also, it's worth noting that on OSX you can do this without any additional software. Just remap it in the keyboard settings.
[0] http://www.catonmat.net/blog/why-vim-uses-hjkl-as-arrow-keys/
briandoll · 2012-12-18
Here's another list, sans product hype:
Unix command-line tools like awk and grep. Set operation commands are essential too (http://www.catonmat.net/blog/set-operations-in-unix-shell/)
Ruby/Python/Perl for more complex massaging and wrangling
Excel (yes, really) for quick stats and graphs, great 1st step in understanding what you have
D3.js for visualization
I've used R in the past, but I found I was trying to squeeze data into R models. D3 is pretty hard to grasp initially (I'm very much still learning) but I'm finding that it's helping me think through how to visualize the data I have, rather than just forcing it into one of a few standard charts.
yesbabyyes · 2012-05-02
Peteris Krumins had a nice series of Node.js modules you should know about: http://www.catonmat.net/category/nodejs-modules
Some of my favorites:
- async -- flow control
- stitch -- packaging client side scripts
- express -- web framework
- redis -- great Redis client
- stylus -- css preprocessor
- request -- HTTP client
I find myself following certain people, like how I'm a fan of different rappers. Usually, stuff by visionmedia, felixge, mikeal, isaacs, substack is top notch.
sciurus · 2012-04-16
Agreed. It's almost always worth investing time in learning your tools, and if you're like me the bash shell is your fundamental, most used tool.
I have to give Peteris Krumins credit for creating some great references like http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line… and http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-sheet/ (or for the depraved, http://www.catonmat.net/blog/bash-emacs-editing-mode-cheat-sheet/)
dspillett · 2011-09-14
I don't know about the book, but the posts it is based on (usefully linked to from the linked article, http://www.catonmat.net/blog/sed-one-liners-explained-part-one/ if anyone wants a more direct link) are certainly worth a scan so it probably got a good few votes for that. I might have to consider purchasing the book myself.
shawnee_ · 2011-03-31
Good idea. Better idea - YC news from the console:
http://www.catonmat.net/blog/follow-hacker-news-from-the-console
And, for old timers, there's always lynx.
sga · 2010-10-28
Here is a link to the HN feed in the terminal that I was remembering:
http://www.catonmat.net/blog/follow-hacker-news-from-the-console/