Unreadable scripts that print cool things (18)

1 Name: #!/usr/bin/anonymous : 2006-07-27 04:35 ID:eKs6qOaU

daniel@navi ~ $ cat bin/win.pl
#!/usr/bin/perl

$_="P;=N?;MA:LB:M\@;N><HA?3RC4RBFB\@EE>C?5CB>9A?>K;CJ7HI4?69J3<:9J39<9K39<9K3::;J49;?E59<AA59A>?76G8\@";$o='.';
s/(.)/for($i=0;$i<ord($1)-50;$i++){print$o;$l++;}if($o eq'.'){$o='x'}else{$o='.'}if($l>=50){print"\n"; $l=0;$o='.'}/ge;

daniel@navi ~ $ bin/win.pl
..............................xxxxxxxxx...........
............................xxxxxxxxxxxxx.........
...........................xxxxxxxxxxxxxxx........
..........................xxxxxxxxxxxxxxxx........
...........................xxxxxxxxxxxxxx.........
............................xxxxxxxxxxxx..........
......................xxxxxxxxxxxxxxx.............
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.................
..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx................
....................xxxxxxxxxxxxxxxx..............
...................xxxxxxxxxxxxxxxxxxx............
.................xxxxxxxxxxxxx...xxxxxxxxxxxxxxxxx
................xxxxxxxxxxxx.......xxxxxxxxxxxxxxx
.............xxxxxxxxxxxx.........................
.........xxxxxxxxxxxxxxxxx........................
.....xxxxxxxxxxxxxxxxxxxxxx.......................
..xxxxxxxxxxxxx....xxxxxxx........................
.xxxxxxxxxx........xxxxxxx........................
.xxxxxxx..........xxxxxxx.........................
.xxxxxxx..........xxxxxxx.........................
.xxxxxxxx........xxxxxxxxx........................
..xxxxxxx.........xxxxxxxxxxxxx...................
...xxxxxxx..........xxxxxxxxxxxxxxx...............
...xxxxxxx...............xxxxxxxxxxxx.............
.....xxxx.....................xxxxxx..............

2 Name: #!/usr/bin/anonymous : 2006-07-27 04:36 ID:eKs6qOaU

post more like that ^

3 Name: #!/usr/bin/anonymous : 2006-07-27 11:43 ID:Heaven

>>1 was super-weak when it was posted in http://4-ch.net/code/kareha.pl/1144364264/, and it's still as weak as ever.

What we really need is for people to get their ass in gear and start making some contributions to Coding Challenge #4: http://4-ch.net/code/kareha.pl/1145655403/

4 Name: #!/usr/bin/anonymous : 2006-10-22 05:33 ID:Q4eLFzxR

export lol="what" omg="WHAT" hax="harbl" fail=echo $hax|tr kwmvlebrogha "eopq n stqye" fail="$fail "\echo "$omg $lol"|tr tWkiapHemTwAsh edBsciEmYuosGh|rev|tr kRosucmdGEbe Pwoedcqulsbe\``;$fail

5 Name: sage : 2006-10-22 05:35 ID:Q4eLFzxR

export lol="what" omg="WHAT" hax="harbl" fail=`echo $hax|tr kwmvlebrogha "eopq n stqye"` fail="$fail "`\`echo "$omg $lol"|tr tWkiapHemTwAsh edBsciEmYuosGh|rev|tr kRosucmdGEbe Pwoedcqulsbe\``;$fail

owned by wakabamark, now fixed

6 Name: #!/usr/bin/anonymous : 2006-10-22 10:21 ID:Heaven

>>5
What did you just make me do? Nothing happened, now I'm scared :(

7 Name: #!/usr/bin/anonymous : 2006-10-22 18:50 ID:Heaven

>>6
Let's see

  1. The $fail variable is set by translating "harbl" with the pattern kwmvlebrogha "eopq n stqye" which results in "yes ".
  2. The string "WHAT what" goes through some translation and reversion, and the end result is "echo desu".
  3. $fail is assigned to "yes " + the result of executing "echo desu"; $fail == "yes desu".
  4. "yes desu" is executed.

So assuming you have all the necessary utilities (tr, rev, yes) this should just print an infinite amount of "desu" lines.

(Tested under bash 2.05b.0(1), dunno about other shells)

8 Name: #!/usr/bin/anonymous : 2006-10-23 05:30 ID:Heaven

>>7
I'm up too late to figure this out, but under OpenBSD's sh (I dunno what >>6 is using), it does nothing. Seems to be trying to run "desu", as if I replace the $fail at the end with echo $fail, that's what it prints out, just desu. If I rename the second fail variable fail2, it prints "desu desu". I don't know why that doesn't work as you said.

9 Name: #!/usr/bin/anonymous : 2006-10-23 08:49 ID:Heaven

Apparently sh didn't like exporting the same variable twice in one statement. This works (at least on Darwin):

