Draw a Sierpinski triangle

perl -e 'print "P1\n256 256\n", map {$_&($_>>8)?1:0} (0..0xffff)' | display
OK, not the most useful but a good way to impress friends. Requires the "display" command from ImageMagick.

25
By: dstahlke
2009-07-08 17:50:23

1 Alternatives + Submit Alt

  • xmas lights for your terminal - switching the $l value to something like 1200 and zooming out on your terminal gives a great view ... Show Sample Output


    0
    perl -le '$l=80;$l2="!" x $l;substr+($l2^=$l2),$l/2,1,"\xFF";{local $_=$l2;y/\0\xFF/ ^/;print;($lf,$rt)=map{substr $l2 x 2,$_%$l,$l;}1,-1;$l2=$lf^$rt;select undef,undef,undef,.1;redo}'
    l3v3l · 2013-06-21 06:00:24 0

What Others Think

Fun! I like it.
kaedenn · 480 weeks and 3 days ago
ftw! dude. r0x0rz
linuxrawkstar · 480 weeks and 3 days ago
Fun ! Nice plotting approach ...
CodSpirit · 480 weeks and 3 days ago
nice, i'd have voted twice because of the extra geek factor if i could ;)
masterofdisaster · 480 weeks and 2 days ago
Commandlinefu isn't always about practicality, it is often about coolness. And this command certainly qualifies.
nitehawk · 480 weeks and 1 day ago
waouuuu
srand · 478 weeks and 5 days ago
go fractals!
bbelt16ag · 478 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: