Better HN
topnewbestaskshowjobs
Log inSign up

GrumpySloth

4,901 karma · joined Sep 13, 2020 (6y ago) · 1,641 submissions

Submissions

comment 4y ago · link · parent

Ok, it seems I'm just triggering a performance issue, which eventually causes a timeout: "operation killed by thread-priority-watchdog after 19 seconds". (I'm only seeing the straight lines I made.)

comment 4y ago · link · parent

Maybe I'm not getting something, but how do I make this thing tell me what the shortest route from A to B is?

comment 4y ago · link · parent

Which CDN are you using?

comment 4y ago · link · parent

I thought Gentoo did that more for the increased customisability than performance, since you have the compilation options to tweak (USE flags). Never used Gentoo though.

comment 4y ago · link · parent

That's a quasi-dupe of <https://news.ycombinator.com/item?id=32642874>.

comment 4y ago · link · parent

I went this route. At first I tried writing a bunch of Python scripts reading a YAML manifest. However, after ~2 weeks I already got warnings and errors about things which got deprecated/removed/changed by a new Python version and the YAML library I was using. So I dumped it and rewrote the thing in XML and XSLT. It's been working for a couple years with no breakages. Essentially 0 maintenance after the initial work. This design was about generating a tree of directories with Markdown files turned into HTML, PDF files turned into pages linking to them, and some directory renames, GUIDs and dates (for Atom feeds, which I generate for each directory) specified in a manifest file.

I've since taken up photography, so now I need to automatically read metadata from jpegs, add some tags and organise it on the site in albums. It's a bit outside the reach of XSLT, so first I've tried using Python with Jinja2 and PIL. Same problem as previously. So I've rewritten it in Go with the help of encoding/json (for the manifest), html/template (for the template), image/jpeg, golang.org/x/image/draw (for generating thumbnails of different sizes for different screen sizes) packages and exiftool (reading and removing EXIF tags). Pandoc has been present throughout all the rewrites, because I like its flavour of Markdown and options to shift heading levels by a specified value, so that they fit in with the surrounding template. I'm putting some finishing touches and am going to upload it in the coming days.

I know, you stopped reading at "XSLT". :D

comment 4y ago · link · parent

ImGui doesn't give you native OS widgets.

comment 4y ago · link · parent

And what is your program supposed to do when printf fails? Print an error?

comment 4y ago · link · parent

No, the whole page, i.e. HTML + CSS + photo thumbnails etc. It's dominated 90+% by the photo thumbnails, which is expected.

comment 4y ago · link · parent

That's only doable with a text-centric website. I'm currently finishing a photography section for my personal website, and the gallery pages are several hundred kBs in size, while single photo page is almost 1MB in size (provided you load it on a 28" screen; browser will load smaller variants on smaller screens). Most of that weight is the thumbnails (and almost-full-size photo in the latter case). The only JS I have is 6 lines (before minifying) on single photo pages which allow you to go to next or previous photo with keyboard arrows. I don't use any CSS frameworks, just a single hand-written CSS file. I don't have any tracking, analytics, social media features or anything of this sort.

So if even a personal site being done with no deadlines, no pressure from management to include analytics etc. can't do it, because it wants to display a bunch of photos, then I don't think we can expect "web-scale" websites to achieve it.

comment 4y ago · link · parent

> HTML vs plain text is a distraction; it's not the 1970's anymore and saving a byte or two here and there just isn't the computing world we're living in. Not when images, video, or audio files regularly get attached to email.

It's not about HTML vs plain text. It's about HTML vs a way to style text which is actually useful to the users. HTML is so bad for this purpose, in practice 99% of HTML mails don't use any tags in their proper content and mails which could use some styling to make them more readable are using plain text, because HTML is of no help to them. My remark about overhead was actually about the quotes, whose sizes grow linearly as threads get longer (and the threads grow quadratically instead of linearly), not about HTML. You don't pay for tags you do not use (almost). The only rich HTML mails (as opposed to plain text HTML mails) I get are marketing mails, which want to track me and "stand out from the crowd", neither of which I have an interest in, and HR mails.

> What's more, how do you loop someone into a conversation they weren't previously a part of, if you don't have the history of the thread in each mail? This is something Slack gets right

Slack doesn't get it right. When you join a conversation, you always see the whole history. But in practice people conduct conversations according to the assumption of who is taking part in them at a given moment. They can't predict the future and that someone will add another person to the conversation, and now this person will see everything they wrote. There is no way to add them to the conversation with a context of "the last n messages" e.g. In an ideal mail client you would select which messages from the thread you want to share with the newly-added conversation participant.

comment 4y ago · link · parent

Forsaking HTML doesn't imply embracing command line.

In my experience, most mails don't actually use any styling beyond the automatic blockquote for the endless quote chains that mail clients automatically add. So people are wasting storage and transfer for something they don't really use.

When I see a mail which could actually use some styling, it's usually something involving maths and HTML is not suitable for that case. People usually send LaTeX snippets in plain text in this case.

And while I'm at it, the endless quote chains are another thing which has no reason for existing. Each mail in a thread steadily grows in size, because mail clients "conveniently" always quote everything and put the text cursor above it so that the user doesn't stop for a moment to look at the size of what they're sending and consider the absurdity of the situation, when their client is perfectly capable of reconstructing the whole thread without copying all mails in each message. Quoting should be opt-in on a case-by-case basis. As they function in the wild today, the quotes are just useless garbage attached to everything.

comment 4y ago · link · parent

They serve different purposes. The viewer in the browser is only to preview what you're going to get if you subscribe without switching context to another application (most feeds I view I don't end up subscribing to). A feed reader is for subscribing and reading regularly.

