Skip to content

Instantly share code, notes, and snippets.

View Seas0's full-sized avatar
High Round-Trip Time warning.

Seas0

High Round-Trip Time warning.
View GitHub Profile
@Birch-san
Birch-san / _06_fused_attention_blockptr_jvp.py
Last active July 14, 2025 06:15
Triton fused attention tutorial, updated with JVP support. Albeit with atol=1e-3 accuracy on JVP.
from __future__ import annotations
"""
Fused Attention
===============
This is a Triton implementation of the Flash Attention v2 algorithm from Tri Dao (https://tridao.me/publications/flash2/flash2.pdf)
Credits: OpenAI kernel team
Extra Credits:
import gc
from typing import Tuple
import torch
import torch.nn.functional as F
import triton
import triton.language as tl
import triton.testing
from kernels import get_kernel
@thesamesam
thesamesam / xz-backdoor.md
Last active July 8, 2025 19:40
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Update: I've disabled comments as of 2025-01-26 to avoid everyone having notifications for something a year on if someone wants to suggest a correction. Folks are free to email to suggest corrections still, of course.

Background

@padeoe
padeoe / README_hfd.md
Last active July 18, 2025 04:30
CLI-Tool for download Huggingface models and datasets with aria2/wget: hfd

🤗Huggingface Model Downloader

Note

(2025-01-08) Add feature for 🏷️Tag(Revision) Selection, contributed by @Bamboo-D.
(2024-12-17) Add feature for ⚡Quick Startup and ⏭️Fast Resume, enabling skipping of downloaded files, while removing the git clone dependency to accelerate file list retrieval.

Considering the lack of multi-threaded download support in the official huggingface-cli, and the inadequate error handling in hf_transfer, This command-line tool leverages curl and aria2c for fast and robust downloading of models and datasets.

Features

  • ⏯️ Resume from breakpoint: You can re-run it or Ctrl+C anytime.
@jmceleney
jmceleney / xiaomi-enable-mesh-telnet.py
Last active January 3, 2025 11:00
Python3 file that enables netmode4 on a Xiaomi RB01 AX3200 router
import ssl
import socket
# This script simply replays one side of an intercepted conversation between two Xiaomi
# RB01 (International) AX3200 routers negotiating meshing.
# In effect the script poses as a mesh slave, which causes the mesh master to enable netmode4.
# Enabling netmode is needed as one step in unlocking the router and flashing OpenWrt.
# The router should already have been taken through basic set-up before running this script.
# Netmode4 can be confirmed with curl by requesting the following URL, where ${token} is the "stok"
# variable from your admin session:
@francois-rozet
francois-rozet / flow_matching.py
Last active June 14, 2025 15:18
Flow Matching in 100 LOC
#!/usr/bin/env python
import math
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from sklearn.datasets import make_moons
from torch import Tensor
from tqdm import tqdm
@solarkraft
solarkraft / syncthing-automerge.py
Last active July 10, 2025 18:26
Monitors a Syncthing-synced directory and tries to merge conflicting files (based on https://www.rafa.ee/articles/resolve-syncthing-conflicts-using-three-way-merge/). Probably adaptable for other directory types, but only tested with Logseq (works for me™️).
# This script automatically handles Syncthing conflicts on text files by applying a
# git three-way merge between the previously synced version and each divergent version.
# It depends on the watchdog package and git.
# For automatic dependency installation when running with ´uv run --script deconflicter.py´:
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "watchdog",
@981213
981213 / ch347.c
Last active February 18, 2023 07:02
CH347 SPI library implemented with libusb
// SPDX-License-Identifier: BSD-1-Clause
/*
* Copyright (C) 2022 Chuanhong Guo <[email protected]>
*
* CH347 SPI library using libusb. Protocol reverse-engineered from WCH linux library.
* FIXME: Every numbers used in the USB protocol should be little-endian.
*/
#include <ch347.h>
#include <stdio.h>
@Zeinok
Zeinok / wine-breeze-dark-theme.md
Last active July 15, 2025 14:16
Breeze Dark theme for Wine

Made possible with this reddit post.

Install

wine regedit wine-breeze-dark.reg

Uninstall (Reset Wine color scheme)

wine regedit wine-reset-theme.reg

@v-fox
v-fox / motioninterpolation.vpy
Last active September 19, 2023 00:48 — forked from phiresky/motioninterpolation.vpy
On-CPU motion interpolation for ≤480@144, ~720@120, ≥1080p@60 playback in mpv
#!/usr/bin/python
# vim: set ft=python:
# see the README at https://gist.github.com/v-fox/43c287426c366679afc4c65eece60cbc
# source: https://github.com/mpv-player/mpv/issues/2149
# source: https://github.com/mpv-player/mpv/issues/566
# source: https://github.com/haasn/gentoo-conf/blob/nanodesu/home/nand/.mpv/filters/mvtools.vpy
import vapoursynth as vs
import functools