Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Shivam Chawla Shivam60

💭
I may be slow to respond.
View GitHub Profile
@Shivam60
Shivam60 / 01-directory-structure.md
Created Jun 4, 2020 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.
View 01-directory-structure.md

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@Shivam60
Shivam60 / publickey-git-error.markdown
Created May 28, 2020 — forked from adamjohnson/publickey-git-error.markdown
Fix "Permission denied (publickey)" error when pushing with Git
View publickey-git-error.markdown

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "your_email@example.com". Th
View eslint_prettier_airbnb.md

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
@Shivam60
Shivam60 / ConvertImagesToNumpyArray.py
Last active Mar 18, 2019
ConvertImagesToNumpyArray
View ConvertImagesToNumpyArray.py
"""
Convert all the images in a given folder in a numpy folder.
Additionally a stats dict is given out where keys are the the image shape and the values are the number of images belonging to that image
"""
import numpy as np
import os
from PIL import Image
def ConvertImagesToNumpyArray(Path):
folder=[]
stats={}
@Shivam60
Shivam60 / ResizeImagesInDir.py
Created Feb 21, 2019
This functions resizes all the images for a given size in a given directory. It saves the output to another directory.
View ResizeImagesInDir.py
'''
ImageDir: all the images to bre resized are in this directory
SaveDir: resized images to be saved in this directory
TargetSize: New size of the images
'''
from PIL import Image
def resize(ImageDir,SaveDir,TargetSize):
p=os.getcwd()
os.chdir(ImageDir)
View FindMd5SumOfAllFilesPresent.py
'''
This code finds the md5 sum of all files present in a folder.
It assumes the path is valid.
'''
import os
import hashlib
path=r"I:\shivam\big_dataset"
def md5(fname):
hash_md5 = hashlib.md5()
with open(fname, "rb") as f: