Skip to content

Instantly share code, notes, and snippets.

View jkeam's full-sized avatar
🍻

Jon Keam jkeam

🍻
View GitHub Profile
@jkeam
jkeam / install-ruby.sh
Created September 2, 2019 01:38
Ruby Install
# install gc
brew install jemalloc
# check for openssl installation location
brew list openssl
# install ruby
ruby-install ruby 2.6.4 -- --with-jemalloc --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s
# check for jemalloc
@jkeam
jkeam / mac_openjdk.sh
Created June 18, 2020 13:51
This is how I installed OpenJDK on my Mac.
#!/bin/bash
brew tap AdoptOpenJDK/openjdk
# can install adoptopenjdk8 or adoptopenjdk11
brew cask install adoptopenjdk8
# list all installed
# /usr/libexec/java_home -V
# switch java version, use 1.8, or 11
@jkeam
jkeam / install-java.md
Created July 12, 2020 04:53
Instructions on how to install and manage Java in Ubuntu 20

Java Installation and Management in Ubuntu 20

Installation

sudo apt-get install openjdk-8-jdk

# don't worry, you can apt-get multiple java versions
sudo apt-get install openjdk-11-jdk
#sudo apt-get install openjdk-...  <tab complete to see all available versions>
@jkeam
jkeam / mac_graalvm.sh
Last active July 13, 2020 18:15
Install GraalVM on a Mac
#!/bin/bash
# install
brew cask install graalvm/tap/graalvm-ce-java11
# update
# brew cask upgrade graalvm/tap/graalvm-ce-java11
# update JAVA_HOME
export JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home
@jkeam
jkeam / find_reports_dir.py
Last active August 12, 2020 00:22
Pom Reports Directory
import xml.etree.ElementTree as ET
import re
def find_reports_dir(pom_file):
""" Return the report directory specified in the pom """
# extract and set namespace
root = ET.parse(pom_file).getroot()
m = re.findall(r'{(.*?)}', root.tag)
namespace = m[0] if m else ''
ns = {'maven': namespace}
@jkeam
jkeam / curl_upload_signature.py
Last active September 30, 2020 17:55
Brain dump of a rough outline of the step to upload signatures via curl.
"""StepImplementer for the upload-container-image step using curl.
TODO: doc me
Mandatory Inputs:
1.
# entire file path of where the signature is
#includes temporary directory where signature is located
'container-image-signature-file-path'
@jkeam
jkeam / openshift_enforce_image_signature.md
Last active November 30, 2020 18:07
OpenShift Enforce Image Signature

Signing Validation

Assumptions

  1. Valid image in some registry, say something like docker.io:/jonnyman9/hello-node:latest
  2. Valid signature being served by some signature server, say something like https://sigserver.com
  3. You have access to the public PGP key used to sign the image, say something like pubring.gpg

Steps

There really only is 1 important file we need, the machine-config.yaml that forces the host to verify the image against some signature when pulling it in. This one file however is made up of 3 smaller components:

@jkeam
jkeam / nodejs-sample-pipeline.yml
Created November 29, 2020 19:39
OpenShift 101 Workshop - Jenkins Node Pipeline BuildConfig
kind: "BuildConfig"
apiVersion: "build.openshift.io/v1"
metadata:
name: "nodejs-sample-pipeline"
spec:
strategy:
jenkinsPipelineStrategy:
jenkinsfile: |-
// path of the template to use
def templatePath = 'nodejs-mongodb-example'
@jkeam
jkeam / install_stackrox_on_ocp4.md
Last active August 24, 2021 19:53
Installing StackRox on OCP 4.x

Installing StackRox on OCP 4.x

Prerequisites

There are a few env variables you need to set first. Also assuming you have oc installed and you are logged in as a cluster admin. This has been tested on OCP v4.5.36 and StackRox v3.0.58.0.

export YOUR_STACKROX_USERNAME=test@example.com
export YOUR_STACKROX_PASSWORD=whateverYourPasswordIs
export STACKROX_PASSWORD=Pa22word  # used to log into your deployed stackrox instance. user is `admin` and password is this
@jkeam
jkeam / url.sh
Created April 22, 2021 15:37
Open URL from the command line for MacOSX
#!/bin/bash
# Taken from: https://superuser.com/questions/153245/how-can-i-open-google-chrome-via-command-line-with-a-url-in-incognito-mode
url() {
url=$([[ $1 =~ ^[a-zA-Z]{1,}: ]] && printf '%s\n' "$1" || printf '%s\n' "http://$1")
open -a 'Google Chrome' "$url"
}