A shout-out to NetNewsWire from me. It's perfect.

comment 4y ago · link · parent

I've recently spent some time sandboxing nginx on my web server by running the master process as the user www-data instead of root, adding some seccomp filters through systemd and writing a custom AppArmor profile[1]. And the hardest part was dealing with certbot actually. Not least because it's written in Python, and so adding capabilities to the script itself didn't do a thing. They needed to be added to the Python interpreter executable[2]. The whole thing seemed more complicated than its worth. I've looked briefly at what supposedly configuring an OpenBSD server with OpenBSD httpd + OpenBSD's acme-client would look like, and it seems so much easier and the secure configuration is the official one, so I'd need to worry much less about updates breaking my stuff.

So I'm considering moving to OpenBSD for my web server. The only thing giving me pause currently is that I saw no mention of HTTP/2 support, so I suspect there is none. Although maybe I don't need it. We'll see.

[1]: That last apart I actually already had, but it needed some tweaking this time, because I moved nginx's PID file to its own runtime directory created by systemd, instead of allowing it to write to /run as root.

[2]: Of course only for testing. I revoked them after verifying that everything works. And now they're only assigned dynamically by systemd when the service is run.

comment 4y ago · link · parent

I think vbezhenar was just joking.

comment 4y ago · link · parent

Hitting space in the example I gave would actually be pretty useless, since it would just put a space in the textfield.

comment 4y ago · link · parent

Doesn't fit with my experience. Moving from using ssh -X to just pointing remote X applications at my local X server without tunnelling it over SSH consistently improves performance for me. Not just in terms of experience, but also no process maxes out a CPU, so the machine has spare compute capacity for other tasks. It's really not an issue of ssh not being multithreaded. That shouldn't happen even on a single core. If sshd divided that workload over my n cores, it would still be very bad.

comment 4y ago · link · parent

And it kills performance, making you watch redraws, while sshd is maxing out a single core.

comment 4y ago · link · parent

TIL. Thanks!

comment 4y ago · link · parent

That works, thanks! Although there is a weird bug that going forward with Tab cycles through everything and goes back to the first field, whereas going back with Shift+Tab stops at the first field.

comment 4y ago · link · parent

Experiment:

1. Open TextEdit.app

2. Type some random characters.

3. Attempt to quit with Cmd+Q.

4. A dialog box shows up, prompting you to save the file. Hitting Tab just cycles between the "Save As" and "Tags" text fields. There is no way for me to select the "Delete" button with Tab.

Challenge: quit TextEdit.app in that situation with they keyboard, without using the mouse, and without saving a file.

That's a broader topic btw: Apple's apps often make the Tab button only cycle between text fields. In Safari when logging into Spotify I can't reach the "Remember me" checkbox with Tab. It only cycles between the login and password textfields and the URL bar. Luckily, other browsers don't have this flaw.

comment 4y ago · link · parent

I started using macOS with Big Sur (still on it) and I don't understand why Apple would remove the ability to select buttons in dialog windows with the keyboard. I've googled it and it seems you used to be able to do that on macOS, but when I follow the instructions on Big Sur, I can't move the selection from the button active by default to the other one (e.g. "Ok" vs "Cancel"). That means my right hand is making runs between keyboard and mouse all the time. Very unergonomic.

comment 4y ago · link · parent

There are two excellent books by Brendan Gregg which can teach you about eBPF:

1: Systems Performance: Enterprise and the Cloud, 2nd Edition <https://brendangregg.com/systems-performance-2nd-edition-boo...>

2: BPF Performance Tools <https://brendangregg.com/bpf-performance-tools-book.html>

Contrary to the title, I would actually recommend the first one more and only if you feel starved for more to reach for the second one. You can learn a lot about performance tools and methodologies on Linux from the first one, not just eBPF.

I've never had to recompile a Linux distro to start using eBPF btw. Most distros already use a kernel compiled with options enabling eBPF. That may not be true on some "embedded Linux" devices though.

comment 4y ago · link · parent

Also seems to be 16:10 instead of 16:9, and have a different set of ports. Honestly I don't see what those two laptops have in common beyond both being Lenovo.

comment 4y ago · link · parent

ThinkPad X13 Gen 3 starts at $1919. Macbook Air M2 with 8GB RAM is $1199. Macbook Air M2 with 16GB RAM is $1,399. So even at 16GB it's still a lot cheaper than the Lenovo laptop used. Price doesn't explain the disparity in the hardware used in the benchmarks.

comment 4y ago · link · parent

I haven't written my comment in the spirit of entering a competition of who can get more RAM, but in the spirit that the Phoronix benchmark compares completely different computers, one with 8GB, the other with 16GB of RAM and gives a title suggesting that it's a comparison between chips, when the chip with 8GB isn't limited to 8GB. They could have gone for the 16GB option and made the comparison more honest. The chip doesn't have any such limitation.

comment 4y ago · link · parent

M2 is not limited to 8GB. 8GB is only the base Macbook Air M2 model. You can buy one with 16 or 24GB. Most people who buy 8GB Macs these days complain about performance, while people with 16GB praise it.

comment 4y ago · link · parent

Or become a priest and eat the offerings.

comment 4y ago · link · parent

First social nocturnal species of mammals that come to my mind are hyenas and beavers. But it does seem that most social mammals are diurnal.
1
282930
55