Skip to content

Instantly share code, notes, and snippets.

View mcrd25's full-sized avatar
🏠
Working from home

Maya mcrd25

🏠
Working from home
  • Remote
View GitHub Profile
@mcrd25
mcrd25 / untrackfiles_git.md
Last active November 13, 2023 11:01
How to untrack a file that has already been committed to repo after adding to .gitignore

How to Untrack a File That Has Been Committed

It is IMPORTANT to note that you MUST COMMIT ALL PREVIOUS CHANGES BEFOE CONTINUING

  1. Remove everything from Local Repo git rm -r --cached . or if you are untracking a specific file(s) git rm -r --cached name_of_file

  2. Add back all untracked files

@mcrd25
mcrd25 / deploy_webpack_project_to_gh_pages.md
Last active September 4, 2019 17:41
Deploy JavaScript project built using webpack to GitHub Pages

Steps to deploy webpack based JavaScript project to GitHub Pages

  1. From your deployment branch run the following command locally

    git subtree push --prefix dist origin gh-pages

    If your distribution folder is named something else simply replace dist with directory name.

  2. Go to settings and change source to gh-pages branch screenshot

@mcrd25
mcrd25 / github_friendly
Created November 4, 2020 18:59
Python Script to Check if Directory's initial commit is too big (will be extended to be more complex)
#!/usr/bin/env python3
import os
# python function to check size of directory in bytes
def get_directory_size(directory):
total = 0
try:
# check files in directory
for entry in os.scandir(directory):
if entry.is_file():
@mcrd25
mcrd25 / secret_manager.py
Created January 3, 2023 04:10
Python Based Secret Manager
import os
import json
class SecretManager:
def __init__(self):
self.secrets = {}
def get_secrets(self, service_name):
if service_name in self.secrets:
return self.secrets[service_name]
@mcrd25
mcrd25 / capstone_image_formatter.py
Last active January 21, 2023 23:28
Google Automation Cert final captsone
#!/usr/bin/env python3
from PIL import Image
import os
dir = 'path/to/images'
for file in os.listdir(dir):
"""to ignore .DS_STORE file"""
if not file.startswith("."):
with Image.open(dir+"/"+file) as img: