Skip to content

Instantly share code, notes, and snippets.

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

Maya maya257

🏠
Working from home
View GitHub Profile
@maya257
maya257 / 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:
@maya257
maya257 / 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]
@maya257
maya257 / 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():
@maya257
maya257 / 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

@maya257
maya257 / 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