Skip to content

Instantly share code, notes, and snippets.

View tpai's full-sized avatar
🌴
On vacation in Spain

Tony Pai tpai

🌴
On vacation in Spain
View GitHub Profile
  • 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.
  • Centralized locking can be based on this K/V store.
@tpai
tpai / auto-scaling.md
Last active February 24, 2021 14:38
cheatsheet for aws ecs

Auto Scaling Launch Config

  • Amazon ECS Optimized AMI: ami-b4ae1dd7
  • Instance Type: t2.small

Config Details

  • Name: [CONFIG_NAME]
  • IAM role: fever_ecs
  • User data: As text
@vitorleal
vitorleal / ssh-tunnel.txt
Created November 8, 2016 13:32
SSH Tunnel
ssh -f {USERNAME}@{IP.OF.THE.MACHINE.TO.TUNNEL} -L {MAPPED_PORT}:{AWS.DB.ADDRESS}:{DB_PORT} -N
anonymous
anonymous / index.html
Created September 19, 2016 02:08
JS Bin // source http://jsbin.com/bidemaxide
<!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;
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;
@tomysmile
tomysmile / mac-php-composer-setup.md
Created July 11, 2016 10:45
Setup PHP Composer using Brew
@pahud
pahud / aws-get-credentials.js
Last active November 21, 2022 16:51
AWS CredentialProviderChain example in aws-sdk of NodeJS
'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 = [
class Parent {
constructor(name) {
this.name = name;
}
greet() {
console.log(`Hi, I'm ${this.name}`);
}
}
var mom = new Parent("Mom");
@wgottschalk
wgottschalk / newKeywordFunction.js
Created January 14, 2016 19:18
An implementation of the new Keyword in Javascript
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() {