frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Binfmtc – binfmt_misc C scripting interface

https://www.netfort.gr.jp/~dancer/software/binfmtc.html.en
60•todsacerdoti•6h ago

Comments

zx2c4•6h ago
Similar project of mine from a long while ago: https://git.zx2c4.com/cscript/about/
Surac•5h ago
So lovely
elitepleb•5h ago
similar to http://www.iq0.com/duffgram/com.html
JSR_FDED•5h ago
C is still my first love. You can hold the whole language in your head, and it’s fast. Yes there are footguns but it’s a libertarian programming language - you’re responsible for what you build. No hand holding.
ykonstant•2h ago
I like that too, but the problem is that C doesn't keep its end of the deal. No hand holding, but make what you are doing transparent. It used to be the case back in the 80s, but not anymore. Not with our optimizing compilers and oodles of UB and spec subtleties and implicit actions.
radiospiel•4h ago
Amazing; when I tried something similar I used a "#!" line pointing to a C compiler + runner of sorts (https://github.com/radiospiel/jit). https://git.zx2c4.com/cscript/about/ is also following that approach.

What is the benefit of registering an extension via binfmt_misc?

lmz•4h ago
It's still valid C source code? Is the #! sequence valid C?
enriquto•3h ago
was surprised that "sudo apt install binfmtc" works out of the box on my box (linux mint) and i can do the magic just as described here
rwmj•3h ago
You can already do this without using binfmt ...

  #if 0
  gcc "$0" -o "$@".out && exec ./"$@".out
  #endif
  #include <stdio.h>
  int main () { printf ("hello, world\n"); return 0; }
Usage:

  $ chmod +x print.c
  $ ./print.c
  hello, world
(Could be better to use a temporary file though.)

There's a similar cute trick for compiled OCaml scripts that we use with nbdkit: https://libguestfs.org/nbdkit-cc-plugin.3.html#Using-this-pl...

mananaysiempre•2h ago
Compiler errors won’t cause as many funny consequences with

  gcc "$0" -o "$@".out && exec ./"$@".out || exit $?   # I'd use ${0%.c} not $@
Love this trick too, but the difference, as far as I understand, is that it only works with a Bourne(-compatible) shell, whereas shebangs or binfmt_misc also work with exec().
AlotOfReading•1h ago
You can also #embed the compiler binary, and execve it to much the same effect as binfmtc. I explored that trick for an IOCC entry that was never submitted because it ended up far too readable.
monocasa•3h ago
There's also tcc, which has a shebang compatible extension to allow it to be used by scripts.
kazinator•2h ago
This is doable entirely without a Linux-specific binfmt-misc hack.

https://rosettacode.org/wiki/Multiline_shebang#C

codr7•1h ago
I did a simple hack for doing the same thing from inside a C program for my book:

https://github.com/codr7/hacktical-c/tree/main/dynamic

Nginx Restic Back End

https://www.grepular.com/Nginx_Restic_Backend
20•mike-cardwell•3h ago•1 comments

Show HN: Let’s Bend – Open-Source Harmonica Bending Trainer

https://letsbend.de
29•egdels•3h ago•5 comments

How Compiler Explorer Works in 2025

https://xania.org/202506/how-compiler-explorer-works
18•vitaut•4d ago•0 comments

Gaussian Integration Is Cool

https://rohangautam.github.io/blog/chebyshev_gauss/
103•beansbeansbeans•10h ago•26 comments

Binfmtc – binfmt_misc C scripting interface

https://www.netfort.gr.jp/~dancer/software/binfmtc.html.en
60•todsacerdoti•6h ago•14 comments

Administering immunotherapy in the morning seems to matter. Why?

https://www.owlposting.com/p/the-time-of-day-that-immunotherapy
39•abhishaike•2h ago•45 comments

The last six months in LLMs, illustrated by pelicans on bicycles

https://simonwillison.net/2025/Jun/6/six-months-in-llms/
547•swyx•11h ago•159 comments

Joining Apple Computer (2018)

https://www.folklore.org/Joining_Apple_Computer.html
367•tosh•22h ago•98 comments

Cheap yet ultrapure titanium might enable widespread use in industry (2024)

https://phys.org/news/2024-06-cheap-ultrapure-titanium-metal-enable.amp
10•westurner•3d ago•1 comments

<Blink> and <Marquee> (2020)

https://danq.me/2020/11/11/blink-and-marquee/
170•ghssds•14h ago•143 comments

Efficient mRNA delivery to resting T cells to reverse HIV latency

https://www.nature.com/articles/s41467-025-60001-2
23•matthewmacleod•3d ago•5 comments

Bill Atkinson has died

https://daringfireball.net/linked/2025/06/07/bill-atkinson-rip
1518•romanhn•1d ago•257 comments

Self-Host and Tech Independence: The Joy of Building Your Own

https://www.ssp.sh/blog/self-host-self-independence/
365•articsputnik•1d ago•178 comments

Ask HN: How to learn CUDA to professional level

145•upmind•8h ago•55 comments

Convert photos to Atkinson dithering

https://gazs.github.io/canvas-atkinson-dither/
402•nvahalik•22h ago•46 comments

My experiment living in a tent in Hong Kong's jungle

https://corentin.trebaol.com/Blog/8.+The+Homelessness+Experiment
424•5mv2•1d ago•189 comments

Focus and Context and LLMs

https://taras.glek.net/posts/focus-and-context-and-llms/
42•tarasglek•10h ago•16 comments

Coventry Very Light Rail

https://www.coventry.gov.uk/coventry-light-rail
160•Kaibeezy•21h ago•216 comments

Field Notes from Shipping Real Code with Claude

https://diwank.space/field-notes-from-shipping-real-code-with-claude
205•diwank•1d ago•70 comments

Knowledge Management in the Age of AI

https://ericgardner.info/notes/knowledge-management-june-2025
98•katabasis•15h ago•60 comments

Launching the BeOS on Hitachi Flora Prius Systems (1999)

http://testou.free.fr/www.beatjapan.org/mirror/www.be.com/support/guides/hitachi_boot.html
4•doener•4h ago•1 comments

BorgBackup 2 has no server-side append-only anymore

https://github.com/borgbackup/borg/pull/8798
168•jaegerma•1d ago•100 comments

The printer that transcends dimensions and corrupts reality

https://ghuntley.com/ideas/
25•ghuntley•2h ago•7 comments

What was Radiant AI, anyway?

https://blog.paavo.me/radiant-ai/
203•paavohtl•1d ago•110 comments

Why We're Moving on from Nix

https://blog.railway.com/p/introducing-railpack
251•mooreds•1d ago•117 comments

Low-Level Optimization with Zig

https://alloc.dev/2025/06/07/zig_optimization
282•Retro_Dev•1d ago•175 comments

A tool for burning visible pictures on a compact disc surface (2022)

https://github.com/arduinocelentano/cdimage
182•carlesfe•1d ago•54 comments

Fray: A Controlled Concurrency Testing Framework for the JVM

https://github.com/cmu-pasta/fray
62•0x54MUR41•12h ago•3 comments

Discovering a JDK Race Condition, and Debugging It in 30 Minutes with Fray

https://aoli.al/blogs/jdk-bug/
130•aoli-al•1d ago•33 comments

The time bomb in the tax code that's fueling mass tech layoffs

https://qz.com/tech-layoffs-tax-code-trump-section-174-microsoft-meta-1851783502
1449•booleanbetrayal•4d ago•892 comments