Skip to content

Instantly share code, notes, and snippets.

View ke4roh's full-sized avatar

Jim Scarborough ke4roh

View GitHub Profile
@ke4roh
ke4roh / kcheck
Created June 24, 2015 14:43
perform kinit if there is no kerberos ticket
#!/bin/bash
while ! klist -s ; do
ERR=$( kinit 3>&2 2>&1 1>&3- )
EC=$?
if [ $EC -ne 0 ] ; then
echo $ERR
if ( echo $ERR | grep -q "Cannot contact any KDC" ) ; then
exit 2
fi
@ke4roh
ke4roh / islocalhost
Created May 28, 2015 13:54
Determine if the given host is localhost
#!/bin/bash
set -e
function isLocalhost {
local TEST_IP=$(getent hosts $1 | cut -f1 -d\ | head -1)
local ALL_MY_IPS=$(ip addr | grep inet | grep -v link | cut -f2- -de | cut -f2 -d\ | cut -f1 -d/)
( echo $ALL_MY_IPS | grep -q $TEST_IP ) && return 0
return 1
}
@ke4roh
ke4roh / Gemfile
Last active April 2, 2023 10:56 — forked from binarydev/json_utilities.rb
declare module_function
source 'https://rubygems.org'
gem 'json'
group :test do
gem 'minitest'
gem 'test-unit'
end
#!/bin/bash
set -e
[ -e /etc/profile.d/proxy.sh ] && source /etc/profile.d/proxy.sh
# Some defaults that may be overridden by command line
HEADLESS=false
CLEAN=false
# Execute getopt