Skip to content

Instantly share code, notes, and snippets.

@j-thepac
Last active August 23, 2024 03:01
Show Gist options
  • Save j-thepac/31afe224ea62ffc55274d46be7168d1b to your computer and use it in GitHub Desktop.
Save j-thepac/31afe224ea62ffc55274d46be7168d1b to your computer and use it in GitHub Desktop.

System

  • Sop (std operation procedure)
  • Rca (root cause analysis)
  • Modular
  • Scalable
  • Scheme agnostic (No SqL) : No Schema
  • Model
  • Decouple
  • Infrastructure
  • Containerised
  • Abstract
  • Monolith
  • Flexible
  • Coupling
  • Cohersion : Related to each other Eg:Car and Wheels
  • Highly available
  • Serveless
  • Test Driven
  • Event Driven
  • Domain Driven
  • Message Bus
  • Adapter

Code

  • Strictly Type Code
  • Dataclass
  • Unique identifier
  • Value object pattern
  • Type parameter
  • Provision
  • Disguising the intent and source
  • class memebers
  • boilerplate
  • Time Complexity and Space Complexity
  • race condition

OOPS

  • ABstraction : Calling class need not no the inner workings of called class
  • polymorphism (Bird b = new Pigeon();)
  • Encapsulation : private , protected
  • Inheritance :

REST

  • API based
  • backend
  • Endpoint
  • Interface
  • Loosely coupled : Modifying one does not impact other
  • Oltp (fast write, 3nf), olap( fast read, dimension model ie., Star scheme)
  • webhook : external services to be notified when certain events happen

others

  • increamental
  • Edge conditions
  • Min viable prod
  • Dependency inversion(dip) high level mod don't depend on low lvl
  • Orm
  • Dependency
  • Infrastructure
  • Pipeline
  • Build
  • Deployment
  • Delegate
  • Annotations
  • Defensive code (inside if / try catch)
  • promise
  • compliance Issue
  • Propose
  • System Designs
  • mern stack(mongo, express,react,node)
  • Npm - node package manager
  • Node js is a compiler for processing javascript outside browsers.
  • intermittent
  • reproducible

Authoization

-https://github.com/j-thepac/Authorization

Trunk Based Development vs Gitflow Based

  • Trunck Based : User creates a development branch and merges to Main/Master
  • Git Flow: Has Feature branch, HotFix branch , Version Branches ,

Git Rebase vs Git merge vs Squash Merge vs Cherry Pick [Merge Strategies]

  • Git merge : Creates 1 new commit containing new changes from Feature Branch

  • Git Rebase: New commits from Feature Branch on top of Main branch

  • git squash: Remove unwanted commits before final merge git rebase -i HEAD~5 #Change pick to squash

  • cherry-pick: To use intermitten commit of 1 branch into another

      	git log branch --oneline #copy the hash
      	git cheery-pick hash1 hash2
    

Fast Validations [all storages , Env ]

Design Components

๐Ÿฌ. ๐—Ÿ๐—ผ๐—ฎ๐—ฑ ๐—•๐—ฎ๐—น๐—ฎ๐—ป๐—ฐ๐—ฒ๐—ฟ: A load balancer efficiently distributes incoming network traffic across multiple servers to ensure no single server bears too much load.

๐Ÿญ. ๐—”๐—ฃ๐—œ ๐—š๐—ฎ๐˜๐—ฒ๐˜„๐—ฎ๐˜†: An API Gateway acts as a single entry point for all client requests, providing a unified interface to various microservices.

๐Ÿฎ. ๐—–๐—ฎ๐—ฐ๐—ต๐—ฒ: Caching stores recently accessed data for speedy retrieval, reducing the load on databases and improving response times.

๐Ÿฏ. ๐—–๐——๐—ก: A Content Delivery Network (CDN) stores static content closer to users to minimize latency and speed up content delivery.

๐Ÿฐ. ๐——๐—ถ๐˜€๐˜๐—ฟ๐—ถ๐—ฏ๐˜‚๐˜๐—ฒ๐—ฑ ๐—™๐—ถ๐—น๐—ฒ ๐—ฆ๐˜๐—ผ๐—ฟ๐—ฎ๐—ด๐—ฒ: Distributed file storage ensures data is redundantly stored across multiple locations for fault tolerance and easy access.

๐Ÿฑ. ๐—ฆ๐—ฒ๐—ฎ๐—ฟ๐—ฐ๐—ต ๐—œ๐—ป๐—ฑ๐—ฒ๐˜…: Using a search index like Elasticsearch allows for scalable and fast search capabilities across large datasets.

๐Ÿฒ. ๐—ก๐—ผ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ฆ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฐ๐—ฒ: A notification service handles the delivery of messages or alerts to users across different platforms and devices.

๐Ÿณ. ๐——๐—ฎ๐˜๐—ฎ ๐—ฃ๐—ฟ๐—ผ๐—ฐ๐—ฒ๐˜€๐˜€๐—ถ๐—ป๐—ด ๐—ฆ๐˜†๐˜€๐˜๐—ฒ๐—บ๐˜€: Data processing systems like Hadoop and Spark analyze large volumes of data, enabling scalable and complex computational operations.

๐Ÿด. ๐——๐—ถ๐˜€๐˜๐—ฟ๐—ถ๐—ฏ๐˜‚๐˜๐—ฒ๐—ฑ ๐—ฆ๐—ฐ๐—ต๐—ฒ๐—ฑ๐˜‚๐—น๐—ฒ๐—ฟ: A distributed scheduler orchestrates and manages the execution of distributed tasks across various computing resources.

๐Ÿต. ๐— ๐—ฒ๐˜๐—ฎ๐—ฑ๐—ฎ๐˜๐—ฎ ๐—ฆ๐—ฒ๐—ฟ๐˜ƒ๐—ฒ๐—ฟ: The metadata server stores information about the structure of data, enabling efficient access and management.

๐Ÿญ๐Ÿฌ. ๐—•๐—น๐—ผ๐—ฐ๐—ธ ๐—ฆ๐—ฒ๐—ฟ๐˜ƒ๐—ฒ๐—ฟ: Block servers manage the storage blocks in distributed file systems, which helps in data replication and retrieval.

๐Ÿญ๐Ÿญ. ๐——๐—ถ๐˜€๐˜๐—ฟ๐—ถ๐—ฏ๐˜‚๐˜๐—ฒ๐—ฑ ๐—Ÿ๐—ผ๐—ด๐—ด๐—ถ๐—ป๐—ด: Distributed logging collects logs from various services in a centralized manner for monitoring and troubleshooting.

๐Ÿญ๐Ÿฎ. ๐—ฅ๐—ฒ๐—ฝ๐—น๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ฎ๐—ป๐—ฑ ๐—ฃ๐—ฎ๐—ฟ๐˜๐—ถ๐˜๐—ถ๐—ผ๐—ป๐—ถ๐—ป๐—ด: Replication ensures data availability and durability, while partitioning helps in scaling databases by distributing data across different nodes.

  1. Sharding When data is ingested into dedicated SQL pool, the data is sharded into distributions to optimize the performance . Types:Hash, Round Robin , Replicate

  2. UML Class Diagram UML Diagram drawio

  3. **ERD (Entity RelationShip Diagram ) ** - used in Databases / Warehouses

Algorithms

If asked for all permutations/subsets :

  • Backtracking
  • Subset Pattern
def fn( s: str) -> int: #s=123
    r=[""]
    for i in s:
        for j in r:
            r=r+[i+j]
    print(r) 	#['', '1', '2', '21', '3', '31', '32', '321']

If asked to find part of String,Array,LinkedList

  • 2 pointers (sliding Window) Eg: 3. Longest Substring Without Repeating Characters ,167: Two Sum, 15: 3SUM
def fn(s: str) -> int:
    t1,t2,mx=0,1,0
    while t2<len(s)+1:
        temp=s[t1:t2]
        if(len(set(temp)) == len(temp)):  mx=max(len(temp),mx)
        else:t1+=1
        t2+=1
    return mx

If asked to Search in sorted /Linked List

  • Binary search
    • Eg:Bisect Left, Bisect Right implementation
    • Eg: 33.Search in Rotated Sorted Array

If given a tree/Grapth (recursion):

  • DFS (use PreOrder,PosOrder):104. Max dept of Binary Tree
  • BFS(use Queue): 102. Level order Traversal

If must solve in-place :

  • Swap corresponding values
  • Store one or more different values in the same pointer

If asked for maximum/minimum subarray/subset/options :

  • Dynamic programming (memoization)
  • Greedy

If asked for top/least K items :

  • Top K(Heap)

If Dependency Exists (input is DAG):

  • Topological Pattern: 207 Course Schedule

Greedy Brute Force

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment