Skip to content

Instantly share code, notes, and snippets.

View AFirooz's full-sized avatar

Ali Firooz AFirooz

View GitHub Profile
@AFirooz
AFirooz / diagrams.md
Last active May 7, 2025 20:21 — forked from blackcater/diagrams.md
Markdown Diagrams

Diagrams

Markdown Preview Enhanced supports rendering flow charts, sequence diagrams, mermaid, PlantUML, WaveDrom, GraphViz, Vega & Vega-lite, Ditaa diagrams. You can also render TikZ, Python Matplotlib, Plotly and all sorts of other graphs and diagrams by using Code Chunk.

Please note that some diagrams don't work well with file exports such as PDF, pandoc, etc.

Flow Charts

This feature is powered by flowchart.js.

@AFirooz
AFirooz / cancerlog.py
Last active April 29, 2025 05:30
Misc Test
# =================================================================================
# Name : cancerlog.py
# Author : Ali Firooz
# Version : 0.0.1
# Copyright : Copyright © 2023 Ali Firooz. All Rights Reserved.
# Description : based on: https://ankitbko.github.io/blog/2021/04/logging-in-python/
# Usage :
# =================================================================================
# TODO:
# 1. Add functionality to log other levels (info, warning, error, critical)
@AFirooz
AFirooz / SMOTE.ipynb
Last active May 22, 2025 20:47
Misc Learn
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Topic: Connection & Cursor
# this doesn't work in Jupyter notebooks!
# https://aiomysql.readthedocs.io/en/stable/cursors.html
# #############################################################################################################
# A cursor for connection.
# Allows Python code to execute MySQL command in a database session. Cursors are created by the `Connection.cursor()`:
# They are bound to the connection for the entire lifetime and all the commands are executed in the context of the database
# session wrapped by the connection.
#
# Cursors that are created from the same connection are not isolated,
@AFirooz
AFirooz / list-groups.py
Last active April 29, 2025 05:12
Poetry Scripts
#! /usr/bin/env python3
# =================================================================================
# Name : list-groups.py
# Author : Ali Firooz
# Version : 0.0.2
# Copyright : Copyright © 2025 Ali Firooz. All Rights Reserved.
# Description : Adding the function of listing available groups in poetry.
# Can be used by running `$ poetry run groups` or
# `$ poetry run groups "<pyproject.toml path>"`.

Method 1: Bash Script

This script is used to enable importing local Python modules from your project directory without having to install the project in development mode or modify PYTHONPATH environment variable manually every time. The .pth file, is a special file that Python looks for when determining import paths.

Note that you need to be in your local module dir, then run these commands.

CURRENT_FOLDER=$(pwd) && echo "$CURRENT_FOLDER"