Skip to content

Instantly share code, notes, and snippets.

Les Hazlewood lhazlewood

Block or report user

Report or block lhazlewood

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lhazlewood / get_jdk_vendor
Created Nov 27, 2019
Determine the jdk vendor from the command line
View get_jdk_vendor
java -XshowSettings:properties -version 2>&1 | grep 'java.vendor =' | awk -F'= ' '{print $2}'
lhazlewood / gist:24134e708248b8a651ed9dd43df15cad
Created Feb 6, 2019
macos sierra on virtualbox addendum
View gist:24134e708248b8a651ed9dd43df15cad
$ NAME="macOSSierra"
$ VBoxManage setextradata "$NAME" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Mac-F22589C8"
$ VBoxManage setextradata "$NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" "CK1156I6DB6"
$ VBoxManage modifyvm "$NAME" --paravirtprovider none
# after reboot:
$ VBoxManage modifyvm "$NAME" --paravirtprovider default
lhazlewood /
Last active Nov 2, 2018
Find all existing JDK or JRE installations on RedHat, Centos or Fedora
# Specifically JDK installations (contain 'javac' command) and not JREs:
yum --disablerepo=* whatprovides '*/bin/javac' | grep ilename | awk -F': ' '{print $2}' | sed 's/\/bin\/javac//'
# All JRE installations (those with bin/java but without bin/javac). Includes JREs that are included in JDKs.
for candidate in $(yum --disablerepo=* whatprovides '*/bin/java' | grep ilename | awk -F': ' '{print $2}' | sed 's/\/bin\/java//'); do
if [ ! -x "${candidate}/bin/javac" ]; then
echo "${candidate}"
lhazlewood / gist:e7d09ca3a847a93dbad79570b4d22baf
Created Nov 1, 2018
Print an ansible fact or variable on the command line using the ansible cli and jq
View gist:e7d09ca3a847a93dbad79570b4d22baf
# for example, to print ansible_distribution:
ansible localhost -m setup 2>/dev/null | sed '1 s/^.*$/{/' | jq -r '.ansible_facts.ansible_distribution'
lhazlewood /
Created Jun 14, 2018
Using curl on macos to execute a single http request and then get the status code, headers and body
response="$(curl --silent --show-error -i"
status_code="$(echo "$response" | head -1 | awk '{print $2}')"
headers="$(echo "$response" | sed "/^\s*$(printf '\r')*$/q" | sed '/^[[:space:]]*$/d' | tail -n +2)"
body="$(echo "$response" | sed "1,/^\s*$(printf '\r')*$/d")"
View reset_mac_audio
echo `ps -A | grep coreaudiod | grep -v grep`
sudo kill `ps -A -o pid,comm | grep coreaudiod | grep -v grep | awk '{ print $1 }'`
sleep 1
echo `ps -A | grep coreaudiod | grep -v grep`
#!/usr/bin/env bash
[[ -z "$JAVA_HOME" ]] && echo "JAVA_HOME must be set" && exit 1
cd $JAVA_HOME/jre/lib/security
curl -LO "" -H 'Cookie: oraclelicense=accept-securebackup-cookie'
# backup existing JVM files that we will replace just in case:
mv local_policy.jar local_policy.jar.orig
mv US_export_policy.jar US_export_policy.jar.orig
lhazlewood / m2
Created Mar 24, 2016
Bash script to switch maven configurations by name
View m2
#!/usr/bin/env bash
if [ ! -L "$LINK_FILE" ]; then
echo "This program expects $LINK_FILE to be a symbolic link."
exit 1
if [ -z "$1" ]; then
lhazlewood / gist:118af652fee56873d51a
Created Sep 10, 2014
Building rdeslonde/Stormpath-SDK-CSharp with mono 3.8.0
View gist:118af652fee56873d51a
xbuild StormPathUserManagement.sln /p:TargetFrameworkProfile="" /p:TargetFrameworkVersion="v4.5" /p:TreatWarningsAsErrors="false"
XBuild Engine Version 12.0
Mono, Version
Copyright (C) 2005-2013 Various Mono authors
Build started 9/9/2014 6:49:25 PM.
Project "/Users/lhazlewood/projects/lhazlewood/Stormpath-SDK-CSharp/StormPathUserManagement.sln" (default target(s)):
Target ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".

Keybase proof

I hereby claim:

  • I am lhazlewood on github.
  • I am lhazlewood ( on keybase.
  • I have a public key whose fingerprint is 3441 1B65 D710 D8F5 B3E9 E029 015E F5B6 FD1F 998B

To claim this, I am signing this object:

You can’t perform that action at this time.