Skip to content

Instantly share code, notes, and snippets.

@datavudeja
datavudeja / basics.py
Created November 26, 2025 17:31 — forked from mjdecker/basics.py
Python language examples with notes
# General Information
# * High-level programming language
# * General-purpose (vs. domain specific)
# * Created by Guido van Rossum (1991)
# * Emphasizes:
# * Code readability
# * Highly-expressive syntax
#
#
# Some specifics
@datavudeja
datavudeja / diretory_tree_database.py
Created November 25, 2025 14:47 — forked from hikineet0/diretory_tree_database.py
Script to create a relational database out of a user input root directory's directory tree or to query such database.
from __future__ import annotations
import os
import sys
import json
import pprint
import sqlite3
import argparse
from pathlib import Path
from typing import cast, List, NewType, Tuple, TypedDict, Generator, Union
@datavudeja
datavudeja / autoreload.py
Created November 24, 2025 15:01 — forked from MU-Software/autoreload.py
Python script auto reloader (directory watcher)
import os
import sys
import time
import hashlib
import pathlib as pt
import subprocess as sp
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
import asyncio
import functools
import threading
from contextlib import asynccontextmanager, contextmanager
from typing import Any, Callable
@contextmanager
def my_cont_mgr(tag: str):
print(f"{tag}: f entering!")
@datavudeja
datavudeja / state_class_patch.py
Created November 19, 2025 16:34 — forked from tvst/state_class_patch.py
An alternative API for st.session_state using a class decorator.
"""An alternative API for st.session_state using a class decorator.
So instead of doing this...
if "run_counter" in st.session_state:
st.session_state.run_counter = 0
st.session_state.run_counter += 1
st.write("Number of reruns:", st.session_state.run_counter)
@datavudeja
datavudeja / class_histogram.py
Created November 19, 2025 16:23 — forked from JoseJavierGuerrero/class_histogram.py
Código de ejemplo en Python 3 | Ampliación de Programación
#!/usr/bin/env python
# encoding: utf-8
import os
import collections
import math
class Histogram(collections.Counter):
"""Stores an histogram with the word frequency of a txt document"""
@datavudeja
datavudeja / data_processing.py
Created November 18, 2025 15:44 — forked from ernestprovo23/data_processing.py
Advanced Data Processing and Analytics Pipeline
#!/usr/bin/env python3
"""
Advanced Data Processing and Analytics Pipeline
Features: ETL operations, data validation, statistical analysis
"""
import pandas as pd
import numpy as np
from typing import Dict, List, Tuple, Optional, Any
from dataclasses import dataclass
@datavudeja
datavudeja / convert_7z_v7.py
Created October 30, 2025 20:20 — forked from Druark/convert_7z_v7.py
Converts zips and other archive types, to 7z with optimal compression in the current directory.
import os
import sys
import subprocess
from pathlib import Path
import shutil
import stat
import time
from dataclasses import dataclass
import multiprocessing
@datavudeja
datavudeja / scandir.py
Created October 30, 2025 20:19 — forked from kbg/scandir.py
#!/usr/bin/env python3
# Copyright (c) 2020 Kolja Glogowski
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
@datavudeja
datavudeja / spider.py
Created October 23, 2025 16:11 — forked from jkerhin/spider.py
Walk through the filesystem, store in sqlite db
"""Walk through the filesystem, store in sqlite db
Utility script for walking a filesystem, and storing file information in a sqlite
database.
Goals/Design Notes:
- [x] Pure standard library
- [x] Name, Path as seprate columns
- [x] Store the datetime that a file pth was inserted
- [x] Implement fulltext search of both filenames and paths