Skip to content

Instantly share code, notes, and snippets.

View akumbhani66's full-sized avatar
🎯
Focusing

Ashvin Kumbhani akumbhani66

🎯
Focusing
View GitHub Profile
const jwt = require('jwt-simple');
const payload = {
"this is": "simple payload"
}
const secret = 'top-secret@2020';
// encode
const token = jwt.encode(payload, secret);
console.log(">>>>>", token);
@akumbhani66
akumbhani66 / node_nginx_ssl.md
Created July 11, 2020 18:11 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@akumbhani66
akumbhani66 / cloudSettings
Created March 3, 2020 13:14
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-03-03T13:14:09.694Z","extensionVersion":"v3.4.3"}
1. Undo - ESC -> u
2. Redo - ESC -> cltr + r
3. copy a line - yy
4. paste line -> p
5. cut a line -> dd
@akumbhani66
akumbhani66 / ELB to disk mount
Created December 28, 2019 19:27
Mount an attached elb to disk.
lsblk // list elbs
sudo file -s /dev/xvda* // check data in elb
sudo df -h // check current space
sudo growpart /dev/xvda 1 // Add volume to current disk
sudo lsblk // list adain elbs
sudo resize2fs /dev/xvda1 // Resize current disk
sudo df -h // check current disk. Space should be increased.
@akumbhani66
akumbhani66 / terminal-cd-and-ls-alias
Created December 23, 2019 09:54
Alias that will execute ls command immediately after cd command. To save time and one command.
// Put following function in to your .zshrc and ls -a will going to execute right away after cd.
function chpwd() {
emulate -L zsh
ls -a
}
@akumbhani66
akumbhani66 / tmux.txt
Created November 4, 2019 08:09 — forked from Kishan033/tmux.txt
Tmux cheat sheet
1. Start new tmux session
tmux new -s [session_name]
2. List all session
tmux ls
2. Dive into session
tmux attach -t [session_name]
3. Exit the session without killing current session
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"port": 9229,
// "program": "${workspaceFolder}/start"
}
@akumbhani66
akumbhani66 / check-envs.js
Created August 26, 2019 05:21
A small script to check missing envs from application.
/**
* Tool to check all the environment files for the missing variables.
credit: Marko Markovich
*/
const fs = require('fs');
const dotenv = require('dotenv');
const glob = require('glob');
// eslint-disable-next-line import/no-extraneous-dependencies
const chalk = require('chalk');
@akumbhani66
akumbhani66 / uniqueArray.js
Created August 1, 2019 06:56
Removing duplicate entries from array of object by one of object key.
const uniqueAddresses = Array.from(new Set(arrayTemp.map(ele => ele.a))).map(subEle => {
return arrayTemp.find(ele => ele.a === subEle)
})