Skip to content

Instantly share code, notes, and snippets.

View BrightXiaoHan's full-sized avatar
🎯
Focusing

Bing Han BrightXiaoHan

🎯
Focusing
  • Universe
  • China.
  • 08:47 (UTC -12:00)
View GitHub Profile
@antenore
antenore / codex-deepseek-setup.md
Last active December 10, 2025 16:08
Configure OpenAI Codex CLI to use DeepSeek models

Configure OpenAI Codex CLI for DeepSeek

Two files needed to make DeepSeek work properly with Codex CLI:

1. ~/.codex/config.toml

model = "deepseek-reasoner"
model_provider = "deepseek-reasoner"
approval_policy = "on-failure"
@padeoe
padeoe / README_hfd.md
Last active December 11, 2025 10:57
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.
@geekodour
geekodour / comparision_whispercpp_faster_whisper.org
Last active February 25, 2025 06:44
whisper.cpp vs faster-whisper using ctranslate2

This is comparison between whisper.cpp and faster-whisper. The faster-whisper readme has some benchmarks on the readme but wanted to test it myself. For whisper, I just ran manually. For faster-whisper, wrote this small script

whisper.cpp

  • ./main -bs 5 -p 2 -f steve2.wav -m models/ggml-small.en.bin
    • Total 8 CPU threads on my 12 core machine
    • -bs 2 : actually performs better about 10s faster.
@garg-aayush
garg-aayush / Steps_multiple_cuda_environments.md
Last active October 29, 2025 09:11
Managing multiple CUDA versions using environment modules in Ubuntu

Steps to manage multiple CUDA environments

Latest Update: May 19th, 2024

This gist contains all the steps required to:

  • Install multiple CUDA versions (e.g., CUDA 11.8 and CUDA 12.1
  • Manage multiple CUDA environments on Ubuntu using the utility called environment modules.
  • Use this approach to avoid CUDA environment conflicts.

Environment Modules is a package that provides for the dynamic modification of a user's environment via modulefiles. You can find more on it at https://modules.readthedocs.io/en/latest/

@mattiasarro
mattiasarro / rwkv.py
Last active March 30, 2025 15:06
RWKV MVP
# Taken from https://johanwind.github.io/2023/03/23/rwkv_details.html.
# I've added additional comments restructured it a tiny bit, which makes it clearer for me.
import numpy as np
from torch import load as torch_load # Only for loading the model weights
from tokenizers import Tokenizer
exp = np.exp
layer_norm = lambda x, w, b : (x - np.mean(x)) / np.std(x) * w + b
sigmoid = lambda x : 1/(1 + exp(-x))
@ymoslem
ymoslem / M2M-100-example.py
Last active August 31, 2025 19:59
Example of translating a file with M2M-100 using CTranslate2
# This example uses M2M-100 models converted to the CTranslate2 format.
# Download CTranslate2 models:
# • M2M-100 418M-parameter model: https://bit.ly/33fM1AO
# • M2M-100 1.2B-parameter model: https://bit.ly/3GYiaed
import ctranslate2
import sentencepiece as spm
@tommyip
tommyip / venv.fish
Last active December 8, 2025 15:01
venv.fish - Automatically activate/deactivate virtualenv in fish shell
# Based on https://gist.github.com/bastibe/c0950e463ffdfdfada7adf149ae77c6f
# Changes:
# * Instead of overriding cd, we detect directory change. This allows the script to work
# for other means of cd, such as z.
# * Update syntax to work with new versions of fish.
# * Handle virtualenvs that are not located in the root of a git directory.
function __auto_source_venv --on-variable PWD --description "Activate/Deactivate virtualenv on directory change"
status --is-command-substitution; and return
@SteveHere
SteveHere / proxy_socks2http.py
Last active October 30, 2023 03:25 — forked from zengxs/proxy_socks2http.py
Prettification + update to current asyncio syntax (Python 3.11+)
import logging
import socks # use pysocks
import asyncio
from datetime import datetime
from itertools import cycle
logging.basicConfig(level=logging.INFO)
socks_router_loop = cycle(( # simple round-robin router to socks proxies
('127.2.0.0', 9050, None, None), # address, port, username, password
# ('127.3.0.0', 9050, "proxy", "passwordpassword"),
@cristianadam
cristianadam / bundle_static_library.cmake
Created January 17, 2020 00:30
CMake function which bundles multiple static libraries into one
# MIT License
#
# Copyright (c) 2019 Cristian Adam
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@zengxs
zengxs / proxy_socks2http.py
Created November 5, 2019 13:53
Convert socks proxy to http proxy (use python with asyncio)
import asyncio
import logging
import re
from asyncio import StreamReader, StreamWriter, StreamReaderProtocol
from collections import namedtuple
from typing import Optional
import socks # use pysocks
logging.basicConfig(level=logging.INFO)