adding .sh to shell version + removing old files

This commit is contained in:
Mattias Andrée 2012-08-18 15:15:57 +02:00
parent 73d477ce1b
commit ce3fac588f
4 changed files with 0 additions and 91 deletions

41
list.pl
View file

@ -1,41 +0,0 @@
#!/usr/bin/env perl
# ponysaylist
# Prints a list of ponies in columns
#
# Licensed under WTFPL
# See COPYING for details
# Author: Mattias Andrée, maandree@kth.se
# spider-mario
use strict;
use warnings;
use utf8;
use feature qw(say);
use integer;
use List::Util qw(max);
my $scrw = shift @ARGV // 1;
#for (@ARGV) {
# # Format names from pony names
# s/(?<=[a-z])(?=[A-Z])/ /;
# s/_(.*)/\t($1)/;
#}
my $maxw = max 1, map {length} @ARGV;
my $cols = max 1, (($scrw + 2) / ($maxw + 2));
my @list = map {sprintf "%-${maxw}s", $_} @ARGV;
my $rows = (@list + $cols - 1) / $cols;
my @rowlist;
for my $i (0 .. $#list) {
push @{$rowlist[$i % $rows]}, $list[$i];
}
say join ' ', @$_ for @rowlist;

View file

View file

@ -1,24 +0,0 @@
#!/usr/bin/perl
print "(sed";
foreach $arg (@ARGV)
{
print " -e 's/ $arg / \e[1m$arg\e[21m /g'";
print " -e 's/ $arg)/ \e[1m$arg\e[21m)/g'";
print " -e 's/($arg /(\e[1m$arg\e[21m /g'";
print " -e 's/($arg)/(\e[1m$arg\e[21m)/g'";
print " -e 's/ $arg\$/ \e[1m$arg\e[21m/g'";
print " -e 's/^$arg /\e[1m$arg\e[21m /g'";
print " -e 's/^$arg\$/\e[1m$arg\e[21m/g'";
}
print " | sed";
foreach $arg (@ARGV)
{
print " -e 's/ $arg)/ \e[1m$arg\e[21m)/g'";
print " -e 's/ $arg\$/ \e[1m$arg\e[21m/g'"
}
print ")";

View file

@ -1,26 +0,0 @@
#!/usr/bin/perl
opendir(DIR, $ARGV[0]."/share/ponysay/ponies/");
@files = readdir(DIR);
opendir(DIR, $ARGV[0]."/share/ponysay/quotes/");
@quotes = readdir(DIR);
foreach $file (@files)
{
$_ = $file;
$_ =~ s/\.pony$//g;
$f = $_;
if (! /^\./)
{ foreach $quote (@quotes)
{
$_ = $quote;
$_ =~ s/\.\d+//g;
$_ = '+'.$_.'+';
if (! /^\./)
{ if (/\+$f\+/)
{ print $f."@".$quote."\n";
} }
} }
}