Skip to content

Instantly share code, notes, and snippets.

View SouravDas25's full-sized avatar
💭
I may be slow to respond.

Sourav Das SouravDas25

💭
I may be slow to respond.
View GitHub Profile
@SouravDas25
SouravDas25 / executors.rs
Last active March 27, 2025 11:09
Async Executor - Mini Tokio - Rust
use crate::sleep::TimeoutWorker;
use crate::io::{FileWorker, IoTask};
use crate::task::Task;
use futures::future::BoxFuture;
use futures::FutureExt;
use std::collections::VecDeque;
use std::future::Future;
use std::sync::{Arc, Mutex};
use std::task::{Context, Waker};
@SouravDas25
SouravDas25 / java vs node medium table
Last active September 2, 2024 08:17
java vs node medium table
┌───────────────────────────┬────────────┬────────────┬───────────┬────────────────────┐
│ Context │ metric │ Java │ NodeJS │ NodeJS (Clustered) │
├───────────────────────────┼────────────┼────────────┼───────────┼────────────────────┤
│ CPU Bound Task │ http req │ 18 r/s │ 1 r/s │ 8 r/s │
│ - 150 vus for 30s │ cpu │ 100% │ 100% │ 100% │
│ │ memory │ ~ 2 GB │ ~ 1 GB │ ~ 2 GB │
├───────────────────────────┼────────────┼────────────┼───────────┼────────────────────┤
│ IO Bound Task │ http req │ 190 r/s │ 804 r/s │ 951 r/s │
│ - 1000 vus for 10s │ cpu │ 60 - 70% │ 45% │ 70% │
│ │ memory │ ~ 4 GB │ ~ 2 GB │ ~ 3 GB │
const axios = require('axios').default;
const FormData = require('form-data');
const cmis = require("cmis");
const jwt = require('jsonwebtoken');
const mutexify = require('mutexify/promise')
class CmisSessionManager {
tenantSessions = new Map()
@SouravDas25
SouravDas25 / encrypt-decrypt-data.js
Last active March 2, 2023 16:09
Encrypt & Decrypt any file
var fs = require('fs');
var crypto = require('crypto');
const filename = 'rapid-fire.txt';
const key = "BX4X8G5Q1IQWEU4M23C3PGUV1AZQ91";
const iv = "XJLJ4YOQXTZ2TMGM";
// console.log(iv.toString(), key.toString())
function () {
const mailRegex = /^\w+[\w-+.]*\@\w+([-.]\w+)*\.[a-zA-Z]{2,}$/;
return {
required: function (value) {
return value !== null;
},
email: function (value) {
return value.match(mailRegex);
Color Type Doors Tires Class
Red SUV 2 Goodyear +
Blue Minivan 4 Goodyear -
Green Car 4 Goodyear -
Red Minivan 4 MRE -
Green Car 2 MRE +
Green SUV 4 MRE -
Blue SUV 2 MRE -
Blue Car 2 Goodyear +
Red SUV 2 MRE -
@SouravDas25
SouravDas25 / go-back-n-client.py
Last active May 15, 2020 18:38
Go Back N Networking Algo
import collections
import hashlib
import pickle
import threading
import time
from socket import *
import random
HOST = gethostbyname('localhost')
PORT = 12345
@SouravDas25
SouravDas25 / run.sh
Last active May 15, 2020 18:39
Selective Repeate ARQ Networking Algo
folder=$1
// cd $folder
python3 "server.py" > server.log &
python3 "client.py" > client.log
@SouravDas25
SouravDas25 / InstanceCreator.java
Created May 11, 2020 17:15
Java Any Object Creator
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ClassUtils;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import java.util.*;
public class InstanceCreator {
@SouravDas25
SouravDas25 / JsonComparision.js
Last active February 12, 2020 05:46
Deep Compare 2 Json Object
var a = [
{
"Id": "t.6.C1PRGOO3ZFMACYDJ6H6LFOKCG:C1PRGOO3ZFMACYDJ6H6LFOKCG",
"Version": "4.0",
"GeneratedTime": "Jan 24, 2020 6:57:58 AM",
"IsSecured": false,
"IsRemote": false,
"IsEmbedded": false,
"HasDAC": false,
"IsIndexingEnabled": true,