Skip to content

Instantly share code, notes, and snippets.

@LostMyselfInTheNowhere
Last active February 24, 2024 16:08
Show Gist options
  • Save LostMyselfInTheNowhere/249d62985c2025b04c89f20c8902f293 to your computer and use it in GitHub Desktop.
Save LostMyselfInTheNowhere/249d62985c2025b04c89f20c8902f293 to your computer and use it in GitHub Desktop.
Shell stub for C, makes the source file compile itself just by running it (C/Bash polyglot)
#define SHELL_STUB /*
CC="gcc"; "$CC" -o "$0.elf" "$0"; ./"$0.elf"; rm -rf "$0.elf"; exit
*/
#include <stdio.h>
int main(void) {
printf("Hello! ^w^\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment