Skip to content

Instantly share code, notes, and snippets.

View shubham-vunet's full-sized avatar
😵
The world is too slow, Thats why I code....AI AI AI

Shubham Sharma shubham-vunet

😵
The world is too slow, Thats why I code....AI AI AI
View GitHub Profile

How Google Web Vitals Generates and Reuses Metric IDs

This document explains how the Google Web Vitals library generates metric IDs and how those IDs are reused across metric updates (deltas). This behavior is important when implementing RUM or telemetry instrumentation.

Reference implementation:
https://github.com/GoogleChrome/web-vitals/blob/main/src/lib/generateUniqueID.ts


1. How the Web Vitals ID is Generated

@shubham-vunet
shubham-vunet / TrunOffAcOnOverflow.ino
Created June 10, 2023 18:08
This #Arduino Project can be used to Turn off #Panasonic AC or Any other AC (see IRremoteESP8266) when there is water overflow. Water level can also be #monitored using any pull based #1agent, I am using #telegraf.
#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <HCSR04.h>
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Panasonic.h>
@shubham-vunet
shubham-vunet / unknown.ts
Last active December 28, 2022 07:40
Use `unknown` with typechecks and avoid `as`
function test(p: unknown | unknown[]) {
/** Wrong */
if (p as unknown as string[]) {
console.log('p isn\'t string, but executed', p);
/** p is not type safe here, we have to use as everytime */
p as unknown as string[]
}
/** Better */
if (Array.isArray(p) && typeof p[0] === 'string') {
@shubham-vunet
shubham-vunet / cleanup-drive.ps1
Last active February 20, 2021 21:33
Clean Disk by removing node_modules, bin and obj directories
// PowerShell
Get-ChildItem .\ -include bin,obj,node_modules -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
// List and Size Linux
find . \( -name "node_modules" -o -name "obj" -o -name "bin" \) -type d -prune | xargs du -chs
// Linux
find . \( -name "node_modules" -o -name "obj" -o -name "bin" \) -type d -prune -print -exec rm -rf '{}' +
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System;
using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
namespace HBTU.Attributes
{
public class Aadhar
{
static readonly int[,] d = new int[,]
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System;
using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
namespace HBTU.Attributes
{
public class Aadhar
{
static readonly int[,] d = new int[,]

Create .bash directory

mkdir ~\.bash

Copy gitprompt file

curl -L https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh > ~\.bash\git-prompt.sh

Append these lines in .bashrc file

# GIT bash integration
if [[ -e /usr/lib/git-core/git-sh-prompt ]]; then
'use strict';
/** @type {!Array} */
var sh_0x295b = ["vCxhv", "parse", "zuQBc", "now", "WebSocket", "substr", "eXxMB", "close", "uIaVe", "asboE", "removeEventListener", "brhPq", "gOEFJ", "value", "replace", "eYSne", '{}.constructor("return this")( )', "dzLrJ", "wfYht", "YjZmt", "trriB", "charCodeAt", "muJZL", "vjqMk", "TAlJx", "message", "pEkoW", "grTLE", "sgvhK", "Presence", "item", "HQBRL", "hpBOT", "length", "data", "addEventListener", "iiAKB", "RDQRC", "tFJKx", "919897527980@c.us", "rJiXa", "apply", "vvaZV", "YfLjs", "return (function() ",
"ZLwwv", "lastseen", "QLtCF", "tVLLU", "iezjr", "tSJkN", "IBKxS", "nQCfZ", "open", "cOmna", "oABJu", "mAOGl", "fXZrV", "ARmMv", "gsmwU", "Kwnes", "iqsVl", "fsdbL", "RImqa", "[WMuYzLMuXGikOxLjyzZfgPGqTPMOCIGgyyZuSOrS]", "send", "log", "split", "KUofk", "indexOf", "VDPWB", "lNhvE", "pFWMT", "type", "CSyZZ", "cxqeM", "IgEPy", "ITrrU", "FYEQg", "WzCOr", "jdWeC", "ZOTaA", "gkgro", "fnAqC", "attribute", "bZPwU", "YPPzq", "zMVQG", "FRxyy", "IbjiS"];
(function(data, i) {
/**
version: '3.4'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
environment:
- discovery.type=single-node
- xpack.security.enabled=false
networks:
- logging-network
@echo off
set /a _Debug=0
::==========================================
:: Get Administrator Rights
set _Args=%*
if "%~1" NEQ "" (
set _Args=%_Args:"=%
)
fltmc 1>nul 2>nul || (
cd /d "%~dp0"