Skip to content

Instantly share code, notes, and snippets.

@newmen
newmen / .gitconfig
Created May 13, 2024 16:03
.gitconfig
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
(import '[java.math MathContext RoundingMode])
(comment
(apply + (last
(transpose
(map (fn [i]
(concat (repeat i 0)
(map (partial * 1.75) (range 1 (- 12 i)))))
(range 11)))))
)
@newmen
newmen / tokens.py
Created May 13, 2025 08:36
Считает количество токенов в переданном файле
import tiktoken
import sys
import os
def count_tokens(file_path):
try:
# Проверяем, существует ли файл
if not os.path.exists(file_path):
print(f"Ошибка: Файл '{file_path}' не найден.")
return