diff --git a/acpid.pl b/acpid.pl index 116bd74..26ba8e5 100644 --- a/acpid.pl +++ b/acpid.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl +# hibernates laptop if battery discharging and charge is too low use strict; use warnings "all"; diff --git a/copier.pl b/copier.pl index 7463494..b9741ce 100644 --- a/copier.pl +++ b/copier.pl @@ -1,27 +1,32 @@ -#!/usr/bin/perl - -use strict; -use warnings "all"; -use File::Copy; - - -my $file; -my $counter = 1; -my @list; -my $curdir = 1; -mkdir ($curdir); -opendir (DIR, "."); -foreach $file (readdir(DIR)){ -next unless ($file =~ /\.zip$/); - if($counter == 5000){ - $counter = 1; - $curdir = $curdir + 1; - mkdir ($curdir); - } - my $nefile = $curdir .'/'.$file; - print "$file $nefile\n"; - move($file, $nefile) or die "$!"; - $counter = $counter + 1; -} -closedir (DIR); - +#!/usr/bin/perl +# finds and copies .zip to numeric subdirs + +use strict; +use warnings "all"; +use File::Copy; + + +my $file; +my $counter = 1; +my @list; +my $curdir = 1; +mkdir ($curdir); +opendir (DIR, "."); + +foreach $file (readdir(DIR)){ + next unless ($file =~ /\.zip$/); + + if($counter == 5000){ + $counter = 1; + $curdir = $curdir + 1; + mkdir ($curdir); + } + + my $nefile = $curdir .'/'.$file; + print "$file $nefile\n"; + move($file, $nefile) or die "$!"; + $counter = $counter + 1; +} + +closedir (DIR); + diff --git a/dirlist.pl b/dirlist.pl index 25729b8..8b9e991 100644 --- a/dirlist.pl +++ b/dirlist.pl @@ -1,47 +1,47 @@ -#!/usr/bin/perl -# -# slow implementation of recursive dir listing -# - -use strict; -use warnings "all"; - -sub getfilenames; -sub help; - -help unless defined($ARGV[0]); - -my @files = (); -getfilenames($ARGV[0]); -my $file = ""; - -while($file = pop (@files)){ - print "$file\n"; -} - -exit 0; - -sub getfilenames { - my $path = shift; - - opendir (DIR, $path) or return ""; - my @localfiles; - @localfiles = - map { $path . '/' . $_ } - grep { !/^\.{1,2}$/ } - readdir (DIR); - @files = (@files, @localfiles); - - foreach (@localfiles) { - next if(-l $_); - if( -d $_){ - getfilenames($_); - } - } - -} - -sub help { - print "Usage: $0 dir\n"; - exit 0; -} +#!/usr/bin/perl +# +# slow implementation of recursive dir listing +# + +use strict; +use warnings "all"; + +sub getfilenames; +sub help; + +help unless defined($ARGV[0]); + +my @files = (); +getfilenames($ARGV[0]); +my $file = ""; + +while($file = pop (@files)){ + print "$file\n"; +} + +exit 0; + +sub getfilenames { + my $path = shift; + + opendir (DIR, $path) or return ""; + my @localfiles; + @localfiles = + map { $path . '/' . $_ } + grep { !/^\.{1,2}$/ } + readdir (DIR); + @files = (@files, @localfiles); + + foreach (@localfiles) { + next if(-l $_); + if( -d $_){ + getfilenames($_); + } + } + +} + +sub help { + print "Usage: $0 dir\n"; + exit 0; +} diff --git a/dns-hit.pl b/dns-hit.pl index dba64f5..b3e769b 100644 --- a/dns-hit.pl +++ b/dns-hit.pl @@ -1,4 +1,5 @@ #!/usr/bin/env perl +# dns shooting utility use strict; use warnings "all"; diff --git a/hdmi_toggle.sh b/hdmi_toggle.sh index 02fbd39..313749d 100644 --- a/hdmi_toggle.sh +++ b/hdmi_toggle.sh @@ -1,4 +1,6 @@ #!/bin/bash +# ugly udev hook to toggle display configuration + # grab the display and xauthority cookie export DISPLAY=$(w -h -s | grep ":[0-9]\W" | head -1 | awk '{print $2}') diff --git a/httpd.pl b/httpd.pl index 4105bab..f0d67ae 100644 --- a/httpd.pl +++ b/httpd.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl +# sample incomplete http server application use strict; use warnings "all";