HNHacker News
TopNewBestAskShowJobs

bitofhope

641 karma · joined January 13, 2018

[ my public key: https://keybase.io/bitofhope; my proof: https://keybase.io/bitofhope/sigs/i7HzS9End4EIQFrVLQSdl0shHU-zBhqbcpZEPHEMhdU ]
submissionscomments
bitofhope··on Email and Git = <3
This site seems to be made by Drew DeVault who also runs sourcehut.
bitofhope··on Open source code with profanity in comments is statistically better
Sounds like you're suggesting a causal relationship the other way, though. As per this explanation, putting effort into debugging edge cases will statistically cause the comments to swear more.
bitofhope··on Open source code with profanity in comments is statistically better
Rorschach test for programmers: give your confident gut feeling explanation for this phenomenon.

I'll do mine: there's likely a correlation between needing to maintain a professional conduct which includes forgoing foul language (you're programming at work) and writing code under time pressure where getting a product ready for release is more important than strict adherence to clean programming practice (you're programming at work).

Everyone post your favourite conjecture!

bitofhope··on A brief history of insults
I believe "go bananas" is a bit of metonymy from "go ape", possibly through "go apeshit", with the idea that bananas are something of a precursor to primate excrement.
bitofhope··on Jacob Ziv has died
Paying my respects to a pioneer.

I started a project to implement a LZ77 decoder in Game Boy assembly to see if it could compress the sprites in Pokémon Red and Blue versions better than the algorithms actually used in the game. Results are inconclusive so far, but it's been an enlightening experience.

bitofhope··on NetHack 3.6.7
Just a security patch, but I like seeing NetHack featured.

Looking forward to 3.7 where they finally address a glaring omission where up until now deities have been weirdly indifferent about people vomiting on altars.

bitofhope··on Undefined Behavior, and the Sledgehammer Principle
The expression ((INT32_MAX / 0x1ff) <= x) is well-defined and will not cause overflow for any value of x of type int32_t. There is nothing to "optimize away" because there are no inputs that would invoke undefined behavior.

The original code was like this:

        if (x < 0)
            return 0;
        int32_t i = x * 0x1ff / 0xffff;
        if (i >= 0 && i < sizeof(tab)) {
(x * 0x1ff / 0xffff) can only be negative if (x < 0), which can be ruled out because the function would have returned already, or if a signed overflow has occurred, which is undefined behavior so anything can happen. The compiler can remove the (i >= 0) check because the only way it's false is if undefined behavior has already been invoked.

If you add the overflow check you quoted before the assignment, the compiler can still optimize away the (i >= 0) check like before with the same reasoning. Only this time the function will return before an overflow would occur.

The point of the "sledgehammer principle" described in the article is that UB checks must occur before the UB might be invoked and branch away. You obviously can't do this either:

    int i = 2 / x;
    if (i != undefined) {
        return i;
    }
    return 0;
Instead, you'll have to do something like:

    if (x != 0) {
        int i = 2 / x;
        return i;
    }
    return 0;
bitofhope··on I have reached Vim nirvana
AltGr+8 is reasonable enough that I don't feel like learning a new layout.

Ctrl+AltGr+8 is involved enough that I might as well press Esc.

A lot of software developers are unaware of the AltGr[1] key or even assume US ANSI layout altogether so as a user I have been trained not to take keybindings involving that layer for granted.

As a real world example of similar issues, there's piece of software (I think it was telnet or mosh, but I apologize if I misremember) where Ctrl+^ is used as an escape sequence. This doesn't work for me, possibly because caret is a dead key[2] on my keyboard. For some reason, perhaps related to using scancodes instead of key codes, Ctrl+6 happens to work in that application.

[1] https://en.wikipedia.org/wiki/AltGr_key [2] https://en.wikipedia.org/wiki/Dead_key

bitofhope··on x86 Quine: These 12 Bytes of Machine Code Print Themselves (2005)
I'll argue for it not being cheating in this case. Consider this C quine:

    #include <stdio.h>
    int main(int c,char** v){char*s="#include <stdio.h>%cint main(int c,char** v){char*s=%c%s%c;printf(s,10,34,s,34,10);}%c";printf(s,10,34,s,34,10);}
Surely this should count as a non-cheated quine? Still, parts of the code (namely, the contents of string s) are embedded directly in the binary:

    % clang -std=c99 -pedantic quine.c -o quine; strings quine | grep include
    #include <stdio.h>%cint main(int c,char** v){char*s=%c%s%c;printf(s,10,34,s,34,10);}%c
Even though parts of the original source survive in the binary and are passed as pointers to a print function, the source code itself doesn't get read at compile or runtime (aside from being read once into the compiler).

If it's OK to read parts of the loaded binary to use as strings, I don't see why it wouldn't be OK to read the whole loaded binary, as long as you touch the source code file. I'd simply accept that the platform allows for some fairly trivial quines.

bitofhope··on C isn't a programming language anymore
Anyone know any good articles, tutorials or books about ABI design? How did we end up with what we have now, what lessons are there to learn? How would you go about designing a new one from scratch? Would this fall more under operating systems or compilers discipline?
bitofhope··on Linux boot partitions and how to set them up
I yearn for a world where hard disk partitions are a memory of primitive times past confined to the minds of retrocomputing enthusiasts. I want my system board to have a firmware that can detect common variants of volume management including LVM and zpools, perhaps that thing Windows has that's kinda like software RAID for people into that kind of thing, perhaps even stuff like OpenBSD's softraid stuff.

1. Find physical disks that may be a part of a managed volume group/pool 2. Find logical volumes and file systems on the volume pools 3. Mount a filesystem by some configurable logic 4. Load and execute a kernel from the filesystem

Having to allocate the first "blocks" on the imaginary "sectors" of my SSD (or even worse, a virtual disk drive) for some arbitrary amount of space formatted in possibly the most barebones filesystem still in mainstream use feels quaint and irritating and limits my ability to use that disk in a larger storage pool.

UEFI is an overcomplicated specification with lots of wintel baggage, but most of it doesn't personally offend me. What does is that UEFI had the chance to abolish disk partitioning, but instead enshrined it. And added mandatory FAT32 to add insult to injury.

My main laptop and desktop each have a separate disk for the EFI system partition. The former uses systemd-boot and the latter ZFSBootMenu. This way I have a maximum of one partition per disk. It's not ideal, but I like it better than the usual solution.

The disks in my zpool show up as having partitions 1 and 9, but I consider that an implementation detail since I never need to treat the disks as anything other than entire disks in a pool

bitofhope··on 9front “The Golden Age of Ballooning” Released
OCR hardly needed. Just read /dev/text.

I don't think the mouse chording is that essential to Plan 9. It's how rio and acme work, but those programs can be replaced without throwing away most of the OS concepts. I think you could absolutely create a Plan 9 UI that, for example, uses vi-like key bindings to jump around windows and text. Nobody's just done it yet and hardcore users are happy enough with what they have for now.

bitofhope··on Shell script best practices, from a decade of scripting things
There are workloads where shell scripts are the so-called right tool for a job. All too often I see people writing scripts in "proper" languages and calling os.system() on every other line. Shell scripts are good for gluing programs together. It's fine to use them for that.
bitofhope··on Emacs User Survey (2022)
Likewise, I was filling out the survey while not on my work machine where I use emacs.
bitofhope··on Copilot under fire as dev claims it emits 'large chunks of my copyrighted code'
It did get me thinking about something here.

The deal with patents is that you make the way your invention works public knowledge. You document the principle and in exchange you get a limited-time monopoly on its implementation. An alternative for this is a trade secret. As long as you guard the secret, you can remain the only one profiting off it. Of course, some things are impractical to keep secret. It's easier to keep a method of making a fizzy drink under wraps than how the gears are laid out in the gadget you sell.

You also can't really make the contents of a book a secret. Anyone can just look at their copy, arrange words in the same order as you did and sell your book. It also makes no sense to patent the words. The contents are already inherently public knowledge to a certain extent and now people could just buy the book from a patent office. And the clerks don't like filing novel-length applications. Music is not quite as easy to make a 1-to-1 copy of, especially before wide adoption of sound recording technology, but a lot of people can carry a tune well enough to plagiarize one. And sometimes you get a child prodigy Mozart illegally transcribing Miserere.

Since it has been deemed desirable [if not unanimously] that writers and artists also have a period of monopoly rights over their work, copyright needs to work differently from patents.

Software has interesting properties. Unlike a book, you can distribute a program but keep its "recipe" a secret. We'll disregard people who are capable of working with compiled binaries; consider them modern-day transcribers of Miserere. Proprietary code is typically guarded just as any trade secret would be. Perhaps software should have been covered by patents instead of copyright from the beginning. After the patent expires, the algorithm would be unencumbered and public knowledge.

But that's not the world we live in. Software is considered to be like a book, not like a pocket watch. You could mail me a printout of the entire Windows 11 source and there's hardly anything I could ever legally do with it. I could change it for my own amusement I guess, like I can take a red pen and change all the names in my copy of Postmodernism for beginners.

bitofhope··on Copilot under fire as dev claims it emits 'large chunks of my copyrighted code'
Free Software vs Open Source is not about copyleft vs permissive. The GPL is both a Free and an Open Source license. The MIT license also counts as both Free and Open Source.

Most permissive licenses — and most popular permissive licenses — include a copyright statement and conditions which would not be enforceable without copyright. They usually require redistribution of the original copyright notice and license text to be distributed along with copies or derivatives of the work.

bitofhope··on Copilot under fire as dev claims it emits 'large chunks of my copyrighted code'
I don't think I've seen anyone bring up patents. Those are a different matter altogether. "Copyrighted algorigthm implementations" is a little trickier, since any program code is essentially an "algorithm implementation" so there's a lot of potential nuance where to draw the line on where (if anywhere) a mere algorithm ends and a work with claimable copyright begins, in a moral sense.

Most software licenses are not full carte-blanche do-whatever copyright waivers. Sure, it would be hypocritical to get up in arms about copilot emitting CC0/WTFPL/Unlicense code, but comparatively little software is released under such licenses.

The GPL (in all its versions) is almost as notable for the specific conditions placed on the freedoms it offers as it is for those freedoms themselves. One possible reason to release your code under GPL is that it you don't want your work used in proprietary developer tools. It doesn't really matter then if the code is used in a proprietary developer tool's training data set instead of its own program code.

Even permissive licenses typically come with some conditions attached. If I release a program under MIT license and someone then uses portions of that code in their own project, I expect to see my name and the MIT license included in some way. Perhaps a line in the README, an ACKNOWLEDGEMENTS.txt or a comment like

  // This function taken from quuxifier (https://example.org/software/quux)
  // ⓒ bitofhope 2022, used under the MIT license. See doc/licenses/MIT or
  // https://spdx.org/licenses/MIT.html for details.
The same, in my opinion, applies if recognizable (for some definition and threshold of recognizable, which can and does get deep into lawyer territory) portions of that code are emitted by a convolution network. If Copilot can write my function, why can't it write my name and choice of license too?

Even if you are a full copyright abolitionist, you can still point out the hypocrisy from the opposite side. Github's parent company Microsoft is notoriously protective of its proprietary code and its copyright. The company has historically been explicitly hostile to the free software community and despite its later unilateral declaration of love for open source continues to profit from their proprietary code, including Copilot. If you spend a decade or a few calling open source a cancer and campaigning against it, you can expect that to come bite you in the ass when you later try to sell a neural network trained on a vast corpus of free and open source software.

bitofhope··on We are stuck with egrep and fgrep (unless you like beating people)
You can technically pipe to streams other than &1 and &2, so you could use

  printf "WARNING: %s" "$warn_msg" >&3
But of course, nonstandard.
bitofhope··on We are stuck with egrep and fgrep (unless you like beating people)
If a book on writing portable shell scripts across *nix platforms depends on commands not specified by POSIX, I don't think those books are doing their job very well.
bitofhope··on We are stuck with egrep and fgrep (unless you like beating people)
>I'm definitely not in favor of fossilizing Unix, but there's a difference between avoiding fossilization and the kind of minimal, mathematical purity that we see GNU Grep trying to impose here.

I can't really see the difference. Adding a deprecation warning to stderr in a non-POSIX command 15 years after deprecation notice is among the smallest possible changes to [GNU's Not] Unix I can think of. Even then, the change is trivially silenced by deleting a single line in a shell script or two[1] and seems that some distros already do that for you[2].

Yes, this will break something for someone[3] and I might well be that someone. You truly have my sympathies. But if you want to run a system for a decade and a half without ever needing changes, stick to POSIX. You can't have your fossils and eat them too.

[1] https://git.savannah.gnu.org/cgit/grep.git/commit/src/egrep.... [2] https://github.com/void-linux/void-packages/pull/39340 [3] https://xkcd.com/1172/

bitofhope··on MAR1D: First-Person Mario
Consider a number line:

      ┼─┼─┼─┼─┼─┼─┼─┼─┼─┼
  ... 0 1 2 3 4 5 6 7 8 9 ...
Any point on the line can be described by a single coordinate, so the line is one-dimensional.

We could also describe all of them in terms of a two-dimensional plane [(0,0), (0,1), (0,2) etc.] but that would just be redundant. Just like representing the number line with a taller figure doesn't really make the abstract line any different:

      │ │ │ │ │ │ │ │ │ │
      ┼─┼─┼─┼─┼─┼─┼─┼─┼─┼
      │ │ │ │ │ │ │ │ │ │
  ... 0 1 2 3 4 5 6 7 8 9 ...
So for a single-pixel wide view of SMB from first person perspective, we could consider it a degenerate case of a 2D view if we indexed them (0,1), (0,2), (0,3)... but that would be redundant as they're sensibly just 0, 1, 2...

Consider that any 2D image you see on your screen is just a single-pixel deep 3D image and a single-pixel 4D-protruding 4D image and so on.

bitofhope··on GDPR for Developers by Example
Most laws are at least somewhat ambiguous and unreadable for the layperson. The gist of the GDPR is not particularly hard to understand and a lot of the complexity comes from covering obvious loopholes. In my opinion, the GDPR is not clumsily implemented at all (well, not within its text anyway). It's also deliberately technology-agnostic, to prevent a trivial loophole (Oh, I'm not tracking you through cookies, I'm tracking you through Biscuits™, totally different!) and that's one reason why a list of scenarios with clear-cut answers is not really possible.

A lot of tech involves interacting with data about people, so the software industry is affected by GDPR particularly hard. That's why you'll have a lot of people on a tech industry news website who may gave to consult a lawyer about the regulation.

Similarly, new traffic safety laws might have logistics companies seeking legal advice, health and safety regulations might have food companies doing the same or financial regulations might have any type of company ask a lawyer about the implications.

Besides, you might not be a layperson. There's a good chance if you frequent this website that you are a professional expert in different ways to store and use data for various purposes. In that case it might be a wise idea to take the time to learn your legal responsibilities with personal data to a slightly deeper standard than most people do.

bitofhope··on Bunny fonts – privacy respecting drop-in replacement for Google Fonts
This breaks multiple desirable uses of cookies, unless they're explicitly allowed on a per-site basis. It doesn't help if a site uses cookies for both desirable and undesirable purposes. If this solution became ubiquitous, I'd predict websites would start showing popup banners nagging you to click the "enable cookies" button from next to the URL bar. Finally, even if this did work to stop websites from tracking users via cookies, the data harvesters would simply keep using non-cookie tracking methods like browser fingerprinting.

In contrast, the GDPR does not place requirements for cookies if they're not used for storing or processing personal data (the ePrivacy directive which I'm less familiar with might require a notification about them). It does not even require a popup or user's confirmation if personal data is processed on a legal basis other than consent (though these uses may need to be listed in some kind of available privacy policy document). Finally, as GDPR is mostly technology agnostic, its requirements remain the same regardless of whether the data collection is done using cookies or any other means.

