Skip to content

Commit

Permalink
add tools
Browse files Browse the repository at this point in the history
  • Loading branch information
grawity committed Feb 14, 2012
1 parent 2bbfdfc commit 32b0fbf
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/lskeytab
1 change: 1 addition & 0 deletions bin/merge-dirs
1 change: 1 addition & 0 deletions bin/wget-raw-archive.org
26 changes: 26 additions & 0 deletions kerberos/lskeytab
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env perl
use List::MoreUtils 'uniq';
use feature 'say';

my %hosts;
my %services;

my $skip = 3;
for my $line (`klist -k`) {
next if $skip and $skip--;
if ($line =~ /^\s*(\d+)\s+(\S+)@(\S+)$/) {
my ($kvno, $princ, $realm) = ($1, $2, $3);
my ($svc, $host) = split(m|/|, $princ, 2);
push @{$hosts{$host}}, $svc;
push @{$services{$svc}}, $host;
}
}

while (my ($host, $services) = each %hosts) {
say "host $host:";
my @sv;
for my $service (uniq sort {lc $a cmp lc $b} @$services) {
push @sv, $service;
}
say " ", join(", ", @sv);
}
14 changes: 14 additions & 0 deletions misc/merge-dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
dest=$1
sources=( "${@:2}" )

find "${sources[@]}" -type d -printf '%P\0' |
sort -z -u |
while read -r -d '' dir; do
mkdir -v -p "$dest/$dir"
done

find "${sources[@]}" -type f -printf '%H\0%P\0' |
while read -r -d '' fsource && read -r -d '' fpath; do
cp -v -a "$fsource/$fpath" "$dest/$fpath"
done
10 changes: 10 additions & 0 deletions web/wget-raw-archive.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# wget-raw-archive.org - download raw archive.org pages bypassing robots
args=()
for arg; do
if [[ $arg == 'http://'* ]]; then
arg=${arg/'/http:/'/'id_/http:/'}
fi
args+=("$arg")
done
exec wget -e robots=off "${args[@]}"

0 comments on commit 32b0fbf

Please sign in to comment.