1

Added description for some scripts

Changed eol for some scripts
This commit is contained in:
eleksir
2018-09-17 16:52:49 +03:00
parent b2b8a3c755
commit edfc5254ea
6 changed files with 84 additions and 74 deletions

View File

@@ -1,4 +1,5 @@
#!/usr/bin/perl #!/usr/bin/perl
# hibernates laptop if battery discharging and charge is too low
use strict; use strict;
use warnings "all"; use warnings "all";

View File

@@ -1,27 +1,32 @@
#!/usr/bin/perl #!/usr/bin/perl
# finds and copies .zip to numeric subdirs
use strict;
use warnings "all"; use strict;
use File::Copy; use warnings "all";
use File::Copy;
my $file;
my $counter = 1; my $file;
my @list; my $counter = 1;
my $curdir = 1; my @list;
mkdir ($curdir); my $curdir = 1;
opendir (DIR, "."); mkdir ($curdir);
foreach $file (readdir(DIR)){ opendir (DIR, ".");
next unless ($file =~ /\.zip$/);
if($counter == 5000){ foreach $file (readdir(DIR)){
$counter = 1; next unless ($file =~ /\.zip$/);
$curdir = $curdir + 1;
mkdir ($curdir); if($counter == 5000){
} $counter = 1;
my $nefile = $curdir .'/'.$file; $curdir = $curdir + 1;
print "$file $nefile\n"; mkdir ($curdir);
move($file, $nefile) or die "$!"; }
$counter = $counter + 1;
} my $nefile = $curdir .'/'.$file;
closedir (DIR); print "$file $nefile\n";
move($file, $nefile) or die "$!";
$counter = $counter + 1;
}
closedir (DIR);

View File

@@ -1,47 +1,47 @@
#!/usr/bin/perl #!/usr/bin/perl
# #
# slow implementation of recursive dir listing # slow implementation of recursive dir listing
# #
use strict; use strict;
use warnings "all"; use warnings "all";
sub getfilenames; sub getfilenames;
sub help; sub help;
help unless defined($ARGV[0]); help unless defined($ARGV[0]);
my @files = (); my @files = ();
getfilenames($ARGV[0]); getfilenames($ARGV[0]);
my $file = ""; my $file = "";
while($file = pop (@files)){ while($file = pop (@files)){
print "$file\n"; print "$file\n";
} }
exit 0; exit 0;
sub getfilenames { sub getfilenames {
my $path = shift; my $path = shift;
opendir (DIR, $path) or return ""; opendir (DIR, $path) or return "";
my @localfiles; my @localfiles;
@localfiles = @localfiles =
map { $path . '/' . $_ } map { $path . '/' . $_ }
grep { !/^\.{1,2}$/ } grep { !/^\.{1,2}$/ }
readdir (DIR); readdir (DIR);
@files = (@files, @localfiles); @files = (@files, @localfiles);
foreach (@localfiles) { foreach (@localfiles) {
next if(-l $_); next if(-l $_);
if( -d $_){ if( -d $_){
getfilenames($_); getfilenames($_);
} }
} }
} }
sub help { sub help {
print "Usage: $0 dir\n"; print "Usage: $0 dir\n";
exit 0; exit 0;
} }

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env perl #!/usr/bin/env perl
# dns shooting utility
use strict; use strict;
use warnings "all"; use warnings "all";

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
# ugly udev hook to toggle display configuration
# grab the display and xauthority cookie # grab the display and xauthority cookie
export DISPLAY=$(w -h -s | grep ":[0-9]\W" | head -1 | awk '{print $2}') export DISPLAY=$(w -h -s | grep ":[0-9]\W" | head -1 | awk '{print $2}')

View File

@@ -1,4 +1,5 @@
#!/usr/bin/perl #!/usr/bin/perl
# sample incomplete http server application
use strict; use strict;
use warnings "all"; use warnings "all";