Skip to content

Instantly share code, notes, and snippets.

View banflam's full-sized avatar

Rishi Nitin Agrawal banflam

View GitHub Profile
@banflam
banflam / manifest_gchrome.md
Last active July 24, 2025 22:19
Understanding the manifest.json file in Google Chrome extensions
  1. Every single Chrome extension needs a manifest.json file.
  2. The manifest.json file must be placed in the root of folder, all other structure in the extension is up to the developer.
  3. The manifest.json file is the only required file for a Chrome extension.
  4. Only required keys in the manifest are: manifest_version, name, version.
  5. Comments // are allowed during development but must be removed in the production version (uploaded to the Chrome Web Store).
@banflam
banflam / reload_chrome_extensions.md
Last active July 24, 2025 21:54
When to reload the extension to see the changes

When to reload the extension The following table shows which components need to be reloaded to see changes:

Extension Component Requires Extension Reload
The manifest Yes
Service worker Yes
Content scripts Yes (plus the host page)
The popup No
Options page No
@banflam
banflam / using-env-variables.md
Last active July 15, 2025 21:22
Using environment variables (for secrets like passwords, access tokens etc) in Python code
  1. Create an .env file and put your environment variables in there in the format MY_ENV_VARIABLE=VARIABLE_VALUE (no quote marks, no spaces, no additional formatting)
  2. pip install dot-env
  3. In the Python file where you want to use the actual environment variables:
from dotenv import load_dotenv 
load_dotenv()

# And then wherever you want to actually use the environment variable:

os.getenv('MY_ENV_VARIABLE')
@banflam
banflam / rename-github-repo.md
Created July 15, 2025 21:14
Renaming a GitHub repo
  1. Rename the repo through clicking "Settings" on the page for the repo.
  2. All commits and other things will be auto-redirected to this new repo, BUT:
  3. For the local copy, rename it as usual (mv old_name new_name) AND
  4. git remote set-url origin git@github.com:username/the-entire-new-url
  5. Make a minor change locally and do a test commit to ensure the rename was successful and everything works.
@banflam
banflam / chess_trainer.py
Created June 11, 2025 01:14
A framework-free CLI chess tactics trainer written from scratch in Python
# full, working project at: https://github.com/banflam/chess-trainer/tree/main
import csv
import pathlib
import random
import chess
import time
import argparse
import sys
def show_board(board: chess.Board) -> None:
@banflam
banflam / crackle_pop.py
Created June 10, 2025 20:42
Code CracklePop
def crackle_pop():
for num in range(1, 101):
if num % 15 == 0:
print("CracklePop")
elif num % 3 == 0:
print("Crackle")
elif num % 5 == 0:
print("Pop")
else:
print(num)