Skip to content

Instantly share code, notes, and snippets.

@simbo1905
simbo1905 / rhel8-imagechecker.sh
Created December 27, 2019 21:11
script to compare local openshfit registry tags against upstream redhat image catalogue at registry.redhat.com
#!/bin/bash
set -Eeuo pipefail
oc() {
if ! bin/oc_wrapper.sh "$@"; then
>&2 echo "ERROR oc wrapper returned none zero status"
fi
}
IMAGE_STREAM="$1"
@simbo1905
simbo1905 / nom_audit.log
Created December 24, 2019 17:01
output of `npm audit` on botkit-starter-slack as at 2019-12-24
This file has been truncated, but you can view the full file.
 
  === npm audit security report ===  
 
# Run npm install express-hbs@2.3.0 to resolve 6 vulnerabilities
SEMVER WARNING: Recommended action is a potentially breaking change
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Critical │ Prototype Pollution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ handlebars │
├───────────────┼──────────────────────────────────────────────────────────────┤
@simbo1905
simbo1905 / BlockingJournal.java
Last active November 5, 2019 12:44
out of order processing of a Flux of input using Reactor 0.9.1.RELEASE
import reactor.core.publisher.Mono;
public class BlockingJournal {
private static String blockingWrite(String in){
try {
// fakes blocking for disk write
Thread.sleep(5L);
System.out.println("journal wrote: "+in+" on "+Thread.currentThread().getName());
@simbo1905
simbo1905 / TrexTcpServer.java
Created November 3, 2019 22:10
how to write an echo server with reactor-netty 0.9.1.RELEASE
package demo;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.CharsetUtil;
import reactor.netty.DisposableServer;
import reactor.netty.tcp.TcpServer;
public class TrexTcpServer {
@simbo1905
simbo1905 / helmfile.yaml
Last active September 3, 2019 21:10
cod-builder-demo
repositories:
- name: ocd-meta
url: https://ocd-scm.github.io/ocd-meta/charts
releases:
- name: {{ requiredEnv "ENV_PREFIX" }}-realworld
labels:
builder: realworld
chart: ocd-meta/ocd-builder
version: "1.0.0"
values:
@simbo1905
simbo1905 / initContainerWriteEmptyDir.sh
Created September 2, 2019 14:55
use an initContainer to write configuration into an empty ephemeral folder
#!/bin/bash
cat | oc create -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: my-app
spec:
containers:
- name: realworld
image: docker.io/simonmassey/react-redux-realworld:v0.0.2
@simbo1905
simbo1905 / initContainerPvcWrite.sh
Created September 2, 2019 14:49
write out a config file to a PVCs wihin an initContainer
#!/bin/bash
cat | oc create -f - <<EOF
---
apiVersion: "v1"
kind: "PersistentVolumeClaim"
metadata:
name: "config-data-claim"
spec:
accessModes:
- "ReadWriteMany"
@simbo1905
simbo1905 / HowTo.md
Created April 27, 2019 22:41
debug git-secret using bashdb and visual studio code

How To

Install bashdb which you can do from source or get from a package manager. On MacOS you can brew install bashdb.

Install Visual Studio Code and the Bash Debug plugin from the marketplace. See this blog article yet I didn't have to do any upgrades of build from source things worked pretty much out of the box after installing bashdb via Homebrew.

Use the debug.sh script in this gist as the entrypoint to be able to step through code.

@simbo1905
simbo1905 / helmfile-macos.sh
Created April 22, 2019 05:29
installl helmfile on macOS
#!/bin/sh
# Helmfile on MacOS
brew install helm
helm plugin install https://github.com/databus23/helm-diff
helm plugin install https://github.com/futuresimple/helm-secrets
brew install helmfile
brew install gnu-getopt
@simbo1905
simbo1905 / ocd-pre-apply-hook
Created April 12, 2019 19:52
md5 hash secrets to detect when to bounce apps
#!/bin/bash
oc get secrets | md5sum > /tmp/secrets.md5