Archived
1
0

Initial commit

This commit is contained in:
2017-01-15 13:23:49 -06:00
commit 7cab8a6bda
10 changed files with 166 additions and 0 deletions

5
functions/_fmkrb5 Normal file
View File

@@ -0,0 +1,5 @@
#compdef fmkrb5
_arguments \
'(-):command: _command_names -e' \
'*::arguments: _normal'

12
functions/kadmin Normal file
View File

@@ -0,0 +1,12 @@
# vim: set ft=zsh :
#
kadmin() {
local realm=$(klist | awk -F@ '/Default principal/{print $2}')
if [[ -z ${realm} ]]; then
echo 'could not find realm'
return 1
fi
command kadmin -r ${realm}
}
kadmin "$@"

1
functions/precmd Normal file
View File

@@ -0,0 +1 @@
print -Pn "\e]0;%n@%m:%~ (%y%)\a"

6
functions/startrole Normal file
View File

@@ -0,0 +1,6 @@
# vim: set ft=zsh :
for arg; do
install -d roles/${arg}/{,tasks,templates,defaults,files,meta,vars,handlers}
touch roles/${arg}/tasks/main.yml
done

51
functions/switchrealm Normal file
View File

@@ -0,0 +1,51 @@
# vim: set ft=zsh :
switchrealm() {
local realm principal
case ${1:l} in
s|sp|securepassage.com)
realm=SECUREPASSAGE.COM
localdomain=${realm:l}
principal=dhatch@${realm}
;;
d|dev|dev.cloud.frmn)
realm=DEV.CLOUD.FRMN
localdomain=${realm:l}
principal=dhatch@${realm}
;;
t|test|testing|testing.cloud.frmn)
realm=TESTING.CLOUD.FRMN
localdomain=${realm:l}
principal=dhatch@${realm}
;;
p|prod|prod.cloud.frmn)
realm=PROD.CLOUD.FRMN
localdomain=${realm:l}
principal=dhatch@${realm}
;;
*)
realm=${1}
localdomain=${3:-${realm:l}}
;;
esac
if [[ -z ${realm} ]]; then
unset KRB5CCNAME
unset LOCALDOMAIN
else
cachefile=/tmp/.krb5cc_$(id -u)_${realm}
export KRB5CCNAME=${cachefile}
export LOCALDOMAIN=${localdomain}
if ! klist -s; then
: ${principal:=${2:-${LOGNAME}}}
if [[ ! ${principal} = *@* ]]; then
principal=${principal}@${realm}
fi
kinit ${principal}
fi
fi
klist
}
switchrealm "$@"

2
functions/vi-search-fix Normal file
View File

@@ -0,0 +1,2 @@
zle vi-cmd-mode
zle .history-incremental-search-backward

2
functions/vmip Normal file
View File

@@ -0,0 +1,2 @@
virsh qemu-agent-command $1 '{"execute":"guest-network-get-interfaces"}' \
| jq -r '.return | .[] | select(.name=="eth0") | .["ip-addresses"] | .[] | select(.["ip-address-type"] == "ipv6" and (.["ip-address"]|startswith("fe80")|not)) | .["ip-address"]'