Skip to content

Instantly share code, notes, and snippets.

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

pradeep singh pradeep1991singh

🏠
Working from home
View GitHub Profile
@pradeep1991singh
pradeep1991singh / operational-dashboard.md
Created March 14, 2024 21:04
operational-dashboard.md

I would recommend the following operational dashboards and metrics for a product built with a mono/microservice architecture:

  • Service Health Dashboard: This dashboard would display the health status of each service in the system. Key metrics might include:

    • Availability: The percentage of time each service is up and running.
    • Response Time: The average, median, 95th percentile, and 99th percentile response times for each service.
    • 2xx Responses: The number or percentage of requests that result in 2xx (success) HTTP status codes.
    • 4xx Responses: The number or percentage of requests that result in 4xx (client error) HTTP status codes. These indicate issues like bad requests or unauthorized access.
    • 5xx Responses: The number or percentage of requests that result in 5xx (server error) HTTP status codes. These indicate issues with your services.
  • Error Rate: The number or percentage of requests that result in errors. This could be calculated as the sum of 4xx and 5xx responses.

# git aliases
alias st='git status'
alias co='git checkout'
alias pl='git pull'
alias pu='git push'
alias plr='git pull --rebase'
alias plro='git pull --rebase origin'
alias lg='git log'
alias ga='git add .'
alias ci='git commit'

CSS


What is CSS?

  • CSS stands for Cascading Style Sheet.
  • Styles define how to display HTML elements
  • Styles were added to HTML 4.0 to solve a problem
  • External Style Sheets can save a lot of work
  • External Style Sheets are stored in CSS files
@pradeep1991singh
pradeep1991singh / kanban-board.js
Created August 24, 2020 11:06
kanban-board.js
import React, { Component } from 'react';
import './index.css';
export default class KanbanBoard extends Component {
constructor() {
super();
// Each task is uniquely identified by its name.
// Therefore, when you perform any operation on tasks, make sure you pick tasks by names (primary key) instead of any kind of index or any other attribute.
this.state = {
tasks: [
@pradeep1991singh
pradeep1991singh / rain-water-trapped.js
Last active August 13, 2020 18:03
Rain water trapped problem
// The idea is to use two pointer technique, pointer i & j for optimal solution
// run time complexity O(N)
// space time complexity O(1)
function trappedWater(height) {
if (height < 3) return 0;
// initialize trappedWater to zero
let trappedWater = 0;
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
@pradeep1991singh
pradeep1991singh / lru.js
Created November 10, 2019 04:44 — forked from udayvunnam/lru.js
least recently used cache, lru
class Node {
constructor(key, value, next = null, prev = null) {
this.key = key;
this.value = value;
this.next = next;
this.prev = prev;
}
}
@pradeep1991singh
pradeep1991singh / tim.js
Created November 9, 2019 17:53 — forked from premasagar/tim.js
A tiny, secure JavaScript micro-templating script. It doesn't use eval or (new Function), so it cannot execute malicious code.
/*
== Tim ==
A tiny, secure JavaScript micro-templating script.
This has now moved to:
github.com/premasagar/tim
*/
// URL to send the data to
let url = '/api/my-endpoint';
// Create a new FormData and add a key/value pair
let data = new FormData();
data.append('hello', 'world');
let result = navigator.sendBeacon(url, data);
if (result) {
@pradeep1991singh
pradeep1991singh / SortableList.html
Last active September 3, 2020 02:33
SortableList support drag-drop feature
<!DOCTYPE html>
<html>
<head>
<title>Sortable</title>
</head>
<body>
<div id="list"></div>