Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ole-tange/tangetools
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole Tange committed Sep 20, 2012
2 parents dcbc907 + 9c79187 commit 5777fa9
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -13,5 +13,5 @@ tracefile/tracefile.1: tracefile/tracefile.pod
pod2man tracefile/tracefile.pod > tracefile/tracefile.1 pod2man tracefile/tracefile.pod > tracefile/tracefile.1


install: install:
parallel ln -sf `pwd`/{}/{} /usr/local/bin/{} ::: blink reniced em field forever neno rn stdout tracefile w4it-for-port-open upsidedown histogram parallel ln -sf `pwd`/{}/{} /usr/local/bin/{} ::: blink reniced em field forever neno rn stdout tracefile w4it-for-port-open upsidedown histogram goodpasswd
parallel ln -sf `pwd`/{} /usr/local/share/man/man1/{/} ::: */*.1 parallel ln -sf `pwd`/{} /usr/local/share/man/man1/{/} ::: */*.1
35 changes: 28 additions & 7 deletions blink/blink
Expand Up @@ -14,12 +14,16 @@ B<blink> I<action> I<what>
=head1 DESCRIPTION =head1 DESCRIPTION
B<blink> blinks a device in an external harddisk enclosure. B<blink> blinks a device in a harddisk enclosure.
If no I<action> is given the blinking be will toggled. If no I<action> is given the blinking be will toggled.
If no I<device> is given all detected disks in external enclosures will If no I<device> is given all detected disks in enclosures will be
be used. used.
If no I<action> and no I<device> is given all detected harddisks will
be off and all empty slots or slots with non-detected harddisks in
enclosures will blink. These slots should be safe to remove.
=head1 OPTIONS =head1 OPTIONS
Expand Down Expand Up @@ -92,13 +96,18 @@ B<blink /dev/sdf>
=head1 EXAMPLE: Blink all undetected slots =head1 EXAMPLE: Blink all undetected slots
To blink all undetected slots we first blink all detected and then toggle all slots:
B<blink; blink -s>
It will be safe to remove disk from all the blinking slots as the It will be safe to remove disk from all the blinking slots as the
slots are either empty or not detected. slots are either empty or not detected.
B<blink>
=head1 EXAMPLE: Turn off blinking of all slots
Turn off the blinking.
B<blink -s -f>
=head1 EXIT STATUS =head1 EXIT STATUS
Expand Down Expand Up @@ -160,6 +169,18 @@ if(@ARGV) {
} }
} }


if(not ($::opt_on or $::opt_off or $::opt_toggle or
$::opt_alldetected or $::opt_allslots or @ARGV)) {
# Default:
# Turn on all
# Turn off all-detected
$locate = "/sys/class/enclosure/*/*/locate";
on($locate);
$locate = "/sys/class/enclosure/*/*/device/enclosure*/locate";
off($locate);
exit;
}

if($::opt_alldetected) { if($::opt_alldetected) {
$locate = "/sys/class/enclosure/*/*/device/enclosure*/locate"; $locate = "/sys/class/enclosure/*/*/device/enclosure*/locate";
} elsif($::opt_allslots) { } elsif($::opt_allslots) {
Expand Down
34 changes: 34 additions & 0 deletions goodpasswd/goodpasswd
@@ -0,0 +1,34 @@
#!/usr/bin/perl

# This program generates passwords that:
#
# * are hard to guess
# * will be displayed unambigously in any (normal) font
# * will survive being passed through a bad fax machine
# * has UPPER lower number and sign
#
# Too close: B8 cC g9 kK lI l1 oO O0 pP sS uU vV xX zZ ,. :; `' S5
# Causes problems in URLs: @/:
# Causes problems in shell: ! " # $ & ( ) [ ] { } ? | < > \ *
# SQL uses: % for wildcard
# Hard to type: ^ ~ ¨ ¤ § ½ æ ø å Æ Ø Å
# Never 2 same chars next to eachother. (--) is bad

my $pw;
my @chars=split //, 'abdefhijmnqrtyADEFGHJLMNQRTY23467=+-';
do {
$pw = "";
for (1..12) {
do {
# avoid double chars (such as --)
$this = $chars[rand $#chars+1]
} while($last eq $this);
$last = $this;
$pw .= $this;
}
} while (not($pw =~ /[A-Z]/ and
$pw =~ /[a-z]/ and
$pw =~ /[0-9]/ and
$pw =~ /[^a-zA-Z0-9]/));

print "$pw\n";

0 comments on commit 5777fa9

Please sign in to comment.