[colug-432] 2014-09-24會議 Scribbles 落書/惡文?

R P Herrold herrold at owlriver.com
Fri Sep 26 12:04:03 EDT 2014

Hash: SHA1

On Thu, 25 Sep 2014, jep200404 at columbus.rr.com wrote:

> combining multiple commands, especially loops

>     If you're repeating some monster command often,
>     it might be a good candidate to put into a shell script.

which also presents an opportunity to refactor in error 
checking, options processing, input validation, adding a usage 
message, and 'eating through' the $ARG array, so the user need 
not repeatedly tweak a long command

Rob and I seem to have similar collection sizes

[herrold at centos-6 ~]$ cd bin
[herrold at centos-6 bin]$ ls | wc -l

[herrold at centos-6 bin]$ wc -l * 2> /dev/null | sort -n | tail
    493 ratchet_leader_volatility.sh	(a cron script used in 
					financial markets trading)
    510 secure-rpm-qa-20120821.txt  	(a driver file for a 
    521 ORCbuildit		(SRPM or .spec file builder)
    542 rph-rpmbuild		(and this)
    621 gen-pw.sh		(local 'passwd complexity' tool)
    701 srcfind			(more below)
   1518 dhcp.txt		(another driver)
   1835 smtm-RPH		(another financial markets 
  11122 pine			(a wrapper for alpine adding 
				GnuPG key agent management)

[herrold at centos-6 bin]$ history | cut -c 21-| awk {'print $1'} 
| sort | uniq -c | sort -n | tail -n 10 ; history | wc -l
     21 history
     27 ./manual.sh	(a git CI helper)
     32 srcfind		(a local SRPM searching tool)
     41 scp
     49 less
     64 ls
     89 joe
    135 ssh
    136 git
    190 cd
[herrold at centos-6 bin]$

> history options
> The history can have timestamps. This can help one look for
> an old command that

... that 'cut' command is to trim away time and date (which is 
fixed column width) marking from my archive (mentioned in a 

I consider my 'gen-pw.sh' more useful than: pwgen

[herrold at centos-6 bin]$ gen-pw.sh  -m

so: no specials but mixed case, specials and mixed case, mixed 
case and MORE specials, all numeric

Usually I can conform to some site's arbitrary rules with one 
of those choices.  It can even accomodate sites that cannot 
imagine why long strings are useful as passwords:

[herrold at centos-6 bin]$ gen-pw.sh  -m 10

(here ARG1 being the maxlength to trim down to)

and I wrote a mess of options, which is usually overkill as I 
normally just use '-m'

[herrold at centos-6 bin]$ gen-pw.sh  -h
Usage: gen-pw.sh [-a] [-d] [-h] (length)
       -a limits to alphanumerics
       -j alphanumeric with just one special (default)
       -z alphanumeric, special, and HARD specials
       -l limits to letters
       -m mixed alphanumeric and specials
       -n numerics
       -x hexadecimal mixed

[herrold at centos-6 bin]$ wc -l shuffle-stdin.php gen-pw.sh
   34 shuffle-stdin.php
  621 gen-pw.sh

I'll look at that code, and push it out to github [I looked, 
cleaned up a bit and pushed under a GPLv3+ re-license;  pull 
requests welcomed] -- but it sort of grew, rather than was 
designed; and the shell script is FUGLY.  The PHP is a 'card 
shuffling and dealing' pipeline friendly, with an algorithm 
that takes an arbitrary 'deck' of characters

[herrold at centos-6 bin]$ grep -A1 -B1 php gen-pw.sh     
export DECK=` echo \
        tr -s 'a-zA-Z0-9' | awk {'print $1'} | shuffle-stdin.php | \            
        cut -c 1-${CUTLEN} `

I know it could be refactored, but, why?  It needs my modest 

>         Russ mentioned deliberating executing a comment command, so that it
>         ends up in the history to document the following (or preceding)
>         commands.

and I use it:

[herrold at centos-6 bin]$ history | cut -c 21-| grep "^#" | wc -l

>             Jason and Russ, please elaborate on the benefits and drawbacks of
>             "shopt -s histappend". 

I am not so sure here as I use a 'small' number history depth;  
also I tend not to close some shells (multi-day development 
work)  in which I have a lot of retained state, but perversely 
will pop open a shell 'tactically' for a transient task, and 
then kill it off with a:

> Russ, what the line number and URL for your nasty example from
> https://github.com/herrold/?

It was an extension of a pipe usage trick I learned from Alan 
Cox back in the dial-up days.  The particular one was [2] at 
line 79

> Is Apple's default search engine now duckduckgo, not Google anymore? 

I said that Safari had added DDG, not that it was defaulted 
in, as I don't know that one way ot the other.  DDG is at 
Github [3]

> Has Apple's canary disappeared?

I heard such a report reporting its absence from Apple's most 
recent transparency report which seems to be confirmed in a 
quick DDG search [4]

Also worth reading and considering thoughtfully is the Apple 
whitepaper on the boot chain validations, anti-replay efforts 
for imaging devices, and more [5]

- -- Russ herrold

[1] https://github.com/herrold/tool-tips/convenience/
[2] https://github.com/herrold/tool-tips/blob/master/convenience/push-reboot-notice.sh
	yuck ... where did that 'blob/master' find its way 
	into URL display at GH ;)
[3] https://github.com/duckduckgo
[4] https://gigaom.com/2014/09/18/apples-warrant-canary-disappears-suggesting-new-patriot-act-demands/
[5] http://images.apple.com/privacy/docs/iOS_Security_Guide_Sept_2014.pdf

Version: GnuPG v2.0.14 (GNU/Linux)

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SpamAssassinReport.txt
Url: http://lists.colug.net/pipermail/colug-432/attachments/20140926/cafaf353/attachment.txt 

More information about the colug-432 mailing list