Compare commits
2 Commits
4cccba22de
...
40b68f35a6
Author | SHA1 | Date | |
---|---|---|---|
|
40b68f35a6 | ||
|
d4165f1117 |
3
perl-script/.gitignore
vendored
3
perl-script/.gitignore
vendored
@ -1 +1,2 @@
|
||||
*.json
|
||||
*.json
|
||||
*.json.[0-9]*
|
@ -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]);
|
||||
}
|
||||
|
32
perl-script/user_cleanup.pl
Normal file
32
perl-script/user_cleanup.pl
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
my $fn;
|
||||
my $cmd_out;
|
||||
|
||||
my $dn;
|
||||
my @hd;
|
||||
|
||||
$dn = "/home/";
|
||||
|
||||
opendir MYDIR, $dn or die "could not open $dn";
|
||||
@hd = readdir MYDIR;
|
||||
closedir MYDIR;
|
||||
|
||||
@hd = grep {!($_ =~ /^\..*$/)} @hd;
|
||||
|
||||
$fn = "/tilde/lyadmin/user_list.txt";
|
||||
|
||||
open FILE, "<", $fn or die "could not open $fn";
|
||||
|
||||
while(<FILE>){
|
||||
chomp;
|
||||
|
||||
unless(exists( {map { $_ => 1} @hd}->{$_})){
|
||||
printf("Deleting user %s\n", $_);
|
||||
`userdel $_`;
|
||||
}
|
||||
}
|
||||
close FILE
|
Loading…
Reference in New Issue
Block a user