Skip to content

Instantly share code, notes, and snippets.

View ke4roh's full-sized avatar

Jim Scarborough ke4roh

View GitHub Profile
@ke4roh
ke4roh / lab1SchemaSetup.sh
Created October 13, 2015 15:50
Solr Under The Hood Getting Started field definition
#!/bin/bash
curl http://localhost:8983/solr/gettingstarted/schema -D - -X POST -H \
'Content-type:application/json' --data-binary '{
"add-field" : {
"name":"name",
"type":"text_general",
"stored":true
},
"add-field" : {
@ke4roh
ke4roh / findJavaHome.sh
Created August 5, 2015 16:52
Where is JAVA_HOME?
#!/bin/bash
function whereIsFile() {
pushd . > /dev/null
FILE_PATH=$1;
while([ -h "${FILE_PATH}" ]) do cd -P $(dirname "${FILE_PATH}"); FILE_PATH=$(readlink "${FILE_PATH}"); done
cd -P $(dirname "${FILE_PATH}") > /dev/null
echo $(pwd)
popd >/dev/null
}
@ke4roh
ke4roh / whereIsFile.sh
Created August 5, 2015 15:03
Find out where the symbolic links bottom out
#!/bin/sh
FILE_PATH=$1;
while([ -h "${FILE_PATH}" ]) do cd -P $(dirname "${FILE_PATH}"); FILE_PATH=$(readlink "${FILE_PATH}"); done
cd -P $(dirname "${FILE_PATH}") > /dev/null
echo $(pwd);
@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