From Stack Overflow.
# Fetch the submodule commits into the main repository
git remote add submodule_origin git://url/to/submodule/origin
git fetch submodule_origin
# Start a fake merge (won't change any files, won't commit anything)
git merge -s ours --no-commit submodule_origin/master
const calculate = (n, k) => { | |
const exponent = (-k * (k - 1)) / (2 * n) | |
return 1 - Math.E ** exponent | |
} | |
// where `n` is the number of possible unique hashes | |
// where `k` is the number of values created | |
// calculate(100000, 25) => 0.0029955044966269995 aka 0.29% chance of collision |
func ComputeHmac256(message string, secret string) string { | |
key := []byte(secret) | |
h := hmac.New(sha256.New, key) | |
h.Write([]byte(message)) | |
return base64.StdEncoding.EncodeToString(h.Sum(nil)) | |
} |
// Grammar for parsing of the Fabric Endorsment Policies | |
// | |
// Defined in the documentation at | |
// https://hyperledger-fabric.readthedocs.io/en/latest/endorsement-policies.html#endorsement-policy-syntax | |
// The expression will be an operator with arguments, each of the arguments can be an expression | |
// The OutOf operator is a bit different as that demands the first agument be a number | |
Expression | |
= op:Operator '(' _ args:Some_Expression_Args _ ')' | |
{ |
#!/usr/bin/env sh | |
HOST_PATH=$(pwd) | |
GUEST_PATH=/usr/app | |
HOST_EXPORT="${HOST_PATH} -network 192.168.99.0 -mask 255.255.255.0 -alldirs -maproot=root:wheel" | |
if ! grep -q "$HOST_EXPORT" /etc/exports; then | |
echo $HOST_EXPORT | sudo tee -a /etc/exports | |
sudo nfsd restart | |
fi |
Ramp up your Kubernetes development, CI-tooling or testing workflow by running multiple Kubernetes clusters on Ubuntu Linux with KVM and minikube.
In this tutorial we will combine the popular minikube
tool with Linux's Kernel-based Virtual Machine (KVM) support. It is a great way to re-purpose an old machine that you found on eBay or have gathering gust under your desk. An Intel NUC would also make a great host for this tutorial if you want to buy some new hardware. Another popular angle is to use a bare metal host in the cloud and I've provided some details on that below.
We'll set up all the tooling so that you can build one or many single-node Kubernetes clusters and then deploy applications to them such as OpenFaaS using familiar tooling like helm. I'll then show you how to access the Kubernetes clusters from a remote machine such as your laptop.
- This tutorial uses Ubuntu 16.04 as a base installation, but other distributions are supported by KVM. You'll need to find out how to install
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: kube-registry-v0 | |
namespace: kube-system | |
labels: | |
k8s-app: kube-registry | |
version: v0 | |
spec: | |
replicas: 1 |