Skip to content

Instantly share code, notes, and snippets.

@protzi
protzi / eks_best_practice.md
Created November 26, 2023 13:44 — forked from ejlp12/eks_best_practice.md
EKS Best Practice

Please check https://aws.github.io/aws-eks-best-practices/ for more comprehensive EKS best practice!

Architecture

  • Think about multi-tenancy, isolation for different environment or different workload
    • Isolation at account level using AWS organization
    • Isolation at the network layer ie. different VPC & different cluster
    • Use different Nodes Group (Node pool) for different purpose/category e.g. create dedicated node groups for Operational tools such as CI/CD tool, Monitoring tool, Centralize logging system.
    • Separate namespace for different workload

Reliability | Principles

@protzi
protzi / common.js
Last active June 9, 2022 09:44
common functions
const isNil = val => val == null
const isString = val => typeof val === 'string' || val.constructor === String
const isNumber = val => !isNaN(parseFloat(val)) && isFinite(val)
const isPlainObject = val => val && val.constructor.name === 'Object'
const isObject = val => val && Object.prototype.toString.call(val) === '[object Object]'
const isFunction = fn => typeof fn === 'function'
const isClass = fn => isFunction(fn) && /^\s*class\s+/.test(fn.toString())
const isPromise = fn => fn.then && isFunction(fn.then)
const sleep = ms => new Promise(resolve => setTimeout(() => resolve(), ms))
@protzi
protzi / difference.js
Created September 30, 2018 11:51 — forked from Yimiprod/difference.js
Deep diff between two object, using lodash
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
@protzi
protzi / days.js
Created October 7, 2016 04:09
get days in month
function f(x) { return 28 + (x + Math.floor(x/8)) % 2 + 2 % x + 2 * Math.floor(1/x); }
@protzi
protzi / nonNumerical.js
Last active July 13, 2023 07:18
Remove all non-alphanumeric characters (punctuation, spaces and symbols)
function removeNonNumerical(str) {
return str.replace(/[\W_]/gi, '').toLowerCase();
}