Skip to content

Instantly share code, notes, and snippets.

View robertscherbarth's full-sized avatar

Robert Scherbarth robertscherbarth

View GitHub Profile
@robertscherbarth
robertscherbarth / middleware.go
Last active October 3, 2023 13:37
example middleware to measure request durations
package api
import (
"net/http"
"strconv"
"time"
"github.com/prometheus/client_golang/prometheus"
)

Install and configure service-catalog

Install [Helm][helm] into your Kubernetes cluster, and configure it to be able to find service-catalog:

helm init
helm repo add svc-cat https://svc-catalog-charts.storage.googleapis.com
@robertscherbarth
robertscherbarth / 1_kubernetes_on_macOS.md
Created August 2, 2018 07:52 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@robertscherbarth
robertscherbarth / main.go
Created July 25, 2018 08:20
Higher Order functions in golang
package main
import (
"fmt"
)
func getIncrementer() func() int {
i := -1
return func() int {
i = i + 1
@robertscherbarth
robertscherbarth / example.go
Created July 20, 2018 08:58
Wrapper function for Go
package main
import (
"fmt"
"reflect"
)
// This is an example of an Function that takes a function an various parameters.
func callMe(fn interface{}, params ...interface{}) (result []reflect.Value) {
@robertscherbarth
robertscherbarth / launch.json
Created March 7, 2018 10:03
vscode launch.json to run mocha test
{
"version": "0.2.0",
"configurations": [
{
"name": "Run mocha",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": ["--recursive", "test"],
@robertscherbarth
robertscherbarth / standard-deviation.js
Created April 10, 2017 18:16
Standard deviation order example
/* Standard Deviation */
const orders = [3, 5, 3, 8, 5, 25, 8, 4]
const arrayAverage = arr => arr.reduce((sum, x) => x + sum, 0) / orders.length
const sumOrders = orders.reduce((sum, x) => x + sum, 0)
const averageOrders = arrayAverage(orders)
console.log(averageOrders)