Skip to content

Instantly share code, notes, and snippets.

View Vesnica's full-sized avatar

Vesnica Vesnica

View GitHub Profile
@Vesnica
Vesnica / BuildKit.md
Last active February 10, 2025 01:01
BuildKit

BuildKit 作用

docker run -dti \
    --name buildkitd \
    --security-opt seccomp=unconfined \
    --security-opt apparmor=unconfined \
    --device /dev/fuse \
    -p 8080:8080 \
 -v $(pwd)/buildkitd.toml:/etc/buildkitd.toml \
@Vesnica
Vesnica / Magazine.md
Last active December 18, 2024 01:54
Magazine
# Force model to always use specified device
# Place in `ComfyUI\custom_nodes` to use
# City96 [Apache2]
#
import types
import torch
import comfy.model_management
class OverrideDevice:
@classmethod
@Vesnica
Vesnica / semantic_kernel_proxy_setting.md
Created November 28, 2023 09:11
Semantic Kernel Proxy Setting
  • Official tutorial won't work if you behind a corp proxy
  • Add the following code to fix:
    import openai
    
    openai.proxy = "http://IP:PORT"
    
  • Additionally, you can set api key like:

openai.api_key_path = "path/to/the/key"

@Vesnica
Vesnica / shell-style-wildcards.md
Last active July 3, 2023 00:48
shell-style wildcards
@Vesnica
Vesnica / qdrant.py
Last active June 19, 2023 09:34
Qdrant Json Embedding
import pathlib
import json
import itertools
from sentence_transformers import SentenceTransformer
from qdrant_client import QdrantClient, models
m = SentenceTransformer("shibing624/text2vec-base-chinese-nli")
client_mem = QdrantClient(":memory:")
@Vesnica
Vesnica / opentracker.md
Created April 14, 2023 06:29
Static compile opentracker
  • 启动一个alpine容器:docker run -dti --name alpine alpine sh
  • 登入该容器:docker exec -ti alpine sh
  • 安装必要的包(可能需要先设置代理):apk add wget alpine-sdk linux-headers libowfat-dev zlib-dev
  • https://git.alpinelinux.org/aports/tree/community/opentracker/APKBUILD中获取opentracker源码包位置
  • 下载opentracker源码包:wget https://dev.alpinelinux.org/opentracker/opentracker-0_git20210823.tar.gz
  • 解压并进入目录:tar zxvf https://dev.alpinelinux.org/opentracker/opentracker-0_git20210823.tar.gz; cd opentracker
  • 编译:make PREFIX=/usr/include LDFLAGS+=-static LDFLAGS+=-l:libowfat.a
  • 得到静态编译的opentracker二进制程序,将其拷贝出容器
@Vesnica
Vesnica / gymnax_tips.md
Last active April 8, 2023 09:37
Gymnax Tips
  • Use xvfb to start jupyter-lab: xvfb-run -s "-screen 0 1400x900x24" jupyter-lab
  • Must install old version gym: pip3 install gym==0.19
  • Must install old version pyglet: pip3 install pyglet==1.5.27