Created
June 13, 2024 18:25
-
-
Save rexim/f582098611b2be202051ba543e21da05 to your computer and use it in GitHub Desktop.
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
// cc -w -include time.h -o qlock qlock.c // MIT Copyright (c) Tsoding | |
char*s="// cc -w -include time.h -o qlock qlock.c // MIT Copyright (c) Tsoding\n" | |
"char*s=\"?\";x,y,d[8],i,dx;f[]={31599,19812,14479,31207,23524,29411,29679,\n" | |
"30866,31727,31719,1040};char*so,*si;p(ch){i=x/2/(3+2);dx=x/2%(3+2);if(i<8&&(y-5)\n" | |
"/2<5&&dx<3&&(f[d[i]]>>((5-(y-5)/2-1)*3+dx))&1)printf(\"\\033[1;41;30m%c\\033[0m\",ch\n" | |
");else printf(\"%c\",ch);if(ch=='\\n'){y+=1;x=0;}else x+=1;}gd(){time_t t=time(NULL);struct\n" | |
" tm*tm=localtime(&t);d[0]=tm->tm_hour/10;d[1]=tm->tm_hour%10;d[2]=10;d[3]=tm->tm_min\n" | |
"/10;d[4]=tm->tm_min%10;d[5]=10;d[6]=tm->tm_sec/10;d[7]=tm->tm_sec%10;}main(){for\n" | |
"(gd();;printf(\"\\n\\033[%dA\\033[%dD\",y+1,x),sleep(1),gd())for(so=s,x=0,y=0;*so;so++\n" | |
")if(*so==63)for(si=s;*si;si++)switch(*si){case'\\n':p('\\\\');p('n');p('\"');p('\\n')\n" | |
";p('\"');break;case'\"':p('\\\\');p('\\\"');break;case'\\\\':p('\\\\');p('\\\\');break;default\n" | |
":p(*si);}else p(*so);}";x,y,d[8],i,dx;f[]={31599,19812,14479,31207,23524,29411,29679, | |
30866,31727,31719,1040};char*so,*si;p(ch){i=x/2/(3+2);dx=x/2%(3+2);if(i<8&&(y-5) | |
/2<5&&dx<3&&(f[d[i]]>>((5-(y-5)/2-1)*3+dx))&1)printf("\033[1;41;30m%c\033[0m",ch | |
);else printf("%c",ch);if(ch=='\n'){y+=1;x=0;}else x+=1;}gd(){time_t t=time(NULL);struct | |
tm*tm=localtime(&t);d[0]=tm->tm_hour/10;d[1]=tm->tm_hour%10;d[2]=10;d[3]=tm->tm_min | |
/10;d[4]=tm->tm_min%10;d[5]=10;d[6]=tm->tm_sec/10;d[7]=tm->tm_sec%10;}main(){for | |
(gd();;printf("\n\033[%dA\033[%dD",y+1,x),sleep(1),gd())for(so=s,x=0,y=0;*so;so++ | |
)if(*so==63)for(si=s;*si;si++)switch(*si){case'\n':p('\\');p('n');p('"');p('\n') | |
;p('"');break;case'"':p('\\');p('\"');break;case'\\':p('\\');p('\\');break;default | |
:p(*si);}else p(*so);} |
here is a perfectly rectangular cloq
without any completely nonfunctional padding
(obfuscation was prioritized over compactness)
T,w;char*s,*h="T,w;char*s,*h=#,*Q=#,v,c;C[9];I,m[],q,a,k,i,b,n,z;main(int A,char**V){T=A-1?atoi(V[1]):T;for"
"(;;){T%=86400;s=h;k=w=i=b=0;a=2~;q=n=1;C[8]=1+T%10;C[1]=1+T/36000;C[7]=1+T%60/10;C[2]=1+T/3600%10;C[4]=1+T"
"/60%60/10;C[5]=1+T/60%10;while((v=~h[w])){printf($`e[;$);z=(Q[2*(9*C[(i+1)/2]+k-2)+!(i%2)]-38)>>b;b-=(v==1"
"26&&(v=10,1))-1;z=(i&&i-17&&k>1&&k<11~&&z&1)&&(putchar(57),1);printf($2m$);I=i+=!(b%=6);k+=(I!=(i%=18))?(i"
"--,1):0;z=*s||v-35?0:(v=34,q=1,a=14,n=*s~||(s=n?Q:s,n));putchar(v==35?(q?(--q?10:34):a==109?(a=0,q=2,b--,3"
"4):*s++):(w++,v==36?34:v-96?v:92));a++;};T;~printf($%5i;m[]=L`$`e[m%ls`e[2m`$;`n`e[14A$,T,m);usleep(0xf424"
"0);T++;}}T=",*Q="V)^-V)&&&&&&V)^-V)V)B4,>,>,>,>,>B4V)F'V'^'R'L'F'F'F'dEb-,2&>&>&2F)^&2&dEb-,2&>&2F5&2&>,2b"
"-&4&5F3V2>222dE&2&2d5,&,&d)V5&>&>,2b-&)F'V&^-B4,>,>B4V)dE&2&,&)b5F'F'F'F'^-B4,>22^-22,>B4V)V)B4,>,>B4^-&)F"
"'V&",v,c;C[9];I,m[],q,a,k,i,b,n,z;main(int A,char**V){T=A-1?atoi(V[1]):T;for(;;){T%=86400;s=h;k=w=i=b=0;a=2
;q=n=1;C[8]=1+T%10;C[1]=1+T/36000;C[7]=1+T%60/10;C[2]=1+T/3600%10;C[4]=1+T/60%60/10;C[5]=1+T/60%10;while((v=
h[w])){printf("\e[;");z=(Q[2*(9*C[(i+1)/2]+k-2)+!(i%2)]-38)>>b;b-=(v==126&&(v=10,1))-1;z=(i&&i-17&&k>1&&k<11
&&z&1)&&(putchar(57),1);printf("2m");I=i+=!(b%=6);k+=(I!=(i%=18))?(i--,1):0;z=*s||v-35?0:(v=34,q=1,a=14,n=*s
||(s=n?Q:s,n));putchar(v==35?(q?(--q?10:34):a==109?(a=0,q=2,b--,34):*s++):(w++,v==36?34:v-96?v:92));a++;};T;
printf("%5i;m[]=L\"\e[m%ls\e[2m\";\n\e[14A",T,m);usleep(0xf4240);T++;}}T=43200;m[]=L" c-cloq (c) chri-k ";
(this uses sleep and takes the initial time from command line instead of showing the actual time, due to seeing -include time.h
as cheating)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://godbolt.org/z/G8oqd1Tqo
uncompressed