- What do Etcd, Consul, and Zookeeper do?
- Service Registration:
- Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
- Service Discovery:
- Ability for client application to query the central registry to learn of service location.
- Consistent and durable general-purpose K/V store across distributed system.
- Some solutions support this better than others.
- Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
- Service Registration:
- Centralized locking can be based on this K/V store.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function drawCurve(points, tension) { | |
var ctx = layer.getContext()._context; | |
ctx.beginPath(); | |
ctx.moveTo(points[0].x, points[0].y); | |
var t = (tension != null) ? tension : 1; | |
for (var i = 0; i < points.length - 1; i++) { | |
var p0 = (i > 0) ? points[i - 1] : points[0]; | |
var p1 = points[i]; | |
var p2 = points[i + 1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --author="navono" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.11 AS builder | |
# Download and install the latest release of dep | |
ADD https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 /usr/bin/dep | |
RUN chmod +x /usr/bin/dep | |
# Copy the code from the host and compile it | |
WORKDIR $GOPATH/src/github.com/username/repo | |
COPY Gopkg.toml Gopkg.lock ./ | |
RUN dep ensure --vendor-only |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function describeArc(x, y, radius, startAngle, endAngle) { | |
var start = polarToCartesian(x, y, radius, endAngle); | |
var end = polarToCartesian(x, y, radius, startAngle); | |
console.log('start: ', start); | |
console.log('end: ', end); | |
var largeArcFlag = Math.abs(endAngle - startAngle) <= 180 ? "0" : "1"; | |
const clockwise = endAngle < 0 ? 1 : 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Installing VirtualBox | |
echo "Installing VirtualBox........................" | |
sudo apt-get install virtualbox | |
#Installing kubectl https://kubernetes.io/docs/getting-started-guides/kubectl/ | |
echo "Installing kubectl..........................." | |
wget https://storage.googleapis.com/kubernetes-release/release/v1.4.4/bin/linux/amd64/kubectl | |
chmod +x kubectl | |
sudo mv kubectl /usr/local/bin/kubectl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'react-resizable' { | |
import * as React from 'react'; | |
type Axis = 'both' | 'x' | 'y' | 'none'; | |
type ResizeCallbackData = { | |
node: HTMLElement, | |
size: {width: number, height: number} | |
}; | |
interface IResizableProps { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function (require) { | |
// come from https://github.com/konvajs/konva/blob/3cfb57681201271b1d71eea8416557d0e5ace8ac/src/shapes/Path.js | |
function getLineLength(x1, y1, x2, y2) { | |
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); | |
}; | |
function getPointOnCubicBezier( | |
pct, | |
P1x, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Read file "package.json" into variable string, removing line breaks. | |
set string= | |
for /f "delims=" %%x in (package.json) do set "string=!string!%%x" | |
rem Remove quotes | |
set string=%string:"=% | |
rem Remove braces | |
set "string=%string:~2,-2%" | |
rem Change colon+space by equal-sign | |
set "string=%string:: ==%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure you grab the latest version | |
curl -OL https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip | |
# Unzip | |
unzip protoc-3.6.1-linux-x86_64.zip -d protoc3 | |
# Move protoc to /usr/local/bin/ | |
sudo mv protoc3/bin/* /usr/local/bin/ | |
# Move protoc3/include to /usr/local/include/ |
OlderNewer