Skip to content

Instantly share code, notes, and snippets.

@pouyatafti
Last active August 18, 2020 11:27
Show Gist options
  • Save pouyatafti/cd9f277b714acf60fccdb581c981fbdb to your computer and use it in GitHub Desktop.
Save pouyatafti/cd9f277b714acf60fccdb581c981fbdb to your computer and use it in GitHub Desktop.
Linux process Moomin ASCII art (via ps x)
#include <string.h>
#include <unistd.h>
char *moomin[] = {
" . ,",
"ASCII art (c) Maija Haavisto (@DiamonDie)",
"",
" \"._.' `' mh/VK",
" `. `, `. .'",
" . .' `. `' ;",
" `--' , __,..- ' .",
" `. .' . '",
"\\W; . \"` .",
",,. . ` . `. .",
" . `. `. .",
" . . `. .",
" . .",
" `.",
" . `\"-.___.\"",
" ._ .'",
" . :",
" . \" \" `.",
" . (.) (.)--._",
" _ \\",
" . `.",
" .';_.';",
};
int
main(int argc, char **argv) {
long s = 0, p = 0, n = sizeof(moomin)/sizeof(char *);
char *ps = *argv;
while (argc--)
s += strlen(*argv++) + 1;
while (--n)
if (fork() == 0) break;
strncpy(ps, moomin[n], s-1);
ps[s-1] = 0;
while (1) {
sleep(10);
}
return 0;
}
#!/bin/sh
BUFFER=".................................."
cc -o moomin moomin.c
./moomin $BUFFER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment