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
@newmen
newmen / pull
Created November 9, 2025 19:54
git pull/push
#!/bin/sh
git fetch
current=`git branch --show-current`
git pull origin $current
@newmen
newmen / pull-all
Created April 8, 2026 13:17
update all repos in the current director
#!/usr/bin/env bash
set -e
ROOT_DIR="${1:-.}"
find "$ROOT_DIR" -type d -name ".git" | while read -r gitdir; do
repo_dir="$(dirname "$gitdir")"
echo "=== Updating $repo_dir ==="
@newmen
newmen / dates-normal-destribution.clj
Created June 26, 2026 15:50
dates-normal-destribution.clj
(ns dates-normal-distribution
(:import [java.util.concurrent ThreadLocalRandom]
[java.time LocalDate]))
(defn next-gaussian
[]
(let [k 0.166
r (.nextGaussian (ThreadLocalRandom/current))
x (+ 0.5 (* r k))]
(if (<= 0 x 1)