From 67c899902cb3a5b0de56931ecf00a0341c091e4f Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Thu, 3 Mar 2011 16:24:01 -0500 Subject: [PATCH] remove bin directory --- bin/convert-to-wav | 11 --- bin/gpgedit | 43 --------- bin/grepdefine | 4 - bin/ssh_execute.pl | 99 -------------------- bin/convert-to-ogg => convert-to-ogg | 0 gpgedit | 4 + ssh_execute.pl | 132 +++++++++++++-------------- 7 files changed, 70 insertions(+), 223 deletions(-) delete mode 100755 bin/convert-to-wav delete mode 100755 bin/gpgedit delete mode 100755 bin/grepdefine delete mode 100755 bin/ssh_execute.pl rename bin/convert-to-ogg => convert-to-ogg (100%) diff --git a/bin/convert-to-wav b/bin/convert-to-wav deleted file mode 100755 index 3351a3b..0000000 --- a/bin/convert-to-wav +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -foreach my $arg (@ARGV) -{ - my $out = $arg; - $out =~ s/\....$//; - system('mplayer', '-vo', 'null', '-ao', "pcm:file=$out.wav", $arg); -} - diff --git a/bin/gpgedit b/bin/gpgedit deleted file mode 100755 index af0cd52..0000000 --- a/bin/gpgedit +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/perl - -# Author: Josh Holtrop -# Purpose: edit a file encrypted by gpg -# Set environment variable GPGEDIT_RECIPIENT to specify the recipient - -use strict; -use warnings; - -sub usage -{ - print STDERR "Usage: $0 \n"; - exit(42); -} - -usage() unless ($#ARGV >= 0); -my $fname = shift(@ARGV); -my $dfname = $fname; -$dfname =~ s/\.gpg$//i; - -my $result = system('gpg', '--decrypt', '--output', $dfname, $fname); -if ($result != 0) -{ - print STDERR "Error decrypting: exiting.\n"; - exit(1); -} - -my $editor = $ENV{'EDITOR'}; -$editor = 'vim' if ($editor =~ /^\s*$/); - -system($editor, $dfname); - -my $recipient = $ENV{'GPGEDIT_RECIPIENT'}; -my @cmd = ('gpg', '--encrypt'); -if ($recipient !~ /^\s*$/) -{ - push(@cmd, '--recipient', $recipient); -} -push(@cmd, $dfname); - -system('mv', $fname, "$fname~"); -system(@cmd); -unlink($dfname); diff --git a/bin/grepdefine b/bin/grepdefine deleted file mode 100755 index 15584aa..0000000 --- a/bin/grepdefine +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -define="$1" -exec grep --exclude-dir .svn --color=auto -R "define *\\<${define}\\>" . diff --git a/bin/ssh_execute.pl b/bin/ssh_execute.pl deleted file mode 100755 index a6dabd4..0000000 --- a/bin/ssh_execute.pl +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/perl -# Josh Holtrop -# 2006-05-05 - -use warnings; -use strict; - -sub usage -{ - print "Usage: $0 [options] command [args]\n"; - print "Options:\n"; - print " -q Run on hosts sequentially (default in parallel)\n"; - print " -s Use instead of 'ssh' for a remote shell program\n"; - print " -u Use username instead of your own\n"; - print " -h The hosts to run the command on, comma-separated\n"; - print " If the -h option is not given, the host list is\n"; - print " read from standard input, one host per line\n"; - exit(42); -} - -my $ssh = 'ssh'; -my $user = ''; -my $seq = 0; -my @hosts = (); -my @command = (); - -for (my $i = 0; $i <= $#ARGV; $i++) -{ - if ($ARGV[$i] eq '-q') - { - $seq = 1; - } - elsif ($ARGV[$i] =~ /^-s(.*)$/) - { - if (length($1) > 0) - { - $ssh = $1; - } - else - { - usage() if ($i == $#ARGV); - $ssh = $ARGV[++$i]; - } - } - elsif ($ARGV[$i] =~ /^-h(.*)$/) - { - if (length($1) > 0) - { - @hosts = split(/,/, $1); - } - else - { - usage() if ($i == $#ARGV); - @hosts = split(/,/, $ARGV[++$i]); - } - } - elsif ($ARGV[$i] =~ /^-u(.*)$/) - { - if (length($1) > 0) - { - $user = $1; - } - else - { - usage() if ($i == $#ARGV); - $user = $ARGV[++$i]; - } - } - else - { - # We've reached the command - @command = splice(@ARGV, $i); - last; - } -} - -$user .= '@' if ($user ne ''); -usage() if ($#command < 0); - -if ($#hosts < 0) -{ - # Read hosts from stdin - while (my $host = ) - { - chomp($host); - push(@hosts, $host); - } -} - -foreach my $host (@hosts) -{ - my $f = $seq ? 0 : fork(); - $f || system($ssh, "$user$host", @command); - exit(0) unless ($f || $seq); # Exit if not parent and not sequential -} - -while (wait() != -1) {} # Wait for all children to exit - -exit(0); diff --git a/bin/convert-to-ogg b/convert-to-ogg similarity index 100% rename from bin/convert-to-ogg rename to convert-to-ogg diff --git a/gpgedit b/gpgedit index 21f9ba9..af0cd52 100755 --- a/gpgedit +++ b/gpgedit @@ -1,5 +1,9 @@ #!/usr/bin/perl +# Author: Josh Holtrop +# Purpose: edit a file encrypted by gpg +# Set environment variable GPGEDIT_RECIPIENT to specify the recipient + use strict; use warnings; diff --git a/ssh_execute.pl b/ssh_execute.pl index eaeb48e..a6dabd4 100755 --- a/ssh_execute.pl +++ b/ssh_execute.pl @@ -1,20 +1,21 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # Josh Holtrop # 2006-05-05 +use warnings; use strict; sub usage { - print "Usage: $0 [options] command [args]\n"; - print "Options:\n"; - print " -q Run on hosts sequentially (default in parallel)\n"; - print " -s Use instead of 'ssh' for a remote shell program\n"; - print " -u Use username instead of your own\n"; - print " -h The hosts to run the command on, comma-separated\n"; - print " If the -h option is not given, the host list is\n"; - print " read from standard input, one host per line\n"; - exit(42); + print "Usage: $0 [options] command [args]\n"; + print "Options:\n"; + print " -q Run on hosts sequentially (default in parallel)\n"; + print " -s Use instead of 'ssh' for a remote shell program\n"; + print " -u Use username instead of your own\n"; + print " -h The hosts to run the command on, comma-separated\n"; + print " If the -h option is not given, the host list is\n"; + print " read from standard input, one host per line\n"; + exit(42); } my $ssh = 'ssh'; @@ -25,52 +26,52 @@ my @command = (); for (my $i = 0; $i <= $#ARGV; $i++) { - if ($ARGV[$i] eq '-q') - { - $seq = 1; - } - elsif ($ARGV[$i] =~ /^-s(.*)$/) - { - if (length($1) > 0) - { - $ssh = $1; - } - else - { - usage() if ($i == $#ARGV); - $ssh = $ARGV[++$i]; - } - } - elsif ($ARGV[$i] =~ /^-h(.*)$/) - { - if (length($1) > 0) - { - @hosts = split(/,/, $1); - } - else - { - usage() if ($i == $#ARGV); - @hosts = split(/,/, $ARGV[++$i]); - } - } - elsif ($ARGV[$i] =~ /^-u(.*)$/) - { - if (length($1) > 0) - { - $user = $1; - } - else - { - usage() if ($i == $#ARGV); - $user = $ARGV[++$i]; - } - } - else - { - # We've reached the command - @command = splice(@ARGV, $i); - last; - } + if ($ARGV[$i] eq '-q') + { + $seq = 1; + } + elsif ($ARGV[$i] =~ /^-s(.*)$/) + { + if (length($1) > 0) + { + $ssh = $1; + } + else + { + usage() if ($i == $#ARGV); + $ssh = $ARGV[++$i]; + } + } + elsif ($ARGV[$i] =~ /^-h(.*)$/) + { + if (length($1) > 0) + { + @hosts = split(/,/, $1); + } + else + { + usage() if ($i == $#ARGV); + @hosts = split(/,/, $ARGV[++$i]); + } + } + elsif ($ARGV[$i] =~ /^-u(.*)$/) + { + if (length($1) > 0) + { + $user = $1; + } + else + { + usage() if ($i == $#ARGV); + $user = $ARGV[++$i]; + } + } + else + { + # We've reached the command + @command = splice(@ARGV, $i); + last; + } } $user .= '@' if ($user ne ''); @@ -78,22 +79,21 @@ usage() if ($#command < 0); if ($#hosts < 0) { - # Read hosts from stdin - while (my $host = ) - { - chomp($host); - push(@hosts, $host); - } + # Read hosts from stdin + while (my $host = ) + { + chomp($host); + push(@hosts, $host); + } } foreach my $host (@hosts) { - my $f = $seq ? 0 : fork(); - $f || system($ssh, "$user$host", @command); - exit(0) unless ($f || $seq); # Exit if not parent and not sequential + my $f = $seq ? 0 : fork(); + $f || system($ssh, "$user$host", @command); + exit(0) unless ($f || $seq); # Exit if not parent and not sequential } while (wait() != -1) {} # Wait for all children to exit exit(0); -