diff --git a/perl-script/.gitignore b/perl-script/.gitignore index 94a2dd1..75c185e 100644 --- a/perl-script/.gitignore +++ b/perl-script/.gitignore @@ -1 +1,2 @@ -*.json \ No newline at end of file +*.json +*.json.[0-9]* \ No newline at end of file diff --git a/perl-script/bookdl.pl b/perl-script/bookdl.pl index 5cd039d..652d295 100644 --- a/perl-script/bookdl.pl +++ b/perl-script/bookdl.pl @@ -13,15 +13,29 @@ my $URL_PREFIX; my $FN; my $OUT_DIR; +my $USAGE; +my $ACMD; + my %jh; my @a1; -$URL_PREFIX = "https://lainchan.org/lit/src/"; -$THREAD_NO = 4953; +$DOMAIN = "lainchan.org"; +# $URL_PREFIX = "https://lainchan.org/lit/src/"; +$URL_PREFIX = "https://$DOMAIN/lit/src/"; +$THREAD_NO = 4619; +# $THREAD_NO = 6105; +# $THREAD_NO = 4345; +# $THREAD_NO = 4953; $FN = "$THREAD_NO.json"; $OUT_DIR = "./dl/"; + +$USAGE = "Usage: bookdl.pl [http://someurl/]thread_id"; + +die "$USAGE" unless scalar @ARGV > 0; +$ACMD = $ARGV[0]; + # Read JSON with list of files open FILE, "<", $FN or die "could not open file"; do{ @@ -88,5 +102,5 @@ close FILE; # Print a list of wget commands from our tuples for my $i1 (@a1){ - printf("wget -N %s -O '%s%s'\n", scalar $i1->[1], $OUT_DIR, scalar $i1->[0]); + printf("wget -nc %s -O '%s%s'\n", scalar $i1->[1], $OUT_DIR, scalar $i1->[0]); } diff --git a/perl-script/user_cleanup.pl b/perl-script/user_cleanup.pl new file mode 100644 index 0000000..4ada3bd --- /dev/null +++ b/perl-script/user_cleanup.pl @@ -0,0 +1,20 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +my $fn; +my $cmd_out; + +$fn = "/tilde/lyadmin/user_list.txt"; + +open FILE, "<", $fn or die "could not open $fn"; + +$cmd_out = `ls /home`; +chomp $cmd_out; + +while(){ + chomp; + `userdel $_` unless($cmd_out =~ /$_/); +} +close FILE;