NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Show HN: A (marginally) useful x86-64 ELF executable in 301 bytes (github.com)
vparseval 4 hours ago [-]
Love it! It's entirely inapplicable and useless to me but it embodies the spirit of Show HN and what the spirit of programming in the 80s and 90s was.
userbinator 1 hours ago [-]
It doesn't even look like particularly optimised Asm (could immediately spot a few savings, despite how horrible GAS syntax is to read...), but is definitely not "compiler slop"[1] either, which shows just how inefficient the majority of programs actually are. Of course even the ELF header takes up a significant amount of space, but this reminds me of how PC magazines would print short listings of utilities like this, often a few dozen up to a few hundred bytes at most --- in DOS .COM format, which is headerless and thus pure machine instructions.

[1] In the late 80s and early 90s, the battle between those writing handwritten Asm and those using compiled HLLs has many similarities to AI-generated vs non-AI code today.

meribold 4 minutes ago [-]
If the savings are about `mov $1, %edi` and `mov $10, %ecx`, those 32-bit immediate values line up with the higher bytes of p_filesz and p_memsz in the program header, which have to be zero [1]. If not, what are they? :)

[1]: https://github.com/meribold/btry/commit/8ef5a4ce58ae73c489d2...

Eric_Xua 2 hours ago [-]
Love this kind of tiny, over‑engineered hack—totally impractical, but pure Show HN energy.
emanuele-em 2 days ago [-]
301 bytes! The base64 one-liner install is a nice flex. Accepting an infinite loop when energy_full doesn't exist is peak code golf, perfectly reasonable when every byte counts. Is there a writeup on the assembly somewhere?
sjdv1982 2 hours ago [-]
Haha this is great!

What about adding a Make rule to auto-generate the one-liner install from the binary?

zahlman 3 hours ago [-]
The xz step doesn't seem to be doing very much, though. It seems the decoded data is currently 278 bytes versus a 298-byte decompressed result.
captn3m0 4 hours ago [-]
I have a use for this: A somewhat portable one-liner to go in my waybar/sway/i3 configs!
darioterror 3 hours ago [-]
[dead]
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 08:06:44 GMT+0000 (Coordinated Universal Time) with Vercel.