Skip to content

Instantly share code, notes, and snippets.

View yunho-c's full-sized avatar
πŸ‘‹

Yunho Cho yunho-c

πŸ‘‹
View GitHub Profile
@yunho-c
yunho-c / sync_jupyter.py
Created June 7, 2025 16:54
Sync `.ipynb` and `.py` files based on last modified time
"""
A script to synchronize Jupyter notebooks (.ipynb) and Python scripts (.py).
This script scans a specified directory for pairs of .py and .ipynb files
with the same base name. It then compares their last modification times
and copies the newer onto the older using `jupytext`.
This is useful for those who prefer to track Jupyter Notebooks in .py files.
Usage:
@yunho-c
yunho-c / Count lines in Git repo
Created June 6, 2025 01:06 — forked from mandiwise/Count lines in Git repo
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@yunho-c
yunho-c / languages.json
Last active June 3, 2025 21:25
A JSON file of major languages with country mappings and names
{
"none": {
"english_name": "",
"native_name": "",
"countries": []
},
"aa": {
"english_name": "Afar",
"native_name": "Qafar af",
"countries": [
@yunho-c
yunho-c / make_white_pixels_transparent.py
Created April 20, 2025 23:02
Python script to make white pixels transparent
import sys
import argparse
from PIL import Image
import numpy as np
def add_transparency(input_path, output_path, threshold=240):
"""
Add alpha channel to an image based on brightness threshold.
Makes pixels with brightness >= threshold transparent.
@yunho-c
yunho-c / compare_huggingface_models.py
Created April 17, 2025 00:34
Compare (diff) two HuggingFace Transformer Models (specifically: SpatialLM vs. base)
"""
Base Models (w/ sizes):
meta-llama/Llama-3.2-1B
Qwen/Qwen2.5-0.5B
SpatialLM Models:
manycore-research/SpatialLM-Llama-1B
manycore-research/SpatialLM-Qwen-0.5B
Commands:
@yunho-c
yunho-c / nvidia_vram_usage_by_user.sh
Created April 9, 2025 22:49
nvidia_vram_usage_by_user.sh
#!/bin/bash
# Shows which processes & users are consuming GPU memory for Nvidia GPUs.
echo "User, PID, Used Memory, GPU ID"
# Get the GPU processes information
nvidia-smi --query-compute-apps=pid,used_memory,gpu_bus_id --format=csv,noheader | while read line
do
# Extract PID from the line - use cut instead of awk for CSV format
@yunho-c
yunho-c / global-protect.sh
Created April 9, 2025 18:28 — forked from kaleksandrov/global-protect.sh
Simple script that starts and stops GlobalProtect.app on Mac OSX.
#!/bin/bash
case $# in
0)
echo "Usage: $0 {start|stop}"
exit 1
;;
1)
case $1 in
start)
@yunho-c
yunho-c / dpg_video_inspector.py
Created March 29, 2025 22:55
DearPyGUI Video Inspector (Multiple Windows, Frame-Traversable w/ Slider & Buttons)
import dearpygui.dearpygui as dpg
import cv2
import numpy as np
import time
# Constants
# SCALE_FACTOR = 1.0 # Scale factor for the video display
SCALE_FACTOR = 0.25 # Scale factor for the video display
WINDOW_OFFSET = 20 # Offset between windows in pixels
@yunho-c
yunho-c / dearpygui_dynamic_texture_example.py
Created March 29, 2025 20:48
DearPyGUI Dynamic Texture Example
import dearpygui.dearpygui as dpg
import numpy as np
dpg.create_context()
# Create a 100x100 texture with RGBA values [1.0, 0.0, 1.0, 1.0]
texture_data = np.ones((100, 100, 4), dtype=np.float32)
texture_data[:, :, 1] = 0.0 # Set green channel to 0
texture_data = texture_data.flatten() # Flatten to 1D array for DearPyGUI
@yunho-c
yunho-c / install_gh_cli_linux.sh
Last active March 8, 2025 20:13
Install GitHub CLI on Linux
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y