9 ms·
I Implemented /dev/printerfact in Rust
- O_H_E 6y agoI know I am being pedantic, but it is a bit weird to editorialize "How I Implemented /dev/printerfact in Rust" to "I Implemented...", make the author come off a little more boastful than they intended to.
- a_t48 6y ago"I reimplemented" might be better
- xena 6y agoAuthor of the article here, I think "I Implemented" is the least wrong way to phrase it. I didn't reimplement it because it didn't exist before I implemented it.
- a_t48 6y agoDidn't realize it was only a web thing before - that's fair. Edit: I hadn't had my coffee yet, reading comprehension wasn't yet active. :)
- pcr910303 6y agoHN strips out prefix ‘How’s by default. I guess that was applied here as well...
- deleted 6y ago[deleted]
- O_H_E 6y agoUmmm...I dont think so https://hn.algolia.com/?dateRange=pastYear&page=0&prefix=true&query=%22how%20i%20%22&sort=byPopularity&type=story https://hn.algolia.com/?dateRange=pastYear&page=0&prefix=tru...
- deleted 6y ago[deleted]
- scrollaway 6y agoThese titles you linked are re-edited to add the "How" back.
- iudqnolq 6y agoThe author implemented /dev/printerfact. Someone else came up with printerfact. If someone said they implemented /dev/null I wouldn't think they came up with the concept of null. Also printerfact was implemented by a high person with sed and a list of cat facts. While excellent, it's not an incredible achievement we need to defend the integrity of.
- whateveracct 6y agothis is one of my favorite Nix blogs out there! the NixOS systemd timer one was great - I used it when I had to make my first timer and it was the best resource out there. The narrative style made it a fun read too. Feels like someone explaining things to me personally off the cuff.
- xena 6y agoAuthor of the post here. That's the style I try to go for, that balance of serious, shitpost and interesting side notes you'd get from DMing a particularly sarcastic coworker that means well on Slack. The Mara interludes add into this because it allows some blending in of the Socratic method to make some more complicated things something closer to a dialogue. I have plans to take this further though. If you have any suggestions on how I should skew these plans please let me know.
- xwx 6y ago> Printers have been domestiprintered for half as long as scanners have been.
- malf 6y ago> Printer facts were originally made by a very stoned person that had access to the Cat Facts API and sed. As such instances like indiprintere are features.
- gerdesj 6y agohttps://printerfacts.cetacean.club/ https://printerfacts.cetacean.club/ Follow the various links. See if you can jump to the same conclusion as me regarding who forgot to anchor their regexes when playing with Cat Facts 8)
- xena 6y agoIt's a feature.
- j-krieger 6y agoI enjoy christines style of writing very much. I can only recommend it to anyone out there interested in dev ops, rust or nix. Her narrative style and different characters may be a bit jarring at first, but I got used to it pretty fast.
- ecf 6y agoOn the other hand, I found this style of writing detestable. > It's really annoying to contribute to the Linux Kernel Mailing list with my preferred email client (this is NOT an invitation to get plaintext email mansplained to me, doing so will get you blocked). Get over it. The maintainers of the project have to keep in mind tens of thousands of contributors from all walks of life and I wouldn’t miss a single thing by being blocked by this author.
- wildmanx 6y agoIt took me a sadly too-long time to realize that this had nothing to do with any printer API. Like, I read the whole post, and all the comments here on HN. And only _then_ did it dawn on me.
- xena 6y agoAuthor of the post here, I love those kinds of slow burns. I'm really glad you managed to experience one.
- amluto 6y ago> It's really annoying to contribute to the Linux Kernel Mailing list with my preferred email client (this is NOT an invitation to get plaintext email mansplained to me, doing so will get you blocked). Heh. I really wish the kernel list would detect that a post has valid text and html content and just throw away the html rather than rejecting the whole thing. Plain text is, sadly, not a first class feature of most non-terminal email clients these days.
- readingnews 6y ago> I really wish the kernel list would detect that a post has valid text and html content and just throw away the html Because. https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags https://stackoverflow.com/questions/1732348/regex-match-open... Honestly, I am not trying to put on my old-man hat, but I despise anything other than plain text in email. I agree with the KML. Email should not have binaries, html, tags, etc... of course, M$ and others will happily render them, so why not, right?
- iudqnolq 6y agoEmail can have multiple parallel payloads in different formats (see MIME). It's part of the spec, not a hack. The OP is suggesting that if LKML gets multiple payloads where it can understand one of them it just selects the one it can understand. This is what other text-only clients do. They're not suggesting parsing html into text (tangentially, if they were, there are much better approaches than the one you linked. One of the most commonly used ones is originally by Aaron Schwartz https://github.com/aaronsw/html2text https://github.com/aaronsw/html2text )
- seniorgarcia 6y agoI'm kinda curious which client makes writing plain text emails hard though.
- xena 6y ago
- iudqnolq 6y ago> "Printers can judge within 3 inches the precise loprinterion of a sound being made 1 yard away." > Printer facts were originally made by a very stoned person that had access to the Cat Facts API and sed. As such instances like indiprintere are features. I love this.
- Grollicus 6y agoHow does this /dev/printerfacts react to partial reads? Does it mix multiple facts?
- xena 6y agoIf your buffer is too small it will just fail. It ends the file after a fact is returned. I think I forgot to shout that out in the article. Oops.
- Grollicus 6y agoAh yes because `write_slice` fails. That's actually nice and quite ergonomic with the ?. Well, thanks for the quick intro for how to actually use this new rust-in-kernel stuff and also for showing how to easily test it with nix. That's a great article, so thank you for sharing!
- tialaramex 6y agoNote that the source JSON data is corrupted. Basically somebody has some UTF-8 encoded data but they've told a machine it is Latin-1 (ISO-8859-1) and then it has produced the Unicode escaped output as-if that was true, so for example where there should be a single Unicode codepoint for a dash, there is instead three nonsensical Unicode codepoints for Latin-1 characters you didn't mean. You could probably fix that inside the driver, but likely the owner of the JSON file should just fix it to not be gibberish.
- lilyball 6y agoI love this so much! It’s a really helpful demonstration of how to do Kernel stuff in Rust with Nix, using a ridiculous shitpost idea, and it’s written in a very enjoyable way. I’m just annoyed that I hadn’t run across their blog before now.
- barneygale 6y agoWhy are there cartoons of human/animal hybrids? Is this some fetish thing?
- xyst 6y agothe use of the neopets-like characters is kind of distracting
- marsven_422 6y agoThings you blog post said about you. 1 : "I'm a girl, I'm entitled to extra attention!" 2 : "I think C is shit" 3 : "I use furry SJW iconography, I'm a good person" 4 : "I use sexist language to shit on men" Please take your CoC Rust Trojan elsewhere!
- Zardoz84 6y agoNice article. But I'm sad about how some morons reacted about the last paragraph.