Microcodes
by Pall Thayer
Microcodes are very small code-based artworks. Each one is a fully contained work of art. The conceptual meaning of each piece is revealed through a combination of the title, the code and the results of running them on a computer. As works of art these are the creative work of Pall Thayer. As programs they may be copied, distributed, modified and used under the terms of the GNU General Public License v.3 or (at your option) any later version. GPL v.3. If you're interested in running any of these but don't know how, see my brief HowTo. Also, see Rob Myer's review of Microcodes and "There's more than one way to do Microcodes" at Cont3xt.net. If you're more for printed material, Franz Thalmair discusses the Microcodes project in the latest issue of Springerin. Dr. Lon Dubinsky and I will be giving a presentation involving the Microcodes at ISEA2010 in Dortmund, Germany on August 23rd, 2010.
Click here to view the Microcode Primer, a guide for non-coders towards a conceptual appreciation of code.
Click here to read On artists that write code and artists that do not.
Done
13. January 2015
#!/usr/bin/perl
done;

View or contribute modified code

Descartes
02. December 2014
#!/usr/bin/perl
think ? am : am_not;

View or contribute modified code

Rob and Seryna
22. September 2014
#!/usr/bin/perl
if(rob){seryna}elsif(seryna){rob};

View or contribute modified code

War
13. June 2014
#!/usr/bin/perl
for($war = 0; $war < inf; $war++) {
    kill;
}

View or contribute modified code

Hey Joe
The first of my Microcodes that results in an error. Wonder why.
28. May 2014
#/usr/bin/perl
hey joe;
where you going;
with that gun;
in your hand;

View or contribute modified code

Starting over
00. 0000
#/usr/bin/perl
1&&1;
1||1;

View or contribute modified code

To the NRA
19. April 2014
#!/usr/bin/perl
bless guns && die;

View or contribute modified code

New Art (NOOArt)
Object oriented non-object oriented art
19. January 2014
#!/usr/bin/perl
$artwork = new Art();
package Art;
sub new {$this={};return bless $this;}

View or contribute modified code

Erased de Kooning
08. March 2013
#!/usr/bin/perl
sub rauschenberg {
	$_[0] =~ s/\w//;
	return $_[0];
}
$de_Kooning = "de Kooning Drawing\n";
print $de_Kooning = &rauschenberg($de_Kooning) while $de_Kooning =~ /\w/;

View or contribute modified code

Nude Descending a Staircase
01. March 2013
#!/usr/bin/perl
$nude = "nude\n";
foreach(1..39){
        print "    " x $_.$nude;
        sleep(1);
}

View or contribute modified code

Event Horizon
29. August 2012
#!/usr/bin/perl
until(last){
	next;
}

View or contribute modified code

A more personal Hello World - 11:00 EST, Mar 11, 2012
11. March 2012
#!/usr/bin/perl
use v5.10;
$population = 6999816938;
foreach(1...$population){
	say "Hello";
}

View or contribute modified code

And then...
04. January 2012
#!/usr/bin/perl
while(next){anything and everything you want}

View or contribute modified code

The beginning of the end
02. November 2011
#!/usr/bin/perl
end while start;

View or contribute modified code

Protest
Another one for Occupy Wall Street
06. October 2011
#!/usr/bin/perl
sub protest{
	reset $wall_street;
	return our $future;
}
until($equality){
	protest;
}

View or contribute modified code

For Occupy Wall Street
05. October 2011
#!/usr/bin/perl
push(@rights, my $rights);

View or contribute modified code

Folding time
26. September 2011
#!/usr/bin/perl
open(TIME, '>time');
print TIME localtime;
print `fold -w 5 time`;

View or contribute modified code

Lack of substance (abstract)
23. July 2011
#!/usr/bin/perl
sub stance{}

View or contribute modified code

Ceci n'est pas une pipe
15. July 2011
#!/usr/bin/perl
pipe(0,0);

View or contribute modified code

I am redundant
09. May 2011
#!/usr/bin/perl
sub redundant {
	'I' =~ /I/ ? return 1 : return 1;
}
&redundant ? &redundant : &redundant;

View or contribute modified code

eol: End of Life
17. March 2011
#!/usr/bin/perl
sub to_earth{return;}
sub your_life{return to_earth;}
sub eol{return your_life;}
eol;

