]> iEval git - filters.git/commitdiff
* Hahaha. Added a rasterman filter. (Not just "raster" as I worry about
authorjoey <joey@a4a2c43b-8ac3-0310-8836-e0e880c912e2>
Tue, 28 Nov 2000 04:03:45 +0000 (04:03 +0000)
committerjoey <joey@a4a2c43b-8ac3-0310-8836-e0e880c912e2>
Tue, 28 Nov 2000 04:03:45 +0000 (04:03 +0000)
     namespace pollution.)

Makefile
debian/changelog
debian/copyright
filters.6
rasterman [new file with mode: 0755]

index 88a38bbccdb899515441d6750e77b61c77e65ca6..1649d4bd8c88223ba8d961338f96c58ccb155d0a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 LEX     = flex
 
 ALL     = jethro kraut cockney jive nyc
-OTHER   = eleet b1ff chef jibberish upside-down
+OTHER   = eleet b1ff chef jibberish upside-down rasterman
 
 all:   $(OTHER) $(ALL)
 
index 07823de05699ad58f0936f138efca5274c0bffbb..e17d623511dc74d847f9c0ba859d8175d42a23eb 100644 (file)
@@ -1,3 +1,10 @@
+filters (2.14) unstable; urgency=low
+
+  * Hahaha. Added a rasterman filter. (Not just "raster" as I worry about
+    namespace pollution.)
+
+ -- Joey Hess <joeyh@debian.org>  Mon, 27 Nov 2000 20:00:28 -0800
+
 filters (2.13) unstable; urgency=low
 
   * cockney, jive, and nyc filters are now GPL'd, moved from -nonfree
index ed43db7391627ad7bf259ddaa880a7df3b450276..4535b170be7882c10f5739127c725b6f0998eb35 100644 (file)
@@ -33,4 +33,8 @@ Klein. He confirmed the new copyright in this email:
   > and nyc filters to the GPL? Is that correct? I'd love to move them into
   > Debian proper.
 
+The rasterman filter was pulled out of
+http://www.xach.com/xachbot/xachbot-2000-07-15.tar.gz, which is as a whole
+copyright (C) 1997 Zachary Beane and is GPL'd.
+
 Everything else is copyright 1999 by Joey Hess, under the terms of GPL.
index fcb8211486da5c7512a2b6816970a86b211c19db..0a124fa62caa74f28b3f295d0fb8552370b1de78 100644 (file)
--- a/filters.6
+++ b/filters.6
@@ -1,6 +1,6 @@
 .TH FILTERS 6
 .SH NAME
-b1ff, chef, cockney, eleet, jethro, jibberish, jive, kraut, nyc, upside-down \- assorted text filters
+b1ff, chef, cockney, eleet, jethro, jibberish, jive, kraut, nyc, rasterman, upside-down \- assorted text filters
 .SH SYNOPSIS
  $SHELL | chef
 .SH "DESCRIPTION"
@@ -27,6 +27,8 @@ K3wl hacker slang
 Generates text with a German accent.
 .IP nyc
 Brooklyn English
+.IP rasterman
+Makes text look like it came from the keyboard of Carsten Haitzler.
 .IP upside-down
 Flips text upside down. Stand on your head and squint to read the output.
 .SH "SEE ALSO"
diff --git a/rasterman b/rasterman
new file mode 100755 (executable)
index 0000000..492061c
--- /dev/null
+++ b/rasterman
@@ -0,0 +1,100 @@
+#!/usr/bin/perl
+
+$row = "!qwertyuiop!asdfghjkl!zxcvbnm!";
+@row_array = split(//, $row);
+
+while (<>) {
+       chomp;
+       y/A-Z/a-z/;
+       s/\byou\b/u/gi;
+       s/\bpeople\b/ppl/gi;
+       s/\bthrough\b/thru/gi;
+       s/\bthough\b/tho/gi;
+       s/\bnope\b/nup/gi;
+       s/\baustralia\b/oz/gi;
+       s/\bsucks\b/sux/gi;
+       s/\benough\b/enuff/gi;
+       s/\ba lot\b/a shitload/gi;
+       s/\bstuff\b/shit/gi;
+       s/, /.. /g;
+       s/\.$/.../g;
+
+       @lets = split(//);
+
+       $strlen = $#lets;
+
+       for ($x = 0; $x < $strlen; $x++) {
+               if (rand() < 0.01) {
+                   swap(\@lets, $x, $x + 1);
+                   next;
+               }
+
+               if (rand() < 0.10 && $lets[$x] eq " ") {
+                   swap(\@lets, $x - 1, $x - 2);
+                   next;
+               }
+
+               if(rand() < 0.01) {
+                   $i = insert_adjacent(\@lets, $x, $lets[$x]);
+                   $strlen += $i;
+                   next;
+               }
+
+               if(rand() < 0.01) {
+                   splice(@lets, $x, 1);
+                   $strlen--;
+                   next;
+               }
+       }
+
+       print join("", @lets) . "\n";
+}
+
+sub insert_adjacent {
+    my($aref, $pos, $let) = @_;
+    
+    
+    $newlet = get_adjacent($let);
+
+    if( !$newlet ) {
+       return 0;
+    }
+
+    splice(@$aref, $pos + 1, 0, $newlet);
+    return 1;
+}
+
+
+sub get_adjacent {
+    my($let) = @_;
+
+    return 0 if $let !~ /[a-zA-Z]/;
+
+    $i = index($row, $let);
+    $before = $row_array[$i - 1];
+    $after = $row_array[$i + 1];
+
+    
+
+    if( $before eq "!" || (rand() < rand() && $after ne "!"))  {
+       return $after;
+    } else {
+       return $before;
+    }
+}
+
+sub swap {
+    my($aref, $n, $m) = @_;
+    my($tmp);
+
+    if(defined($$aref[$n]) && defined($$aref[$m])) {
+       if(! (($$aref[$n] =~ /[A-Z ]/ && $$aref[$m] =~ /[A-Z ]/) ||
+             ($$aref[$n] =~ /[a-z ]/ && $$aref[$m] =~ /[a-z ]/) )) {
+           return;
+       }
+       $tmp = $$aref[$n];
+       $$aref[$n] = $$aref[$m];
+       $$aref[$m] = $tmp;
+    }
+}
+
This page took 0.038656 seconds and 4 git commands to generate.