export lol="what" omg="WHAT" hax="harbl" fail=`echo $hax|tr kwmvlebrogha "eopq n stqye"`;export fail="$fail "`\`echo "$omg $lol"|tr tWkiapHemTwAsh edBsciEmYuosGh|rev|tr kRosucmdGEbe Pwoedcqulsbe\``;$fail

10 Name: #!/usr/bin/anonymous : 2006-11-07 10:56 ID:Heaven

>>8
At a guess, this would be a difference between a BSD sh and bash. On Linux and Mac OS X, the sh and bash executables are the same thing. On the various BSDs and Solaris, bash is GNU bash and sh is an older bourne shell of their own implementation which predates bash.

11 Name: #!/usr/bin/anonymous : 2006-11-10 00:53 ID:njtA+MjN

C code I wrote to print some kind of carpet design with a diagonal symmetry axis:
[code]
putch();z(x){return((x&16)>0)+((x&8)>0)+((x&4)>0)+((x&2)>0)+((x&1)>0);}main(){for(int i=0;i<1024;i&31?0:putch(10),putch(z(i&31)^z((i++&992)>>5)?6:0));}
[/code]

12 Name: #!/usr/bin/anonymous : 2006-12-24 22:30 ID:MW/+zJRM

>>11

test.c:6: warning: data definition has no type or storage class
test.c: In function 'main':
test.c:6: error: 'for' loop initial declaration used outside C99 mode

13 Name: #!/usr/bin/anonymous : 2006-12-26 21:20 ID:Heaven

>>12

gcc -std=c99 ...

14 Name: #!/usr/bin/anonymous : 2006-12-26 23:45 ID:Heaven

>>13

test.c:1: warning: data definition has no type or storage class
test.c:1: warning: type defaults to 'int' in declaration of 'putch'
test.c:1: warning: return type defaults to 'int'
test.c: In function 'z':
test.c:1: warning: type of 'x' defaults to 'int'
test.c: At top level:
test.c:1: warning: return type defaults to 'int'
/tmp/ccmrPvLe.o: In function `main':
test.c:(.text+0x81): undefined reference to `putch'
test.c:(.text+0xc6): undefined reference to `putch'
collect2: ld returned 1 exit status

15 Name: #!/usr/bin/anonymous : 2006-12-27 01:54 ID:Heaven

>>14
s/putch\(\)/putch\(c\)\{return putw\(c,stdout\);\}/

16 Name: #!/usr/bin/anonymous : 2006-12-29 14:40 ID:EUz9Yh2d

>>15
I don't mean to be a grouch, but you're really putch-ering the language there.

17 Name: #!/usr/bin/anonymous : 2007-01-11 02:08 ID:s37EMaVh

#include "stdio.h"
#define e 3
#define g (e/e)
#define h ((g+e)/2)
#define f (e-g-h)
#define j (e*e-g)
#define k (j-h)
#define l(x) tab2[x]/h
#define m(n,a) ((n&(a))==(a))

long tab1[]={ 989L,5L,26L,0L,88319L,123L,0L,9367L };
int tab2[]={ 4,6,10,14,22,26,34,38,46,58,62,74,82,86 };

main(m1,s) char *s; {
int a,b,c,d,o[k],n=(int)s;
if(m1==1){ char b[2*j+f-g]; main(l(h+e)+h+e,b); printf(b); }
else switch(m1-=h){
case f:
a=(b=(c=(d=g)<<g)<<g)<<g;
return(m(n,a|c)|m(n,b)|m(n,a|d)|m(n,c|d));
case h:
for(a=f;a<j;++a)if(tab1[a]&&!(tab1[a]%((long)l(n))))return(a);
case g:
if(n<h)return(g);
if(n<j){n-=g;c='D';o[f]=h;o[g]=f;}
else{c='\r'-'\b';n-=j-g;o[f]=o[g]=g;}
if((b=n)>=e)for(b=g<<g;b<n;++b)o[b]=o[b-h]+o[b-g]+c;
return(o[b-g]%n+k-h);
default:
if(m1-=e) main(m1-g+e+h,s+g); else *(s+g)=f;
for(*s=a=f;a<e;) *s=(*s<<e)|main(h+a++,(char *)m1);
}
}




That above program from http://www.ioccc.org/1986/holloway.c outputs the always popular "Hello World".

18 Name: #!/usr/bin/anonymous : 2007-01-12 02:05 ID:Heaven

Not mine, but funny:

#!/usr/bin/perl
for(;print"\e[2J";$d--){for$i(0..31){for(0..7){$|=1;$c=cos$d/($P=4*atan2(1,1));
$s=sin$d/$P;(1,2,4,8,16,32,64,128)[$_]&(63,127,63,1,65,1,65,1,65,1,65,1,65,1,65
,1,63,31,63,1,1,1,65,1,1,1,65,1,1,127,65,127)[$i]&&print"\e[",25+int$c*($Y=-4+
int$i/4)-$s*($X=($i%4-2)*9+$_),";",40+int$s*$Y+$c*$X,"H*"}}select('','','',.1)}
This thread has been closed. You cannot post in this thread any longer.