Skip to content

Instantly share code, notes, and snippets.

View Shivam60's full-sized avatar
💭
I may be slow to respond.

Shivam Chawla Shivam60

💭
I may be slow to respond.
View GitHub Profile
@Shivam60
Shivam60 / arunachalam-muruganantham-a-tribute.markdown
Last active April 10, 2018 14:41
Arunachalam Muruganantham: a tribute
'''
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:
@Shivam60
Shivam60 / ResizeImagesInDir.py
Created February 21, 2019 09:41
This functions resizes all the images for a given size in a given directory. It saves the output to another directory.
'''
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)
@Shivam60
Shivam60 / ConvertImagesToNumpyArray.py
Last active March 18, 2019 14:43
ConvertImagesToNumpyArray
"""
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 / eslint_prettier_airbnb.md
Created February 2, 2020 06:07 — forked from bradtraversy/eslint_prettier_airbnb.md
ESLint, Prettier & Airbnb Setup

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 / publickey-git-error.markdown
Created May 28, 2020 20:47 — forked from adamjohnson/publickey-git-error.markdown
Fix "Permission denied (publickey)" error when pushing with Git

"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 "[email protected]". Th
@Shivam60
Shivam60 / 01-directory-structure.md
Created June 4, 2020 09:13 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.

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 / tasks.json
Last active January 8, 2023 06:27
vscode tasks.json to Build & debug C++ programs using mingw64 g++
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "C:\\msys64\\mingw64\\bin\\g++.exe",
"args": [
"-static-libstdc++",
"-fdiagnostics-color=always",
"-g",
@Shivam60
Shivam60 / boost-windows.md
Last active January 14, 2023 15:11 — forked from sim642/boost-windows.md
Installing boost libraries for GCC (MinGW) on Windows

Installing boost libraries for GCC (MinGW) on Windows

Ensure GCC is working as expected.

  1. Open Command Prompt.
  2. Run g++ --version.
  3. If the output contains g++ version number then GCC should be set up properly to run from command line and you can continue.

Boost installation

  1. open MSYS2 MINGW32
  2. install boost by using the command pacman -S mingw-w64-x86_64-boost