- 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
ssh -f {USERNAME}@{IP.OF.THE.MACHINE.TO.TUNNEL} -L {MAPPED_PORT}:{AWS.DB.ADDRESS}:{DB_PORT} -N |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.mask { | |
width: 300px; | |
height: 300px; |
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
server { | |
listen 80; | |
server_name example.com; | |
root /var/www/example.com/public/; | |
ssl_protocols TLSv1.2; | |
index index.html index.htm index.php; | |
charset utf-8; |
Firstly install Brew on your MAC
- ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then install PHP
- brew update
- brew tap homebrew/dupes
- brew tap homebrew/php
- brew install php56
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
'use strict'; | |
var AWS = require('aws-sdk'); | |
//var P = require('bluebird'); | |
var aws_region = process.env['AWS_REGION'] ? process.env['AWS_REGION'] : 'us-west-2' | |
var aws_profile = process.env['AWS_PROFILE'] ? process.env['AWS_PROFILE'] : 'default' | |
AWS.CredentialProviderChain.defaultProviders = [ |
樣板小抄
- README.md https://gist.github.com/PurpleBooth/109311bb0361f32d87a2
- Licenses http://choosealicense.com/licenses/
- Awesome Cheatsheet https://github.com/detailyang/awesome-cheatsheet
- Devhints - Cheatsheet collection https://devhints.io/
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
class Parent { | |
constructor(name) { | |
this.name = name; | |
} | |
greet() { | |
console.log(`Hi, I'm ${this.name}`); | |
} | |
} | |
var mom = new Parent("Mom"); |
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 NEW(constructor, argsArray) { | |
var obj = {}; // step 1 | |
obj.__proto__ = constructor.prototype; // step 2 | |
constructor.apply(obj, argsArray); // step 3 | |
return obj; // step 4 | |
} | |
function Parent(name) { | |
this.name = name; | |
} | |
Parent.prototype.greet = function() { |