Skip to content

Instantly share code, notes, and snippets.

@chm123
chm123 / qwen3.8-flash-next-setup.md
Created September 1, 2026 04:09
Qwen3.8-Flash-Next on Strix Halo
@chm123
chm123 / fix_nvidia_key.md
Created March 6, 2026 23:24
W: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

Fix: apt update NVIDIA Legacy Keyring Warning

Problem

Running apt update produces the following warning:

W: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/InRelease:
Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the
DEPRECATION section in apt-key(8) for details.
@chm123
chm123 / pythonVideoCapture.md
Created September 28, 2023 18:11 — forked from docPhil99/pythonVideoCapture.md
How to write lossless video in Python

OpenCV does a reasonable job of reading videos from file or webcams. It's simple and mostly works. When it comes to writing videos, it however leaves a lot to be desired. There is little control over the codecs and it is almost impossible to know which codecs are installed. It also wants to know things like the frame size at intailisation. This isn't always a problem, but if you don't know it yet it means you have to set up the video writer inside your main processing loop.

To make something as cross-platform compatible as possible it would be nice to use FFmpeg. There are a few python wrappers around, but as far as I can tell they are mainly used for transcoding type applications. One solution is run FFmpeg as a subprocess and set its input to accept a pipe. Then every video frame is passed through the pipe. You write this yourself, in fact it's only a few lines of code. However, the scikit-video package will do this for us, with some nice boilerplate to ma

@chm123
chm123 / opencv-fourcc-on-mac-os-x.md
Created August 17, 2023 17:01 — forked from takuma7/opencv-fourcc-on-mac-os-x.md
OpenCV Video Writer on Mac OS X
@chm123
chm123 / install.sh
Created November 30, 2022 18:44
Install Python on M1
brew update && brew install pyenv pyenv-virtualenv
echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc
brew install zlib sqlite bzip2 libiconv libzip openssl rust
CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(brew --prefix zlib)/include -I$(brew --prefix sqlite)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix bzip2)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix sqlite)/lib" pyenv install miniforge3-4.10.3-10
@chm123
chm123 / tee.py
Created February 28, 2020 19:06
Python redirect stdout to console and file
"""https://stackoverflow.com/questions/14906764/how-to-redirect-stdout-to-both-file-and-console-with-scripting"""
import sys
import traceback
class Tee(object):
"""Context manager that copies stdout and any exceptions to a log file.
Example usage:
@chm123
chm123 / .style.yapf
Last active March 21, 2024 20:17
VSCode Settings
[style]
based_on_style = pep8
column_limit = 120
coalesce_brackets = True
dedent_closing_brackets = False
each_dict_entry_on_separate_line = True
spaces_before_comment = 2
split_before_first_argument = False
split_before_named_assigns = False
split_all_top_level_comma_separated_values = True
@chm123
chm123 / .gitignore
Last active July 6, 2020 22:42
git ignore
# Mac
.DS_Store?
ehthumbs.db
Icon?
Thumbs.db
*.DS_Store
# Windows
Thumbs.db
@chm123
chm123 / python_decorator_guide.md
Created April 9, 2019 16:33 — forked from Zearin/python_decorator_guide.md
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@chm123
chm123 / .vimrc
Last active August 1, 2019 21:32
currently used vimrc
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" ================ General Config ===================
set number " Display line number
set ruler " Display column number
set showmode " Show current mode at bottom
set visualbell " No Sounds
set autoread " Reload file changed outside vim