Skip to content

Instantly share code, notes, and snippets.

View satyajitnayk's full-sized avatar
🏠
Working from home

satyajit satyajitnayk

🏠
Working from home
View GitHub Profile
@satyajitnayk
satyajitnayk / keepAliveTimeout.MD
Created September 13, 2024 08:45
keepAlikeepAliveTimeout

The keepAliveTimeout in a NestJS application (or any Node.js application) is a crucial configuration setting that controls how long an idle connection is kept open before it is closed. Understanding keepAliveTimeout and its implications can help you configure your server for better performance and stability, especially when dealing with long-running requests or integrations with load balancers.

1. What is keepAliveTimeout?

  • Definition: The keepAliveTimeout is a setting on the HTTP server that specifies how long to keep an idle connection open before closing it.
  • Idle Connection: An idle connection is one where no data is being transferred between the client and the server after the initial request has been fulfilled.

2. How Does keepAliveTimeout Work?

  • Persistent Connections: HTTP/1.1 introduced the concept of persistent connections (or keep-alive connections), where a single TCP connection can be reused for multiple HTTP requests/responses between a client and ser
@satyajitnayk
satyajitnayk / nodejs practical question.md
Created June 22, 2024 15:11
nodejs practical question
const images = [
  { id: 1, url: 'XYZ' },
  { id: 2, url: 'DJJD' },
  { id: 3, url: 'JJEEJ' },
  { id: 4, url: 'EOOI' },
];

const reviews = [
  { id: 1, productId: 1, customerId: 1, images: [1, 2] },
@satyajitnayk
satyajitnayk / usages_of_context_in_golang.md
Created January 28, 2024 05:29
usages of context in golang

Context in Golang

Introduction

In Golang, the Context package provides a way to propagate deadlines, cancelation signals, and other request-scoped values across API boundaries and between goroutines. It's a powerful tool for managing concurrency and ensuring that operations are completed within a certain context.

Why Use Context?

1. Propagating Deadlines and Cancellation Signals

@satyajitnayk
satyajitnayk / status_codes.md
Last active December 27, 2023 13:35
List of HTTP Status Codes and Descriptions
@satyajitnayk
satyajitnayk / run_kafka_using_docker.MD
Last active December 23, 2023 13:21
Run Kafka using Docker

Create a file with name docker-compose.yml

version: "3.7"
services:
  zookeeper:
    restart: always
    image: docker.io/bitnami/zookeeper:3.8
    ports:
      - "2181:2181"
    volumes:
@satyajitnayk
satyajitnayk / docker_vs_virtualmachine.MD
Created December 22, 2023 12:27
Docker vs Virtual Machines (VMs)

Docker vs Virtual Machines (VMs)

Introduction

  • Overview of Docker and Virtual Machines (VMs).
  • Agenda: Definitions, how they function, and guidance on workload suitability.

Common Themes

  • Both Docker and VMs address the concept of virtualization.

Virtualization

@satyajitnayk
satyajitnayk / vm_vs_container.MD
Created December 22, 2023 12:18
Virtual Machines vs. Containers

Virtual Machines vs. Containers

Virtualization Level

Virtual Machines (VMs)

  • Utilize hardware virtualization.
  • Rely on a hypervisor to virtualize physical hardware resources (processors, RAM, storage, network cards).

Containers

  • Use operating system-level virtualization.
  • Built upon the host OS's kernel, allowing multiple containers to run on a single OS instance.
@satyajitnayk
satyajitnayk / handlebar_ast_back_to_template.MD
Last active December 22, 2023 12:31
Converts Handlebars Abstract Syntax Tree (AST) back to template string

Handlebars AST to Template String using hbs-ast-to-str

This Gist introduces the hbs-ast-to-str package, which provides a solution for converting Handlebars Abstract Syntax Trees (AST) into template strings.

hbs-ast-to-str

Installation

You can install the package using npm or yarn: