Skip to content

Instantly share code, notes, and snippets.

View prasanth-ntu's full-sized avatar

Prasanth prasanth-ntu

View GitHub Profile
@prasanth-ntu
prasanth-ntu / zip-files-and-folders.py
Last active July 15, 2025 11:35
This will zip all files and folders in the current directory, including subfolders, into archive_name.zip
# use Python’s built-in zipfile module:
# This will zip all files and folders in the current directory, including subfolders, into archive_name.zip.
import zipfile
import os
def zip_all_files(zip_name='archive_name.zip'):
with zipfile.ZipFile(zip_name, 'w', zipfile.ZIP_DEFLATED) as archive:
for foldername, subfolders, filenames in os.walk('.'):
for filename in filenames:
@prasanth-ntu
prasanth-ntu / regret-analysis.ipynb
Last active June 12, 2025 11:54
regret-analysis.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@prasanth-ntu
prasanth-ntu / simple-profit-maximization-example-using-linear-programming.ipynb
Last active June 12, 2025 11:54
simple-profit-maximization-example-using-linear-programming.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@prasanth-ntu
prasanth-ntu / directory_structure_viz.py
Last active July 15, 2025 11:35
Generate a tree-like directory structure visualization
from pathlib import Path
import os
import argparse
def print_directory_structure(directory_path, show_size=False, prefix=""):
"""
Generate a tree-like directory structure visualization.
Args:
directory_path (str): The path to the directory to visualize.
show_size (bool, optional): If True, display the size of each file in bytes. Defaults to False.
{
"public_identifier": "prasanthntu",
"profile_pic_url": "https://media.licdn.com/dms/image/C5103AQEAsdNFh2IAzA/profile-displayphoto-shrink_800_800/0/1571295051197?e=1726099200&v=beta&t=mXzMdvg99gjyH7jXXUMmqwZV6nC2zenjzVDf1a-wVQs",
"background_cover_image_url": "https://media.licdn.com/dms/image/C4D16AQEaHZAJFwrPgQ/profile-displaybackgroundimage-shrink_350_1400/0/1656497479168?e=1726099200&v=beta&t=J-KlreWZve6q9PzzuBsq-D1iDoX2wjILN8WCN1iZHnM",
"first_name": "Prasanth",
"last_name": "Thangavel",
"full_name": "Prasanth Thangavel",
"follower_count": 1118,
"occupation": "Senior Data Scientist",
"headline": "Senior Data Scientist",
{
"public_identifier": "johnrmarty",
"profile_pic_url": "https://s3.us-west-000.backblazeb2.com/proxycurl/person/johnrmarty/profile?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=0004d7f56a0400b0000000001%2F20240713%2Fus-west-000%2Fs3%2Faws4_request&X-Amz-Date=20240713T140821Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=93a1411fc7203f58b9e8dac7083648c02ad0ce0bbaf6d8456f2837bb3ba2baa1",
"background_cover_image_url": null,
"first_name": "John",
"last_name": "Marty",
"full_name": "John Marty",
"follower_count": 261142,
"occupation": "Co-Founder at FF Real Estate",
"headline": "LinkedIn Top Voice",
@prasanth-ntu
prasanth-ntu / w2n_custom.py
Created August 2, 2023 03:12
Improviesd implementation of w2n
american_number_system = {
'zero': 0,
'one': 1,
'two': 2,
'three': 3,
'four': 4,
'five': 5,
'six': 6,
'seven': 7,
'eight': 8,