Skip to content

Instantly share code, notes, and snippets.

View ganeshrvel's full-sized avatar

Ganesh Rathinavel Medayil ganeshrvel

View GitHub Profile
@ganeshrvel
ganeshrvel / find_optimal_mtu.sh
Created June 5, 2024 13:00
Find the optimal network MTU
#!/bin/bash
# Destination to ping
destination="1.1.1.1"
max_mtu=1500
min_mtu=1400
best_mtu=$min_mtu
best_time=999999
# Function to ping with a specific MTU and return the average ping time
@ganeshrvel
ganeshrvel / checkIf.js
Created November 24, 2020 16:39
checkIf
import { assert } from '@sindresorhus/is';
import { IS_PROD } from '../constants/env';
/**
* description - Validate the types. In production mode the validation will be skipped
*
* @param value - variable
* @param {'string'|'boolean'|'number'|'numericString'|'array'|'function'|'object'|'undefinedOrNull'|'undefined'|'null'} type - type to compare
*
* @return {boolean}
@ganeshrvel
ganeshrvel / file-path-sorting.js
Created August 24, 2020 08:17
Sorting file path list - algorithm (javascript)
const pathList = ['/path1/abc', '/path1/123', '/path2/xyz', '/path2/0123', '/path3/123', '/path3/xyz','/path1/'];
const splittedArr = pathList.map(a => a.split('/'));
function sortPath(arr, index, start, end) {
arr.sort((a, b) => {
if (a < b) return -1;
if (a > b) return 1;
return 0;
});