echo $(htpasswd -nB USERNAME) | sed -e s/\$/\$\$/g
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| import pandas as pd | |
| import seaborn as sns | |
| import phik # pip install phik==0.12.4 | |
| # see: https://phik.readthedocs.io/en/latest/ | |
| def correlation_mtx(df_: pd.DataFrame, *columns: list[str], title: str = "") -> None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Database Utility Module | |
| ======================= | |
| This module provides a lightweight database configuration and query execution setup | |
| using SQLAlchemy and Pandas. It facilitates database interactions with SQLite | |
| and offers utilities for managing SQL queries in a structured manner. | |
| Features: | |
| --------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from dataclasses import dataclass | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| import matplotlib.axes as type_ax | |
| @dataclass | |
| class Plot: | |
| """src: https://gist.github.com/eugen-hoppe/400e47930f733229eaf773f070c81e62""" | |
| df: pd.DataFrame # . Cache pd.Dataframe for plot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import shutil | |
| import zipfile | |
| import os | |
| from google.colab import drive | |
| def copy_and_unzip_from_drive(drive_path, local_path, drive_mount = "/content/drive"): | |
| """docs: https://gist.github.com/eugen-hoppe/93ece48e0b224b853698249502aa9ba9""" | |
| drive.mount(drive_mount) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def create_sample_csv(path: str, name: str, rows: int, shuffle: int = 0) -> None: | |
| path_file_csv = f'{path}/' + name.removesuffix('.csv') + '.csv' | |
| input_df = pd.read_csv(path_file_csv) | |
| if bool(shuffle): | |
| input_df.sample(frac=1, random_state=shuffle) | |
| output_df = input_df.head(rows) | |
| output_df.to_csv(path_file_csv.replace('.csv', '_sample.csv'), index=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pkg_resources | |
| import os | |
| INPUT_FILE = "requirements.txt" | |
| OUTPUT_FILE = "requirements_.txt" | |
| # OUTPUT_FILE = "requirements.txt" | |
| def get_installed_version(package_name): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @dataclass | |
| class Cat: | |
| ignore_steps: bool = False | |
| step: int = 0 | |
| labels: pd.DataFrame | None = None | |
| categories: pd.DataFrame | None = None | |
| sorted_labels: pd.DataFrame | None = None | |
| merged_final: pd.DataFrame | None = None | |
| category_prefixes: list[str] = field( | |
| default_factory=lambda: ['c1', 'c2'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Callable, Tuple, Type, Optional | |
| from functools import wraps | |
| def try_except( | |
| errors: Tuple[Type[Exception], ...] = (Exception,), | |
| raise_: Optional[Type[Exception]] = None, | |
| txt_: str = "" | |
| ) -> Callable: | |
| """A decorator that wraps a function to handle exceptions""" |
To create new users and add their public keys on an Ubuntu server, follow these steps:
First, open a terminal and enter the following command to create a new user. Replace newuser with your desired username.
sudo adduser newuserNewerOlder