Skip to content

Instantly share code, notes, and snippets.

View chanslor's full-sized avatar
😃
Focusing

Mike Chanslor chanslor

😃
Focusing
  • DevOps Engineer
  • Birmingham, ALABAMA
View GitHub Profile
meld <(ssh -q host01.domain.com "cat /etc/postfix/main.cf") <(ssh -q host02.domain.com "cat /etc/postfix/main.cf")
@chanslor
chanslor / AIX-shadow-password-last-changed.ksh
Created October 19, 2017 15:46
AIX shadow password last changed
#!/bin/ksh
function lastpwchg { [ "`whoami`" = "root" ] || { echo "Must be root"; return; }; printf "$1: "; lastupdate=`lsuser -a lastupdate $1 2>/dev/null | awk -F= "{print \\$2}"`; [ -n "$lastupdate" ] && perl -e "print \"Last password change: \" . scalar (localtime($lastupdate)) . \"\n\" " || echo "User does not exist or has no lastupdate attribute"; }
#Test with root
lastpwchg root
@chanslor
chanslor / grab-river-levels.bash
Created October 19, 2017 15:43
Connect to USGS and find out if Kayaking is possible
#!/bin/bash
# MAIN MAP FOR AL:
# http://maps.waterdata.usgs.gov/mapper/index.html?state=al
#
# 02423414 LITTLE CAHABA RIVER AT CAH BEA RD NR CAHABA HTS AL #Cahaba Beach Road
# URL: https://waterdata.usgs.gov/nwis/uv?site_no=02423414
# NOTE: Seems to drop about 3"/hour after peaking.
#
@chanslor
chanslor / split-names.bash
Created October 19, 2017 15:34
Taking semi colon delimited args in for loop
#!/bin/bash
#STR="Sarah;Lisa;Jack;Rahul;Johnson" #String with names
STR=$(cat users.txt)
if [ -z $STR ] ; then
echo "STR is not set."
exit 1
fi