Skip to content

Instantly share code, notes, and snippets.

View akutz's full-sized avatar

Andrew Kutz akutz

View GitHub Profile
@akutz
akutz / README.md
Last active July 9, 2023 01:36
Comparing semantic version strings in POSIX shell

Overview

The attached script provides a function for comparing semantic versions in a POSIX shell script.

Result Description
-1 A<B
0 A=B
1 A>B

Usage

@akutz
akutz / README.md
Created January 25, 2019 20:40
Comparing Kubernetes versions in shell script

The attached script provides a function for comparing Kubernetes versions in shell script. It's possible for the script to validate itself by invoking it with TEST_SEMVER_COMP=1:

$ TEST_SEMVER_COMP=1 semver.sh 
              a               b   exp   act
           v1.0            v1.0     0     0
          v10.0            v1.0     1     1
           v1.0           v10.0   255   255
 v1.14 v1.14.alpha1 1 1
@akutz
akutz / apcake.md
Created December 29, 2018 18:11
AP Cake

AP Cakes

Makes three, seven inch pies

Ingredients

  • 4 cups of flour
  • 2 cups of light, brown sugar
  • 3/4 cup of butter-flavored crisco
  • Scant 3/4 cup of 1% milk
  • A couple of drops of cider vinegar
  • 1 teaspoon of baking soda
@akutz
akutz / README.md
Last active October 31, 2018 21:54
A POSIX-compliant means of manipulating a shell's arguments

The script posix-args.sh provides two POSIX-compliant functions for getting the last argument in an array as well as getting all but the last argument. The following example illustrates how to use the functions and the expected results:

t="$(mktemp)" && \
curl -o "${t}" -sSL \
http://bit.ly/posix-args && \
. "${t}" && rm -f "${t}"         # load the two functions from "posix-args.sh"

set -- one two three four        # set the shell's arguments value
echo "there are ${#} args"       # prints "there are 4 args"
@akutz
akutz / README.md
Last active October 15, 2018 16:05
rpctool

rpctool

The program rpctool allows users on VMs running on vSphere to manipulate the VM's GuestInfo and OVF environment data.

root@photon-machine [ ~ ]# /var/lib/yakity/rpctool
COMMAND is required
usage: /var/lib/yakity/rpctool [FLAGS] COMMAND [ARGS]
COMMANDS
  get KEY
    	Gets the value for the specified guestinfo key
@akutz
akutz / README.md
Last active September 26, 2018 23:31
/var/lib/kubernetes/e2e/platforms/linux/amd64/e2e.test \
  -ginkgo.focus "should test kubelet managed /etc/hosts file  \\[Conformance\\]" \
  -ginkgo.skip "Alpha|Kubectl|\\[(Disruptive|Feature:[^\\]]+|Flaky)\\]" \
  -disable-log-dump \
  -provider "skeleton" \
  -report-dir "/var/log/kubernetes/e2e" \
  -v 10 2>&1 | tee /var/log/kubernetes/e2e/e2e.log || true
TF_VAR_run_conformance_tests=false
AWS_LOAD_BALANCER=false
@akutz
akutz / config.env
Last active September 22, 2018 23:45
TF_VAR_run_conformance_tests=false
AWS_LOAD_BALANCER=false
TF_VAR_run_conformance_tests=false
AWS_LOAD_BALANCER=false
TF_VAR_run_conformance_tests=false
AWS_LOAD_BALANCER=false