Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts
Wednesday, July 25, 2012
Random Password Generator
N := factor of 3
% N=9 ; (dd if=/dev/urandom bs=$N count=1 | uuencode -m - | sed -n '2p') 2>/dev/null
--
= ^ . ^ =
Tuesday, June 19, 2012
Kill annoying processes that match a pattern
So, there was a bunch of annoying processes named wit a pattern and I wanted to kill all of them
Here is the script (I know this can be done in a much cleaner way in awk, but I like this way)
#!/bin/sh
Here is the script (I know this can be done in a much cleaner way in awk, but I like this way)
#!/bin/sh
P="master(-worker)?"
PS=/bin/ps
SED=/bin/sed
KILL=/bin/kill
GREP=/bin/grep
CUT=/usr/bin/cut
$KILL `$PS ax | $GREP -E $P | $GREP -v grep | $SED -e 's/^\ \+//g' | $CUT -d ' ' -f 1 | $GREP -E '^[[:digit:]]+'`
--
= ^ . ^ =
Subscribe to:
Posts (Atom)