Skip to content

Instantly share code, notes, and snippets.

@sgouda0412
sgouda0412 / bench.py
Created October 25, 2025 09:31 — forked from dima-afanasyev/bench.py
is print faster than logging in python?
import time
import logging
# Setup
logging.basicConfig(level=logging.INFO, format='%(message)s')
logger = logging.getLogger()
# Test print
start = time.perf_counter()
for i in range(100000):
@sgouda0412
sgouda0412 / dbt_docsblock_autogenerator.py
Created October 24, 2025 01:23 — forked from ducchetrongminh/dbt_docsblock_autogenerator.py
Python script to auto generating dbt docs block from yml files
# Standard imports
import os
# Library imports
import yaml
# Local imports
@sgouda0412
sgouda0412 / numpy-cheatsheet.md
Created October 23, 2025 03:44 — forked from Randy8080/numpy-cheatsheet.md
numpy cheatsheet
- -
NAME Numpy cheatsheet
URL https://quickref.me/numpy
DESCRIPTION NumPy is the fundamental package for scientific computing with Python. This cheat sheet is a quick reference for NumPy beginners.

Getting started

@sgouda0412
sgouda0412 / example-ruff-formatting.ipynb
Created October 23, 2025 03:44 — forked from jbwhit/example-ruff-formatting.ipynb
Steps to use `ruff` in JupyterLab with the `jupyterlab_code_formatter` plugin.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sgouda0412
sgouda0412 / py_stdlib.md
Created October 23, 2025 03:44 — forked from jph00/py_stdlib.md
Hyperlinked index to every module, function, and class in the Python standard library

All of the python 3.9 standard library

(Too big for a single gist, so see first reply for the rest)

Table of contents

@sgouda0412
sgouda0412 / app.py
Created October 23, 2025 02:58 — forked from khaireddine-arbouch/app.py
Snowflake Observability Dashboard with Streamlit
import streamlit as st
import snowflake.connector
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from dotenv import load_dotenv
import os
from snowflake.snowpark import Session
@sgouda0412
sgouda0412 / listgitfiles.sh
Created October 23, 2025 02:33 — forked from rmtbb/listgitfiles.sh
List Git Files - List raw GitHub URLs for files in a repo or subfolder, filtered by extensions
#!/usr/bin/env bash
# listgitfiles.sh
# List raw GitHub URLs for files in a repo or subfolder, filtered by extensions.
# Full README is embedded and printed only with: listgitfiles.sh -h|--help
set -euo pipefail
# ------------------------- Minimal Help (usage) -------------------------
print_min_help() {
cat <<'USAGE'
@sgouda0412
sgouda0412 / spark_tips_and_tricks.md
Created October 23, 2025 02:15 — forked from dusenberrymw/spark_tips_and_tricks.md
Tips and tricks for Apache Spark.

Spark Tips & Tricks

Misc. Tips & Tricks

  • If values are integers in [0, 255], Parquet will automatically compress to use 1 byte unsigned integers, thus decreasing the size of saved DataFrame by a factor of 8.
  • Partition DataFrames to have evenly-distributed, ~128MB partition sizes (empirical finding). Always err on the higher side w.r.t. number of partitions.
  • Pay particular attention to the number of partitions when using flatMap, especially if the following operation will result in high memory usage. The flatMap op usually results in a DataFrame with a [much] larger number of rows, yet the number of partitions will remain the same. Thus, if a subsequent op causes a large expansion of memory usage (i.e. converting a DataFrame of indices to a DataFrame of large Vectors), the memory usage per partition may become too high. In this case, it is beneficial to repartition the output of flatMap to a number of partitions that will safely allow for appropriate partition memory sizes, based upon the

Quick cheat sheet of helpful tmux commands

  1. tmux new - Create and attach to a new session.
  2. tmux new -s NAME_HERE - Create and attach to a new session named NAME_HERE.
  3. CTRL-b, d - Detach (i.e. exit) from the currently-opened tmux session (alternatively, tmux detach). Note, this means press and hold CTRL, press b, release both, press d.
  4. tmux ls - Show list of tmux sessions.
  5. tmux a - Attach to the previously-opened tmux session.
  6. tmux a -t NAME_HERE - Attach to the tmux session named NAME_HERE.
  7. CTRL-d - Delete (i.e. kill) currently-opened tmux session (alternatively tmux kill-session).
  8. CTRL-b, [ - Enter copy mode, and enable scrolling in currently-opened tmux session. Press q to exit.
  9. CTRL-b, " - Split window horizontally (i.e. split and add a pane below).

Grep Tips & Tricks

  • grep -aisElr 'search string here' ./*
    • -a -> search files as strings (this finds strings in note annotations)
    • -i -> ignore case
    • -s -> suppress errors
    • -E -> use extended regular expressions
    • -l -> only show the filename(s); remove this to see the line where the search string was found
    • -r -> search recursively
  • Use :grep for Grep searching within Vim.