bitofhope··on Bunny fonts – privacy respecting drop-in replacement for Google Fonts
In this case the problem with GDPR is not how it's written but how it's enforced (or rather, how little it's enforced). Most of the cookie popups that appear while browsing are already blatant violations of the law, but the violators get away with them because the relevant authorities are overwhelmed/underfunded/dysfunctional.

>If they asked anyone with atleast a minimal technical knowledge, they'd get a lot better solutions.

This sentence implies that: (1) Nobody with even minimal technical knowledge was consulted when writing GDPR. (2) The problem of websites tracking their users can be solved through technical means. (3) One or more of the solutions are so trivial anyone with minimal technical knowledge could come up with them.

I disagree with all of the above assertions.

bitofhope··on Bunny fonts – privacy respecting drop-in replacement for Google Fonts
>And we can thank EU for the extremely annoying cookie pop-up’s on every website. Every site has a slightly different UI and the options/button labels always vary. Declining is always a multi-step process with various checkboxes.

No we can't. We can think of scummy adtech companies who feel entitled to their business model.

The GDPR very specifically says that the option to decline tracking must be at least as easily accessible as the option to accept.

The only way the EU is to blame for the pop-ups is that the regulation hasn't been enforced strictly enough.

bitofhope··on Mundane chores are all the rage in gaming
I also occasionally enjoy cheating in video games, but it's rarely about the game itself at that point anymore. I've noticed it's not really about avoiding tedious or unpleasant parts of the game for me. I just think it's funny to have tutorial enemies yielding astronomical amounts of XP and gold or to have random Great People born in my cities every single turn. No kill like overkill.

It's also educational. Creating overpowered joke Civ4 mods and reading disassemblies of NES games to adjust numbers in an emulator's debugger make for fun semi-practical programming puzzles. Honestly, I think I enjoy the process of cheating more than the result.

Try it out sometime! Load up some old game in gdb and start messing with the numbers. It can be fun.

bitofhope··on In defense of cryptocurrency
I have witnessed and participated in thousands of user-fork interactions and none of them have involved the user's eyeballs interacting with the fork.

There is a chance (in my estimate, negligible) that my anecdote is an extreme outlier, but I still dare state with confidence that most forks today are designed in a way that less than 99% of users end up sticking them in their eyeballs.

People using forks for the unconventional and usually unintended purpose of impaling their eyes* are a tiny minority of fork users and thus changing fork designs to encourage the intended method of use is not considered a high priority. Most people are naturally disinclined to pierce themselves, particularly in such a delicate part of their face, and as such the design of a typical fork with its pointy tines directs users to avoid this particular usage mistake.

The thesis stated above in the thread was, that cryptocurrencies are very commonly used in a way that defeats their intended purpose of decentralization. It seems reasonable to assume there is a flaw in contemporary cryptocurrency implementations that encourages this kind of use, or at the very least, doesn't discourage it very strongly.

* Excluding specialized forks for non-mainstream audiences such as very young children

bitofhope··on A Modern Space Cadet
The Space Cadet did not use Cherry switches. It was made by Micro-Switch and thus used Honeywell's hall effect switches. The switches are very highly regarded and presumably very nice to use if you're into linear keyfeel. Some later LISP machine keyboards used Hi-Tek space invaders if I'm not mistaken.

It seems a little unfair to call the board crappy. A lot of keyboards had a little bit of flex to them. Most modern keyboards (even premium ones) still flex a little bit. There were better -- or at least more solid-feeling -- keyboards around at the time, some of them more common and cheaper, but calling a Honeywell board "crappy" is just downright hyperbole.

bitofhope··on Roguelikes: The Misnamed Genre (2011)
Late reply, but I'll bite.

I was under the impression that BI was a few years older than it is, so thanks for making me check. Actually, the fact it was made so recently and by people so familiar with the diversity of the genre makes me less forgiving of its weird specifics and priorities.

I do not and never did think Diablo single-handedly upended the definition, but I do believe it (and its sequel):

1) Took so many of its design elements from roguelikes that in the context of its time, it was not unreasonable to consider it a new take on that genre's formula

2) Was a major, if not definitive influence on many of the roguelites that would follow afterwards

Actually, if Hades and Angband were both called "diablolikes" instead, there would probably be much less fighting over it. ("Less" not implying none. Genres can always be fought over and naming genres after specific works rarely works well anyway)

As for Wizardry, EotB, Megami Tensei, I genuinely think they look closer to a quintessential roguelike than a lot of roguelites do. If those are the smart-ass edge cases, I'm pretty happy with my wording. I didn't even intend the description to be synonymous with roguelike, but "turn based dungeon crawler" seems to include almost all games I consider to be true roguelikes and less games I don't consider roguelikes than the most actual attempted definitions of roguelike I've seen around.

If it turns out that first-person dungeon RPGs with combat-specific interface are actually an especially prevalent subset of the turn-based dungeon crawler category, I might have to start differentiating the ones with top down perspective or non-modal gameplay. So far I haven't found that to be an issue.

bitofhope··on Microsoft to Acquire Activision Blizzard
If games are so expensive to make and sell so cheap, how come are the game companies getting bigger and making record profits year after year? Not that the median game developer seems to be much better off for it, though.

Besides, many of those $10 games that are $30 on the Switch are made by smaller teams or even solo creators. Just because some video game properties have grown into giant franchises with multimedia companies pouring tens and hundreds of millions dollars and armies of people into them, that doesn't mean the majority of video game titles around are like that.

Come to think of it, in the light of the countless recent stories of overwork and abuse in the games industry and the scandalous quality issues plaguing high-profile releases in recent years, I'm not even sure if we should be incentivizing games having a lot of work go into them.

How come is it entitlement to not buy things that cost more than you think they are worth, anyway? Expensive things don't become cheap just because they're cheaper than four decades ago nor because they happen to be created and marketed by large corporations with lots of employees.

https://www.youtube.com/watch?v=wlfyxWaeGCE

Page 1 of 4Next →