Skip to content

Instantly share code, notes, and snippets.

View ShivamJoker's full-sized avatar
🐢
Code for life

Shivam ShivamJoker

🐢
Code for life
View GitHub Profile
@ShivamJoker
ShivamJoker / password-manager.ts
Created January 9, 2022 14:31
Password encryption in NodeJS with Crypto module
import { randomBytes, scryptSync } from 'crypto';
// Pass the password string and get hashed password back
// ( and store only the hashed string in your database)
const encryptPassowrd = (password: string, salt: string) => {
return scryptSync(password, salt, 32).toString('hex');
};
/**
* Hash password with random salt
@ShivamJoker
ShivamJoker / index.html
Last active January 7, 2022 16:17
Split vs Slice #jsbench #jsperf (http://jsbench.github.io/#659320c361dc2745813ae6aaebbdfff9) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Split vs Slice #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@ShivamJoker
ShivamJoker / Useful bash commands.md
Last active January 17, 2024 09:43
Some of the useful bash commands which I use everyday

Rename all files extension recursively eg. .js to .jsx

find . -name '*.js' -exec sh -c 'mv "$0" "${0%.js}.jsx"' {} \;

Convert all images in a specific format (eg .png or .jpg to webp)

for i in *; do convert $i "${i%.*}.webp"; done   
@ShivamJoker
ShivamJoker / benchmark
Created December 5, 2021 11:11
nodejs stream benchmarks
❯ autocannon -c 5 -a 5 --timeout 1000000 'http://143.110.241.172/stream?limit=100000'
Running 5 requests test @ http://143.110.241.172/stream?limit=100000
5 connections
┌─────────┬──────────┬──────────┬──────────┬──────────┬────────────┬──────────┬──────────┐
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
├─────────┼──────────┼──────────┼──────────┼──────────┼────────────┼──────────┼──────────┤
│ Latency │ 14475 ms │ 14588 ms │ 15197 ms │ 15197 ms │ 14666.8 ms │ 270.1 ms │ 15197 ms │
@ShivamJoker
ShivamJoker / GoogleLogin.js
Created December 29, 2020 16:23
Login to your google account with puppeteer
import puppeteer from "puppeteer-extra";
import StealthPlugin from "puppeteer-extra-plugin-stealth";
puppeteer.use(StealthPlugin());
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
const navigationPromise = page.waitForNavigation();
await page.goto("https://accounts.google.com/");
import React, {useRef, useEffect, useState} from 'react';
import {
View,
SafeAreaView,
Text,
Image,
FlatList,
Dimensions,
Animated,
StyleSheet,
{"v":"5.6.5","fr":29.9700012207031,"ip":0,"op":25.0000010182709,"w":500,"h":500,"nm":"sun moon","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"cover","td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[247.656,246.235,0],"ix":2},"a":{"a":0,"k":[62,83,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[382.051,382.051],"ix":2},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[0,0],"to":[-40.333,22],"ti":[40.333,-22]},{"t":17.0000006924242,"s":[-242,132]}],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":true},{"ty":"fl","c":{"a":0,"k":[0.145343122295,0.505901501225,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic -
server {
# root /var/www/notifyer.xyz/html;
#index index.html index.htm index.nginx-debian.html;
server_name notifyer.xyz www.notifyer.xyz;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
import tkinter as tk
from pynput import keyboard
root = tk.Tk()
root.title("WiFi Remote")
root.geometry("600x400")
root.resizable(0, 0)
focusedtEntry = 0
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
int todosLength = 0;
FILE *fp;
struct Todo
{