Skip to content

Instantly share code, notes, and snippets.

View rajeshkumaravel's full-sized avatar
🎯
Focusing

Rajesh Kumaravel rajeshkumaravel

🎯
Focusing
View GitHub Profile
@rajeshkumaravel
rajeshkumaravel / nvm_windows.md
Last active May 8, 2024 12:41
Installing NodeJS thru NVM in Windows (Without Admin)

************ UNINSTALL ANY PREVIOUS NVM AND NODEJS ************

1. Open Powershell and Execute following command

cd $Env:USERPROFILE;
Invoke-WebRequest https://raw.githubusercontent.com/jchip/nvm/v1.5.4/install.ps1 -OutFile install.ps1;
.\install.ps1 -nvmhome $Env:USERPROFILE\nvm;
del install.ps1
@rajeshkumaravel
rajeshkumaravel / steps.md
Created December 7, 2023 13:38
Installing a Font in WSL (Windows Subsystem for Linux)

Installing a Font in WSL (Windows Subsystem for Linux)

To install a font in WSL, follow these steps:

  1. Check Font Location: Confirm that the font file (e.g., VictorMono.ttf) is located in a directory accessible from your WSL instance. You can copy the font file to your WSL home directory for simplicity.

  2. Install Font: You can use the fc-cache command to update the font cache in WSL and make the font available. Open a terminal in your WSL instance and run the following commands:

sudo cp /mnt/c/path/to/VictorMono.ttf /usr/local/share/fonts/

@rajeshkumaravel
rajeshkumaravel / install-git.bat
Created March 20, 2023 08:54 — forked from patmigliaccio/install-git.bat
Quick install Git for Windows with batch script. Include the git*.exe install executable in the same directory as this script.
:: Copyright (C): 2017 Pat Migliaccio
:: pat@patmigliaccio.com
::
:: LICENSE: MIT
::
:: File: install-git.bat
::
:: Batch file for a quick install of Git for Windows
:: Include the git*.exe install executable
:: in the same directory as this script.
@rajeshkumaravel
rajeshkumaravel / node-setup.bat
Created March 20, 2023 08:53 — forked from manuelbieh/node-setup.bat
Install node.js + some packages on Windows via Batchfile
@echo off
NET SESSION >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo This setup needs admin permissions. Please run this file as admin.
pause
exit
)
set NODE_VER=null
@rajeshkumaravel
rajeshkumaravel / getAllImports.ts
Created February 16, 2023 06:40 — forked from tinovyatkin/getAllImports.ts
Getting all imported modules names from a JS file using TypeScript parser
import { readFileSync } from 'fs';
import { builtinModules } from 'module';
import ts from 'typescript';
const tsHost = ts.createCompilerHost(
{
allowJs: true,
noEmit: true,
isolatedModules: true,
@rajeshkumaravel
rajeshkumaravel / memorySizeOfObject.js
Created July 11, 2022 11:26
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@rajeshkumaravel
rajeshkumaravel / sunbird_desktop_setup.md
Created September 7, 2021 06:17
sunbird desktop setup

STEPS TO SETUP DESKTOP APP

  1. Fork and clone https://github.com/Sunbird-Ed/SunbirdEd-portal
  2. Install dependencies src/desktop && yarn install
  3. Install dependencies cd OpenRAP && yarn install
  4. Generate build under cd src/desktop/OpenRAP && npm run pack
  5. Copy generated .tgz file path; ex: /home/User1/SunbirdEd-portal/src/desktop/OpenRAP/dist/project-sunbird-OpenRAP-1.0.2.tgz
  6. cd ..
  7. yarn add path-to-tar file yarn add /home/User1/SunbirdEd-portal/src/desktop/OpenRAP/dist/project-sunbird-OpenRAP-1.0.2.tgz
@rajeshkumaravel
rajeshkumaravel / status_codes.json
Last active April 20, 2021 10:05
List of Node.js HTTP status codes
{
"100": "Continue",
"101": "Switching Protocols",
"102": "Processing",
"200": "OK",
"201": "Created",
"202": "Accepted",
"203": "Non-Authoritative Information",
"204": "No Content",
"205": "Reset Content",
'use strict'
const rTracer = require('cls-rtracer')
// first - configure winston logger
const { createLogger, format, transports } = require('winston')
const { combine, timestamp, printf } = format
// a custom format that outputs request id
@rajeshkumaravel
rajeshkumaravel / How to make your NodeJS application or API secure.md
Created January 6, 2020 07:04
How to make your NodeJS application or API secure ?

How to prevent these attacks from happening in your own project?

Preventing DOS Attacks

  1. First thing to consider when dealing with DOS attacks prevention is to limit the actual payload that user can submit to your app / api / service. You can limit the body payload using body-parser. If you are using ExpressJS as your backend framework, then you are golden. ExpressJS comes with built-in body-parser that you can use.