Skip to content

Instantly share code, notes, and snippets.

View halvards's full-sized avatar

Halvard Skogsrud halvards

View GitHub Profile
@halvards
halvards / rxalb-and-ilb.md
Last active March 26, 2024 23:42
GCP Application Load Balancer and Network Load Balancer from one Kubernetes Service
@halvards
halvards / build_and_run.sh
Last active September 26, 2022 10:43
devmode scripts for Go from Google Cloud Buildpacks, in /layers/google.go.build/devmode_scripts/bin/
#!/bin/sh
go build -o /layers/google.go.build/bin/main ./. && /layers/google.go.build/bin/main
@halvards
halvards / krm-fns.yaml
Created February 21, 2022 12:14
Example of using Kustomize with Helm and Digester
apiVersion: example.com/v1
kind: DigesterFunction
metadata:
name: digester
annotations:
config.kubernetes.io/function: |
exec:
path: ./digester
@halvards
halvards / run.sh
Last active October 29, 2021 10:29
Use the Docker CLI client with Minikube and HyperKit on macOS
# Docker Desktop not required
brew install docker hyperkit minikube
minikube start --driver=hyperkit
# or persistent: minikube config set driver hyperkit
eval $(minikube docker-env)
# docker build/run away
@halvards
halvards / ingress-nginx-standalone-neg.sh
Last active July 12, 2022 07:04
NGINX Ingress Controller with Standalone Network Endpoint Group (NEG)
#!/usr/bin/env bash
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@halvards
halvards / envoy-local.yaml
Created December 20, 2019 12:18
Static Envoy configuration for reverse proxy from localhost:80 to localhost:8080
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@halvards
halvards / knative-serving-kind.sh
Last active January 3, 2020 07:52
Create a kind K8s cluster with Knative Serving for development purposes
#!/usr/bin/env bash
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@halvards
halvards / README.md
Last active August 3, 2018 03:20
Sample request validation WSGI middleware

WSGI middleware can be used to validate incoming requests for APIs implemented in Python.

See middleware.py below for an example that validates the presence of a content key in the JSON body of an incoming HTTP POST request.

appengine_config.py shows how to add this middleware to an application running in Google App Engine Python Standard Environment.

@halvards
halvards / knative-minikube.md
Last active September 14, 2021 09:47
Knative using Minikube on macOS
@halvards
halvards / PairPermutations.java
Created April 17, 2018 01:06
Generate all pairs of elements in an iterator, excluding matching pairs
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
public class PairPermutations {
public static void main(String[] args) {
Iterator<String> itemsIterator = Arrays.asList("1", "2", "3").iterator();