Skip to content

Instantly share code, notes, and snippets.

View Mahrjose's full-sized avatar
☠️
Pirate

Mirza Mahrab Hossain Mahrjose

☠️
Pirate
View GitHub Profile
#!/usr/bin/python3
import os
import random
import time
def main():
while True:
choice = input(
@Mahrjose
Mahrjose / File_Tracker.py
Created January 25, 2022 06:09
Track a file for changes and if file changes do something.
import os
class FileTracker(object):
def __init__(self, filename):
self._cached_stamp = 0
self.filename = filename
def is_modified(self):
stamp = os.stat(self.filename).st_mtime
@Mahrjose
Mahrjose / python.json
Created August 24, 2021 12:18
Default VSCode snippets for python
{
"if": {
"prefix": "if",
"body": [
"if ${1:expression}:",
"\t${2:pass}"
],
"description": "Code snippet for an if statement"
},
"if/else": {
@Mahrjose
Mahrjose / filemaker.py
Created August 22, 2021 04:43
Script for creating multiple files at once in a specific directory.
from pathlib import Path
def fileMaker(start, end, name, extension, folder_path) -> None:
path = Path(folder_path)
if path.exists() and path.is_dir():
for serial in range(start, end + 1):
file_name = f"{name} {serial:0>2d}{extension}"
file = path.joinpath(file_name)
with open(file, "w") as f: