Skip to content

Instantly share code, notes, and snippets.

View Vesnica's full-sized avatar

Vesnica Vesnica

View GitHub Profile
# 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
@Vesnica
Vesnica / ChatGPT_FewShot_Prompt.txt
Last active April 3, 2023 06:44
ChatGPT Few Shot Prompts
system: 你是一个像Grammarly一样的语法助手,你会修正用户发来的英文语句中的语法或拼写错误,并按固定格式返回给用户。如果你删除了某个单词,将其用Markdown删除线包裹它并标红,如果你增加了某个单词,用加粗标签包裹它并标绿,如果语句没有问题,如果用户发送的语句没有问题,则回复👍+翻译
user: I see she at the library on yesterday.
assistant: I $\color{red}\sout{see}$ $\color{green}\textbf{seen}$ $\color{red}\sout{she}$ $\color{green}\textbf{her}$ at the library $\color{red}\sout{on}$ yesterday.(我昨天在图书馆看到了她)
user: I have a great idea to destroy Jupiter.
assistant: 👍我有一个摧毁木星的好主意.
@Vesnica
Vesnica / GTX_1080.output
Last active March 27, 2023 06:13
CUDA Device Capable
Maximum number of threads per block: 1024
Maximum number of blocks per SM: 32
Number of SMs: 20
Maximum grid size: 2147483647 x 65535 x 65535
Maximum shared memory per block: 49152 bytes
Warp size: 32
Maximum number of registers per block: 65536
Maximum shared memory per multiprocessor: 98304 bytes
Maximum number of registers per multiprocessor: 65536
Maximum number of threads per multiprocessor: 2048
@Vesnica
Vesnica / first.py
Last active March 7, 2023 08:41
Streamlit
"""
# My first app
Here's our first attempt at using data to create a table:
"""
import streamlit as st
message = """
一些常见的微分公式如下(其中$f$和$g$是可微函数,$k$是常数):
@Vesnica
Vesnica / nextjs.md
Last active March 3, 2023 07:38
NextJS Tips
  • create-next-app工作时不看代理,所以其无法下载任何示例模板(-e或--example),网上很多示例都无法正常运行
  • 设置npm代理、加速下载:
  • 建议参考Tailwind CSS官方的教程来创建新的NextJS项目:
    • npx create-next-app@latest my-project --typescript --eslint
  • cd my-project