Created
July 27, 2024 01:14
-
-
Save a17sol/79406f03bbcafd755be371b101288669 to your computer and use it in GitHub Desktop.
Quine clock without cheating like linker source code embedding etc. Inspired by https://gist.github.com/rexim/f582098611b2be202051ba543e21da05. Compile: gcc -include stdio.h -include string.h -include time.h -include unistd.h quine_clock.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char *s="char *s=%c%s%c; char S[1024];int d[] = {32319,31812,19129,32437,31879,991\ | |
1,30399,4001,32447,32439,320};void main(){sprintf(S,s,34,s,34,34,92,34,34,34,34,34\ | |
,34,92,34,10);for(;;){int lin=-3,G=-5,i=0;for(i;i<strlen(S);i++){time_t t=time(0);\ | |
printf(%c%cx1b[%%s%c,(d[ctime(&t)[G/4+11]-48]>>(lin+(G%4)*5))&1&&!((G-15)/16)&&!((\ | |
lin-2)/3)?%c31m%c:%c90m%c);putchar(S[i]);G+=i%2;if(G>35){putchar(lin<2?92:0);putch\ | |
ar(10);lin++;G=-5;}}sleep(1);printf(%c%cx1b[11A%c);}}%c"; char S[1024];int d[] = { | |
32319,31812,19129,32437,31879,9911,30399,4001,32447,32439,320};void main(){sprintf | |
(S,s,34,s,34,34,92,34,34,34,34,34,34,92,34,10);for(;;){int lin=-3,G=-5,i=0;for(i;i | |
<strlen(S);i++){time_t t=time(0);printf("\x1b[%s",(d[ctime(&t)[G/4+11]-48]>>(lin+( | |
G%4)*5))&1&&!((G-15)/16)&&!((lin-2)/3)?"31m":"90m");putchar(S[i]);G+=i%2;if(G>35){ | |
putchar(lin<2?92:0);putchar(10);lin++;G=-5;}}sleep(1);printf("\x1b[11A");}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment