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
@tusharf5
tusharf5 / setting-up.md
Last active January 7, 2017 20:08
Setting up MAC for web development

1.Generate ssh keys in your home dir.

Command: ssh-keygen -t rsa

2.Create your profile file in home dir.

Command: touch ~/.bash_profile

3.Install NVM inside home dir.

entry

webpack creates a graph of all of your application's dependencies. The starting point of this graph is known as an entry point. The entry point tells webpack where to start and follows the graph of dependencies to know what to bundle. You can think of your application's entry point as the contextual root or the first file to kick off your app. Simple rule: one entry point per HTML page. SPA: one entry point, MPA: multiple entry points. Entry Points are also called chunks

@tusharf5
tusharf5 / deploy.sh
Created January 22, 2019 18:03
Deploy to S3 Bucket with Cloudfront Invalidation
#!/bin/sh
echo "[Deploy] Building"
yarn run build
echo "[Deploy] Changing Directory"
cd ./dist
echo "[Deploy] Current Directory: ${PWD}"
echo "[Deploy] Emptying existing bucket <bucket_name>"
aws s3 rm s3://<bucket_name> --recursive
echo "[Deploy] Uploading new files to <bucket_name>"
@tusharf5
tusharf5 / instruct.md
Created January 24, 2019 07:48
Multiple AWS Profiles on macOS
sudo pip install awscli # Installing aws cli
$ aws configure # Setup
$ aws s3 ls # You can see list of buckets

See credentials file for aws with cat ~/.aws/credentials

This is default profile

# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
@tusharf5
tusharf5 / save_disk.bash
Created April 19, 2019 10:35
Find "node_modules" in a directory recursively and delete it
find . -name "node_modules" -type d
find . -name "node_modules" -type d -exec rm -rf {} +
@tusharf5
tusharf5 / map-over-tree.js
Created July 17, 2019 19:58
Javascript function to iterate and modify all the nodes in a tree like javascript object
let obj = {
id: '1',
children: [
{
id: '2',
children: [
{
id: '4',
children: [
@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 / VPC-Public-Private-Multi-AZ.yaml
Created September 26, 2019 10:59
VPC-Public-Private-Multi-AZ CloudFormation Template
Parameters:
EnvironmentName:
Description: An environment name that will be prefixed to resource names
Type: String
VpcCIDR:
Description: Please enter the IP range (CIDR notation) for this VPC
Type: String
Default: 10.0.0.0/16