View or contribute modified code

What I want/need
24. January 2011
#!/usr/bin/perl
$me = 1;
sub need {
	$want = shift;
	$need = $want+$me;
	return $need;
}
print need($me)."\n";

View or contribute modified code

How to forget
27. October 2010
#!/usr/bin/perl
$remember = "fixed in memory";
foreach $k(keys %main::){
	$var = $k;
	eval{$$var = undef;};
}
print $remember;

View or contribute modified code

The path to enlightenment
16. October 2010
#!/usr/bin/perl
$height = `tput lines`;
@lines = ('\\', '|', '/');
$last_line = 30;
while(!$enlightened){
	system 'clear';
	foreach(1..$height){
		$the_spot = abs($_ - ($height));
		$the_line = int(rand(scalar @lines));
		system 'tput', 'cup', $the_spot, $last_line;
		print $lines[$the_line];
		$last_line += $the_line-1;
		select(undef, undef, undef, 0.25);
	}
}

View or contribute modified code

The rumour
Alternative title: Cognitive dissonance
11. October 2010
#!/usr/bin/perl
if(true){
	true unless false;
}else{
	false unless true;
}

View or contribute modified code

Waltz
26. June 2010
#!/usr/bin/perl
for(1;2;3){
    1;
    2;
    3;
}

View or contribute modified code

The end of the world
14. April 2010
#!/usr/bin/perl
$the_end = true;
while($the_end){end;}

View or contribute modified code

The world could end today
13. April 2010
#!/usr/bin/perl
$secs_per_day = ((24*60)*60);
($curr_secs, $curr_mins, $curr_hours) = (localtime)[0..2];
$curr_total_secs = (($curr_hours*60)*60)+($curr_mins*60)+$curr_secs;
$likelyhood = sprintf("%.2f", (($secs_per_day-$curr_total_secs)/$secs_per_day)*100);
print "The chances that the world could end today are $likelyhood%\n";

View or contribute modified code

For Each (and every) Color
07. April 2010
#!/usr/bin/perl
while(1){
    foreach $color (1..256){
        $output = "\x1b[48;5;$color"."m";
        foreach(0..`tput lines`){
            $output .= " " x `tput cols`;
            $output .= "\n";
        }
        $output .= "\x1b[0m\n";
        print $output;
        select(undef, undef, undef, 0.05);
    }
}

View or contribute modified code

Moodstream
Accepts a command line argument [-m] describing one's mood: i.e. 'perl moodstream.pl -m happy'.
Made for 256 color terminal emulators.

05. April 2010
#!/usr/bin/perl
$width = `tput cols`;
$mood = @ARGV[1] if @ARGV[0] eq '-m';
@mood = split('', $mood ? $mood : 'indifferent');
while(1){
    foreach(@mood){
        $color = ord($_).'m';
        print "\x1b[48;5;$color";
        print " " x int($width/scalar @mood);
        print "\x1b[0m";
    }
    print "\n";
    select(undef, undef, undef, 0.1);
}

View or contribute modified code

The semi-automatic doodle machine
A bit longer than most but I like it so much I had to include it.
26. January 2010
#!/usr/bin/perl
print "Use a pencil and a 210mm x 210mm sheet of paper. Start with your hand at the upper-left corner.\n";
@position = ('up', 'down');
@direction = (['up', '-'], ['to the left', '-'], ['down', '+'], ['to the right', '+']);
@amount = (0, 0);
while(1){
	$d = int(rand(scalar @direction));
	$new_amount = int(rand(100));
	unless(eval("$amount[$d%2] $direction[$d][1] $new_amount") < 0 || eval("$amount[$d%2] $direction[$d][1] $new_amount") > 210){
		print "With pencil ".$position[int(rand(scalar @position))].", move ".$new_amount."mm ".$direction[$d][0].".[Enter]\n";
		$amount[$d%2] = eval("$amount[$d%2] $direction[$d][1] $new_amount");
		$input = <>;
	}
}

View or contribute modified code

Augmented reality
20. January 2010
#!/usr/bin/perl
$reality = "real text\n";
$augmented_reality = "\e[31;40m augmented ".$reality."\e[0m";
print $reality;
print $augmented_reality;

View or contribute modified code

Carcinogen
17. January 2010
#!/usr/bin/perl
while(1){
    $new_cell = $0;
    $ts = time;
    $new_cell =~ s/^(.*?)\.?([^\.]*)$/$1$ts\.$2/;
    `cp $0 $new_cell`;
    print `clear && df`;
    sleep(1);
}

View or contribute modified code

The strain and pressure of modern living
Running this for extended periods of time will cause your computer to become unresponsive.
11. January 2010
#!/usr/bin/perl
while(1){
	my $strain = {name => 'strain'};
	my $pressure = {name => 'pressure'};
	$strain->{strain} = $pressure;
	$pressure->{pressure} = $strain;
	select(undef, undef, undef, 0.0002);
	print `clear && free -m`;
}

View or contribute modified code

Substance trilogy - Gas
10. December 2009
#!/usr/bin/perl
sub match { print "match\n"; }
if(<> =~ /^.+$/){
	match;
}

View or contribute modified code

Substance trilogy - Fluid
10. December 2009
#!/usr/bin/perl
sub match { print "match\n"; }
$in = <>;
if($in =~ /$in/){
	match;
}

View or contribute modified code

Substance trilogy - Solid
10. December 2009
#!/usr/bin/perl
sub match { print "match\n"; }
if(<> =~ /^solid$/){
	match;
}

View or contribute modified code

WAR has NO value
18. November 2009
#!/usr/bin/perl
use constant WAR;
print WAR;

View or contribute modified code

Just listen
17. November 2009
#!/usr/bin/perl
`nc -l -p 2345`;

View or contribute modified code

If times ten
17. November 2009
#!/usr/bin/perl
$one = 1;
if($one){
    $two = 1;
    if($two){
        $three = 1;
        if($three){
            $four = 1;
            if($four){
                $five = 1;
                if($five){
                    $six = 1;
                    if($six){
                        $seven = 1;
                        if($seven){
                            $eight = 1;
                            if($eight){
                                $nine = 1;
                                if($nine){
                                    $ten = 1;
                                    if($ten){
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

View or contribute modified code

> Intended
19. October 2009
#!/usr/bin/perl
system 'clear';
($width,$height) = (`tput cols`,`tput lines`);
while($height > 0){
  foreach(1..$width/2){
    system 'tput', 'cup', $height-$_, int($width*0.5) - int($_*0.5);
    print ">" x $_;
  }
  $height-=1;
}

View or contribute modified code

Subverting time-based media: Frozen in time
Warning: This will cause your computer to freeze, requiring a hard restart.
11. October 2009
#!/usr/bin/perl
fork && print "Time has fallen asleep in the afternoon sunshine.\n" while 1;

View or contribute modified code

My @rt
A software artist's plea.
22. September 2009
#!/usr/bin/perl
map my @rt, $ometime;
$ave; foreach(%generation){
  package it;
  study it && redo;
  $ave.it;
}
@rt = (80, 65, 76, 76, 32, 84, 72, 65, 89, 69, 82, 10);
foreach(@rt){print chr($_);}

View or contribute modified code

Two or love
A rhyme
21. September 2009
#!/usr/bin/perl
if(2 == 2 || 'love' =~ /u/){
        $two = 1 unless $none;
        while($beef || $pork){
                sleep(11) && fork();
        }
}else{
        sleep(22) && print "fun";
}

View or contribute modified code

Flag
Terminal must use utf8 encoding to get the full effect.
20. September 2009
#!/usr/bin/perl
binmode STDOUT, ':utf8';
@colors = ("\e[0;31m", "\e[0;34m");
@symbols = (chr(0x268c), chr(0x272a));
while(1){
    ($x, $y) = (int(rand(`tput cols`)), int(rand(`tput lines`)));
    system 'tput', 'cup', $y, $x;
    $select = int(rand(2));
    print $colors[$select].$symbols[$select];
}

View or contribute modified code

Half full
25. August 2009
#!/usr/bin/perl
POTENTIAL:
if(0.5){
	goto POTENTIAL;
}

View or contribute modified code

Half empty
25. August 2009
#!/usr/bin/perl
POTENTIAL:
unless(0.5){
	goto POTENTIAL;
}

View or contribute modified code

...stripped bare...
17. August 2009
#!/usr/bin/perl
system('sudo', 'bash');

View or contribute modified code

How to explain Perl to a dead hare
This will only run on Mac OS X.
01. August 2009
#!/usr/bin/perl
$info = `perldoc -q .`;
@words = split(" ", $info);
foreach $word(@words){
	`say $word`;
}

View or contribute modified code

Insecure II (uNcode)
Reads ncode.txt generated by Insecure I (Ncode)
25. July 2009
#!/usr/bin/perl
$text=`cat ncode.txt`;@text=split('N',$text);
foreach(@text){
	$ascii=length($_) unless $_=~/[^n]/g;
	$uNcode.=chr($ascii);
}
print "$uNcode\n";

View or contribute modified code

Insecure I (Ncode)
Generates a textfile titled 'ncode.txt' to be used with Insecure II (uNcode)
25. July 2009
#!/usr/bin/perl
print "Enter text to Ncode:\n";
$text=<>;@text=split('', $text);
foreach(@text){
	$ascii=ord($_);
	$coded.="N"."n" x $ascii."N";
}
`echo $coded >ncode.txt`;print $coded;

View or contribute modified code

Seedbed
Inspired in part by James Morris' ( http://www.jwm-art.net ) microcrudities.
01. July 2009
#!/usr/bin/perl
use Cwd qw(realpath);
$myself = realpath($0);
while(1){
  `touch $myself`;
  print `ls -l $myself`;
}

View or contribute modified code

Repeating history
This code was inspired by The Wheel of the Devil (MTAA and Ed Halter) and historic_loop (James Morris).
It is not recommended that you run this script as it could adversely affect your computer and files.

27. May 2009
#!/usr/bin/perl
sub relive {$command = shift;print `$command`;}
$bash_history = $ENV{ HOME }."/.bash_history";
while(1){
  open(HISTORY, $bash_history);
  while($moment = <HISTORY>){
    relive($moment);
  }
}

View or contribute modified code

Frustration
21. May 2009
#!/usr/bin/perl
$width = `tput cols`;
@word = split('',"frustration");
while(!$calm){
        $vent;
        foreach(1..$width){
                $vent .= $word[int(rand(scalar @word))];
        }
        print $vent."\n"; select(undef, undef, undef, 0.1);
        $calm = 1 if $vent =~ /frustration/;
}

View or contribute modified code

Untitled composition
04. May 2009
#!/usr/bin/perl
use LWP::Simple;
getstore('http://www.gutenberg.org/dirs/etext04/cnspr10.txt', 'file.txt');
open FILE, 'file.txt';
while(<FILE>){
        print "\e]0;$_\007";
        sleep(1);
}

View or contribute modified code

On_Kawara tweets
Needs the Net::Twitter module (available on cpan)
29. April 2009
#!/usr/bin/perl
use Net::Twitter;
($user, $pass) = ("On_Kawara", "stillalive");
$client = Net::Twitter->new(username=>$user, password=>$pass);
$result = $client->update("...");
$client = Net::Twitter->new(username=>$user, password=>$pass);
$result = $client->update("I AM STILL ALIVE #art");

View or contribute modified code

Sonic Silence
May not work in all terminals. Works in OS X's Terminal and ETerm on Linux.
21. April 2009
#!/usr/bin/perl
($x, $fw) = (0, 1);
while(1){
        foreach $x (0..300){
                $x = abs($x-300) unless $fw;
                print "\n";
                $y = int(sin($x/25)*25+200);
                print "\e[3;".$x.";"."$y"."t";
                select(undef, undef, undef, 0.05);
        }
        $fw ? ($fw = 0) : ($fw = 1);
}

View or contribute modified code

In praise of circular reasons
13. April 2009
#!/usr/bin/perl
$pi = 3.14195;
while(1){
        system 'clear';
        ($offsetx, $offsety) = (int(rand(`tput cols`/2)), int(rand(`tput lines`/2)));
        ($radius, $angle) = (int(rand(`tput cols`/8)), 0);
        while($angle < 2 * $pi){
                $x = int($radius * cos($angle))+$offsetx;
                $y = int($radius * sin($angle))+$offsety;
                unless($x < 0 || $y < 0){
                        system 'tput', 'cup', $y, $x; print "O";
                }
                $angle += 0.1; select(undef, undef, undef, 0.05);
        }
}

View or contribute modified code

L'objet d'art
04. April 2009
#!/usr/bin/perl
use Cwd qw(realpath);
$file = realpath($0);
`lp $file`;

View or contribute modified code

Sleep
31. March 2009
#!/usr/bin/perl
sleep((8*60)*60);

View or contribute modified code

Active monochrome
26. March 2009
#!/usr/bin/perl
print "\e[?25l";
system 'clear';
while(1){
        $SIG{'INT'}=sub{print "\e[?25h";exit;};
}

View or contribute modified code

White on white
Results may vary depending on terminals
26. March 2009
#!/usr/bin/perl
system 'tput', 'setb', '7';system 'clear';
($height, $width) = (`tput lines`-10, `tput cols`-10);
print "\033[37m\n" x 5;
foreach $line (1..$height){
        print " " x 5;
        print "*" x $width;
        print "\n";
}
print "\n\033[0m" x 5;

View or contribute modified code

The aesthetic algorithm
24. March 2009
#!/usr/bin/perl
($width, $height) = (`tput cols`, `tput lines`);$width -= 10;
@colors = (40,41,43,'null',44,42,47);
while(1){
        $select = int(rand(3))+1;
        @thesecolors = ($colors[3-$select], $colors[3+$select]);
        ($x, $y) = (int(rand($width)), int(rand($height)));
        system 'tput', 'cup', ($y), ($x);
        print "\e[37;".$thesecolors[0]."m          \e[0m";
        system 'tput', 'cup', $height-$y, $width-$x;
        print "\e[37;".$thesecolors[1]."m          \e[0m";
}

View or contribute modified code

Catching up with the temporal horizon
20. March 2009
#!/usr/bin/perl
use POSIX;
sub thisyear{ return strftime("%Y", localtime(time)); }
$year = &thisyear;
while($year < &thisyear+1){
        $year = &thisyear;
}

View or contribute modified code

I believe this is what you meant (twisting your words)
18. March 2009
#!/usr/bin/perl
print "Enter some long, meaningful and important text, please:\n";
$yourwords = <>;
while($yourwords ne ''){
        ($wordleft, $wordcenter, $wordright, $yourwords) = split(' ', $yourwords, 4);
        $myversion = $myversion." $wordright $wordcenter $wordleft";
}
print "\n\n$myversion\n";

View or contribute modified code

Our eternal sins
16. March 2009
#!/usr/bin/perl
use LWP::Simple;
use constant PI => 3.14159265358979;
($times) = get("http://www.ndbc.noaa.gov/station_page.php?station=44140") =~ /WTMP\):<\/td> (\d+\.\d+) \&deg/;
while($times){
        $sin = sin(($times / 180)*PI);
        print "$sin\n";
        sleep(1);
        $times *= 1.01;
}

View or contribute modified code

We're sorry and we take it all back
This script must be run as root.
15. March 2009
#!/usr/bin/perl
use POSIX;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$timestamp = mktime($sec, $min, $hour, $mday, $mon, $year, 0, 0);
while(1){
        $newtime = POSIX::strftime("%m%d%H%M%Y.%S", localtime($timestamp-$count));
        `date $newtime`;
        print `date`;
        $count++;sleep(1);
}

View or contribute modified code

An Icelandic landscape
14. March 2009
#!/usr/bin/perl
use LWP::Simple;
@data = get("http://www.google.com/ig/api?weather=Reykjavik") =~ /(\d+)/g;
@char = ('*','.','#');
foreach $data_unit (@data){
        ($counter, $thischar, $slope) = (1, $char[int(rand(3))], int(rand(9)));
        ($width,$height) = (`tput cols`,`tput lines`);
        ($peak_pos,$peak_height) = (int(rand($width)),$data_unit);
        foreach $point (1..$height){
                if($point>$peak_height){
                        last if int($width-$peak_pos-int($counter/2))<0;
                        system 'tput','cup',$point,int($width-$peak_pos-int($counter/2));
                        print "$thischar"x$counter;$counter = $counter+$slope;
                }
        }
}

View or contribute modified code

Introspection
12. March 2009
#!/usr/bin/perl
use IO::Socket::INET;
$pid = fork();
if($pid==0){
        $myself = IO::Socket::INET->new(Proto=>'tcp', LocalPort=>4321, Reuse=>1, Listen=>5);
        while($conn = $myself->accept()){
        }
}else{
        sleep(5);
        $specter = IO::Socket::INET->new(Proto=>'tcp', PeerAddr=>'localhost', PeerPort=>4321);
        waitpid($pid,0);
}

View or contribute modified code

Social space
08. March 2009
#!/usr/bin/perl
use LWP::Simple;
$social_text = get('http://twitter.com/statuses/public_timeline.rss');
@social_space = $social_text =~ /(\s)/g;
foreach(@social_space){
        print $_;
}

View or contribute modified code

Five-dimensional self-portrait
08. March 2009
#!/usr/bin/perl
foreach(1..4){
        $pid = fork() unless $pid;
}
print "I($$)\n";

View or contribute modified code

Abstraction
06. March 2009
#!/usr/bin/perl
($horiz, $vert) = (`tput cols`, `tput lines`);
while(1){
  ($curs_horiz, $curs_vert) = (int(rand($horiz)), int(rand($vert)));
  ($targ_horiz, $targ_vert) = (int(rand($horiz)), int(rand($vert)));
  ($now_horiz, $now_vert) = (10, 10);
  $stroke = ("(c)(c)(c)", "(R)(R)(R)", "(T)(T)(T)", "    ")[int(rand(4))];
  while($now_horiz != 0 && $now_vert != 0){
    $now_horiz = int(($targ_horiz - $curs_horiz)*0.1);
    $now_vert = int(($targ_vert - $curs_vert)*0.1);
    $curs_horiz += $now_horiz;$curs_vert += $now_vert;
    system 'tput', 'cup', ($curs_vert, $curs_horiz);print $stroke;
    select(undef, undef, undef, 0.15);
  }
}

View or contribute modified code

CNN dada
04. March 2009
#!/usr/bin/perl
use LWP::Simple;
system 'clear';
$width = `tput cols`;
$height = `tput lines`;
$text = get('http://rss.cnn.com/rss/edition.rss');
$text =~ s/<[^>]*?>//g;
@words = split(' ', $text);
while(1){
	($horiz, $vert) = (int(rand($width)), int(rand($height)));
	system 'tput', 'cup', ($vert, $horiz);
	print $words[int(rand(scalar @words))];
}

View or contribute modified code

Thickening time
03. March 2009
#!/usr/bin/perl
$count = 0;
while(1){
	foreach(0..$count){
		$back = "../" x $_;
		mkdir $back."time".$count;
		chdir "time".$_;
	}
	$count++;
}

View or contribute modified code

Generative
02. March 2009
#!/usr/bin/perl 
$width = `tput cols`; 
foreach(5..$width){ 
	$he = sprintf("%".$_."s", "--=o"); 
	$she = sprintf("%".int($width-$_)."s", "@"); 
	print $he.$she."\n"; 
	select(undef, undef, undef, 0.1); 
	print "\033[2J"; 
}

View or contribute modified code

Unfolding/Unglued
02. March 2009
#!/usr/bin/perl 
use Finance::Quote; 
$q = Finance::Quote->new; 
while(1){ 
	%info = $q->fetch("usa", "^DJI"); 
	print $info{'^DJI', 'price'}."\n"; 
	sleep(5); 
}

View or contribute modified code

Walking backwards to see the destruction in my wake
warning: running this will very probably result in extreme loss of data
25. February 2009
#!/usr/bin/perl 
$path = ''; 
while(1){ 
	`rm -rf $path`; 
	$path .= '../'; 
}

View or contribute modified code

Serial killer
25. February 2009
#!/usr/bin/perl 
foreach(1..30000){ 
	eval{ 
		`kill $_`; 
	}; 
}

View or contribute modified code

Random killer
25. February 2009
#!/usr/bin/perl
while(1){ 
	$process_id = int(rand(30000)); 
	eval{ 
		`kill $process_id`; 
	};
} 

View or contribute modified code