Skip to content

Instantly share code, notes, and snippets.

View kasuganosora's full-sized avatar
🙎‍♀️
Working at home

KasuganoSora kasuganosora

🙎‍♀️
Working at home
View GitHub Profile
@miguelmota
miguelmota / request.go
Created July 9, 2020 23:15
Golang disable request chunked transfer encoding
// explicity setting the content-length will disable the "transfer-encoding: chunked" header
req.ContentLength = int64(len(requestBody))
// you can also remove the transfer-encoding header with this,
// however setting the content-length header is still required.
req.TransferEncoding = []string{"identity"}
@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except: