HNHacker News
TopNewBestAskShowJobs

qsantos

1,500 karma · joined March 4, 2021

https://qsantos.fr/

qsantos@qsantos.fr

Socials: - github.com/qsantos - linkedin.com/in/qsantos

submissionscomments
qsantos··on You Can Move Unpin
Clarification needed: the original title is “You can move !Unpin”, which is definitely more surprising!
qsantos··on Linux Pipes Are Slow
Hey!
qsantos··on Linux Pipes Are Slow
Totally agree, my server should definitely be able to handle the load. But this is a WordPress install, which is definitely doing too much work for what it is when just serving the pages. I plan to improve on this!
qsantos··on Linux Pipes Are Slow
My server struggles a bit with the load on the WordPress site. You should be fine just reloading. I will make sure to improve things for the next time!
qsantos··on Linux Pipes Are Slow
To be frank, this is more of a pretext to understand what pipes and vmsplice do exactly.
qsantos··on Linux Pipes Are Slow
For the first Rust program, where I just write to memory, I just use the time utility when running the program from zsh. Then, I divide the number of bytes written by the number of seconds elapsed. That's why it's not an infinite loop ;)
qsantos··on Linux Pipes Are Slow
Thanks a lot for the information! I was not quite sure what to look for in this case. I have added in note in the article.
qsantos··on Linux Pipes Are Slow
That sounds like a good idea!
qsantos··on Linux Pipes Are Slow
I am again getting the hug of death of Hacker News. The situation is better than the last time thanks to caching WordPress pages, but loading the page can still take a few seconds, so bear with me!
qsantos··on Linux Pipes Are Slow
I'll write an article on the flamegraphs specifically, but to get the data, just follow Julia's article!

https://jvns.ca/blog/2017/03/19/getting-started-with-ftrace/

qsantos··on The Marshmallow Test does not reliably predict adult functioning
The mother forced herself to save by punishing herself if she did not.

The $2000 in the saving account was earmarked for the dowry, and she would not touch it. So, she had to save every month to pay back the loan to the bank. The longer she took to do this, the more interest she paid.

This is a kind of non-rational trick that some people use to "trick themselves into doing the right thing". This is like paying some random stranger $100 if you do not accomplish some task.

qsantos··on ViHN: Vim for Hacker News
I did not know of Haxplore, thanks!
qsantos··on ViHN: Vim for Hacker News
Thanks!

And I agreed that this is not “pure” Vim.

But I did need to find a compromise. There is little point in having an “insert” mode, like Vimium does, since I am targeting a very specific website and not overriding any existing shortcut (AFAICT). If you think it's important to you, I might consider implementing custom key bindings so that you can use with “pure” Vim shortcuts!

Regarding the scrolling, it could be two things:

1. I do not update the address bar on every key press, to avoid some kind of rate limitation I encountered when I did so initially. Instead, there is a very short delay so before it happens. But the viewport should still scroll immediately. 2. If it's smooth scrolling, there is actually a toggle you can change in the extension settings. If you still have the behavior without smooth scrolling, I would be curious to know more, to see if I can make the experience more pleasant.

qsantos··on ViHN: Vim for Hacker News
I do! I use Vimium C for general browsing. But, considering the time I spend on Hacker News, I needed something to optimize my procrastination even further!
qsantos··on ViHN: Vim for Hacker News
I use Vimium as well! It's very frustrating when I need to reach for the mouse to navigate a website.
qsantos··on ViHN: Vim for Hacker News
tl;dr: I made ViHN [1] to read Hacker News without having to move my hands away from the keyboard. It’s freely available on Firefox [2] and Chrome [3].

[1] https://github.com/qsantos/ViHN/

[2] https://addons.mozilla.org/fr/firefox/addon/vihn/

[3] https://chromewebstore.google.com/detail/vihn/cfmccoefeojndm...

qsantos··on JavaScript Bloat in 2024
Coincidently, I have written a browser extension to navigate Hacker News comments using Vi-style key bindings [1]. It has no compilation steps, no npm. It is mostly a 1kLoC file of vanilla JavaScript.

Modern frameworks are definitely needed for large applications, but there is no need all that complexity when the scope is reduced.

[1] https://github.com/qsantos/ViHN/

qsantos··on What's that touchscreen in my room?
From the Mastodon thread:

> Turns out, they found out an even more innovative time sync mechanism. When you open the UI in the browser, they quickly redirect you to "/set-time/" + Date.now(). This sets a global variable in the Node.js app responsible for "now".

(https://mastodon.social/@laplab/111789584104871367)

qsantos··on Dynamic programming is not black magic
I am not saying to not explain the theory. I am saying that using a concrete concept makes it easier to build the mental model needed to understand the theory.
qsantos··on Dynamic programming is not black magic
That's why I phrased it that way. But since you mentioned working modulo 2^64, I thought that would count :-).

It's useful to make it explicit anyway for people who might miss that, so thanks!

qsantos··on Dynamic programming is not black magic
I never heard of these, thanks for the links!
qsantos··on Dynamic programming is not black magic
I understand! I do not think there is a magic formula for this. This only comes with a lot of practice.
qsantos··on Dynamic programming is not black magic
Regarding Fibonacci, the recursive formula is much more efficient anyway! Oh, not _that_ recursive formula. That one: [1], from [2]. Basically, it allows you to implement in O(log n) arithmetic operations.

[1] https://wikimedia.org/api/rest_v1/media/math/render/svg/64b9...

[2] https://en.wikipedia.org/wiki/Fibonacci_sequence#Matrix_form

qsantos··on Dynamic programming is not black magic
That's a very good question.

I think the simplest approach to prove it would be to show that both computations yield the global minimum. Since there is only one global minimum, then they must be equal.

qsantos··on Dynamic programming is not black magic
I think my own education followed the “traditional” way of learning computer science, albeit after years of tinkering with computers and programming as a kid. But I often felt that some concepts were much simpler when you made the connection with something concrete.

Of course, you would not use analogy for formal proofs, but it helped build a mental model incrementally instead of having to conjure various concepts out of thin air and draw connections between them.

qsantos··on Dynamic programming is not black magic
Thanks! If I understand correctly, you would use that method, while substituting tail recursion in place of the look. However, I feel there is a lot of magic in https://gist.github.com/tmoertel/5798134#file-gistfile1-py-L....
qsantos··on Dynamic programming is not black magic
Interesting, I have never really looked into this kind of calculation. Thanks for the links!
qsantos··on Dynamic programming is not black magic
The point is that dynamic programming builds on various abstract concepts that many college students only understand to a level deep enough to pass exams. Making the connection with caching, which is a mostly-unrelated, and much more concrete concept, give them the basis to build a mental framework. Sure, they might do without, but why make it harder?
qsantos··on Dynamic programming is not black magic
I agree with that article that recursion is better introduced with relevant data structures than with Fibonacci. And I agree that Fibonacci is also too simple to explain dynamic programming, which is why I showed how it works with edit distance, and they with AoC 2023-12-18.
qsantos··on Dynamic programming is not black magic
Please, take the perspective of an average computer science student, who might have had some interest in computers, but maybe did not look too deep in the theory. In the past few years, they just had to learn graphs, automata and Turing machines, complexity classes, computer architecture, compilation theory, and possibly a programming language they never used before, maybe two. And they might prefer having social life than doing all-nighters on computer-assisted proof assignments :-) .

In short, I am not saying you cannot learn dynamic programming straight away from the theory, just that you are going to lose many people with this approach.

In fact, it makes me think of “New Math” [1], an effort to teach math from the ground-up starting in junior high. I am not familiar with how it worked in the US, but at least in France, it was definitely not a success. I would definitely have had a lot of fun, but many more did not, and failed to get a basic mathematical education at all as a result.

[1] https://en.wikipedia.org/wiki/New_Math

Page 1 of 3Next →