Skip to content

Instantly share code, notes, and snippets.

View tusharf5's full-sized avatar
🏠
Working from home

Tushar Sharma tusharf5

🏠
Working from home
View GitHub Profile
@antfu
antfu / doc-table.md
Last active October 14, 2023 20:09
Doc Table in Markdown

Example

Name

Description


@sindresorhus
sindresorhus / esm-package.md
Last active November 17, 2024 22:07
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@ejlp12
ejlp12 / 1_ecs_note.md
Last active November 6, 2024 12:06
ECS Best Practices Notes
@eenblam
eenblam / linux_reading_list.md
Last active November 10, 2024 19:09
Linux Networking Reading List

Linux Networking Reading List

Currently in no particular order. Most of these are kind of ancient.

Where's all the modern documentation? So much of what I've turned up searching is other folks complaining about having few options beyond reading source code.

The OREILLY books, while dated, seem to be some of the best available. Note that these can be read with a 7-day trial. Do this! At least get through the introduction section and first chapter of each to see if it's what you're after.

https://www.netfilter.org/

@tusharf5
tusharf5 / user-data.md
Last active December 5, 2023 03:36
Starter Script or User Data (NGINX as Reverse Proxy for Node.js with PM2) [Amazon Linux 2]

Starter Script or User Data (NGINX as Reverse Proxy for Node.js with PM2) [Amazon Linux 2]

  • Install Git
  • Install Nginx
  • Setup Nginx as a Reverse Proxy for your Node.js Application
  • Install Node using NVM
  • Install PM2
  • Run a Dummy API Server Using express
  • Start the Server using PM2
  • Auto Start PM2 after a server reboot.
@tusharf5
tusharf5 / nginx.conf
Created August 19, 2019 20:47
Production Ready Nginx as Reverse Proxy Configuration for Node API
user nginx;
worker_processes auto;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
@tusharf5
tusharf5 / retry_promise.js
Created August 2, 2019 17:04
Javascript function to retry a promise n no. of times before rejecting.
/**
* Retries a promise n no. of times before rejecting.
*/
async function retryPromise(promise, nthTry) {
try {
const res = await promise;
return res;
} catch (e) {
if (nthTry === 1) {
return Promise.reject(e);
@crapthings
crapthings / docker-compose.yml
Last active November 20, 2022 12:31
docker-compose rs init
version: '3'
services:
mongo1:
hostname: mongo1
container_name: localmongo1
image: mongo
restart: always
expose:
- 27017
ports:
@harveyconnor
harveyconnor / a-mongodb-replica-set-docker-compose-readme.md
Last active August 12, 2024 17:25
MongoDB Replica Set / docker-compose / mongoose transaction with persistent volume

This will guide you through setting up a replica set in a docker environment using.

  • Docker Compose
  • MongoDB Replica Sets
  • Mongoose
  • Mongoose Transactions

Thanks to https://gist.github.com/asoorm for helping with their docker-compose file!

@romkatv
romkatv / Pure style for Powerlevel10k.md
Last active July 30, 2024 11:08
Pure style for Powerlevel10k

Powerlevel10k can generate the same prompt as Pure.

pure

Installation

git clone https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc