Skip to content

Instantly share code, notes, and snippets.

View jeetendra-choudhary's full-sized avatar
💭
Switched to BitBucket may not be available here..

Jeetendra Choudhary jeetendra-choudhary

💭
Switched to BitBucket may not be available here..
View GitHub Profile
@jeetendra-choudhary
jeetendra-choudhary / nodejs-ubuntu-bind-port-80.md
Created February 25, 2019 08:00 — forked from guifromrio/nodejs-ubuntu-bind-port-80.md
Allow Node.js to bind to privileged ports without root access on Ubuntu

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

@jeetendra-choudhary
jeetendra-choudhary / pre-commit-eslint
Created November 28, 2017 07:12 — forked from shettayyy/pre-commit-eslint
Pre-commit hook for Linting JS with ESLint before commit.
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint"
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true