From f814f57f5d731be146e600bc9956f171d605b94f Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Fri, 31 Aug 2012 16:27:45 +0200 Subject: [PATCH 1/3] blink: Default now blinks only non-detected slots. --- blink/blink | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/blink/blink b/blink/blink index e3c7150..ec69577 100755 --- a/blink/blink +++ b/blink/blink @@ -14,12 +14,16 @@ B I I =head1 DESCRIPTION -B blinks a device in an external harddisk enclosure. +B blinks a device in a harddisk enclosure. If no I is given the blinking be will toggled. -If no I is given all detected disks in external enclosures will -be used. +If no I is given all detected disks in enclosures will be +used. + +If no I and no I 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 @@ -92,13 +96,18 @@ B =head1 EXAMPLE: Blink all undetected slots -To blink all undetected slots we first blink all detected and then toggle all slots: - -B - It will be safe to remove disk from all the blinking slots as the slots are either empty or not detected. +B + + +=head1 EXAMPLE: Turn off blinking of all slots + +Turn off the blinking. + +B + =head1 EXIT STATUS @@ -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) { $locate = "/sys/class/enclosure/*/*/device/enclosure*/locate"; } elsif($::opt_allslots) { From 921a486b476939d2f95760d5e7e61b5468912b45 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Tue, 4 Sep 2012 15:32:24 +0200 Subject: [PATCH 2/3] goodpasswd: Added --- goodpasswd/goodpasswd | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 goodpasswd/goodpasswd diff --git a/goodpasswd/goodpasswd b/goodpasswd/goodpasswd new file mode 100755 index 0000000..3309d8c --- /dev/null +++ b/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"; From 9c79187522566b3e787e48f05668a9eafcb693ba Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Tue, 4 Sep 2012 15:33:44 +0200 Subject: [PATCH 3/3] Makefile: added goodpasswd --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6eeb759..28298de 100644 --- a/Makefile +++ b/Makefile @@ -10,5 +10,5 @@ upsidedown/upsidedown.1: upsidedown/upsidedown pod2man upsidedown/upsidedown > upsidedown/upsidedown.1 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