Skip to content

Instantly share code, notes, and snippets.

View NikolayXHD's full-sized avatar
🀌

NikolayHD NikolayXHD

🀌
View GitHub Profile
@NikolayXHD
NikolayXHD / polars_tldr.py
Last active August 22, 2025 16:59
More effective top-level summary for polars dataframe
"""
(2_291_675, 10)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ col ┆ type ┆ null ┆ uniq ┆ median β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•ͺ════════════════════════════════β•ͺ══════β•ͺ═══════β•ͺ════════════════════════════║
β”‚ offer_id ┆ Null ┆ all ┆ 0 ┆ null β”‚
β”‚ task_id ┆ Int64 ┆ 0 ┆ all ┆ 1.14557e+08 β”‚
β”‚ external_id ┆ Int64 ┆ 0 ┆ all ┆ 1.96216e+08 β”‚
β”‚ call_type ┆ Null ┆ all ┆ 0 ┆ null β”‚
β”‚ call_source ┆ String ┆ 0 ┆ 1 ┆ call_tracker β”‚
@NikolayXHD
NikolayXHD / polars_visual_bar.py
Last active August 22, 2025 16:57
Visual number comparison for polars dataframe, similar to calc / excel conditional cell formatting
"""
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ new_data ┆ old_data ┆ balanced ┆ auc_w_no ┆ auc_w_yes ┆ w_no ┆ w_no ┆ w_no ┆ w_no ┆ w_yes ┆ w_yes ┆ w_yes ┆ w_yes ┆ threshold β”‚
β”‚ ┆ ┆ ┆ ┆ ┆ auc ┆ f1 ┆ precision ┆ recall ┆ auc ┆ f1 ┆ precision ┆ recall ┆ β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•ͺ══════════β•ͺ══════════β•ͺ═════════════β•ͺ═════════════β•ͺ═══════β•ͺ═══════β•ͺ═══════════β•ͺ════════β•ͺ═══════β•ͺ═══════β•ͺ═══════════β•ͺ════════β•ͺ═══════════║
β”‚ false ┆ true ┆ false ┆ ┆ ┆ 0.827 ┆ 0.214 ┆ 0.597 ┆ 0.131 ┆ 0.704 ┆ 0.015 ┆ 0.597 ┆ 0.007 ┆ 0.896 β”‚
β”‚ true ┆ false ┆ false ┆ β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ ┆ β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ ┆ 0.886 ┆ 0.574 ┆ 0.603 ┆ 0.548 ┆ 0.823 ┆ 0.174 ┆ 0.609 ┆ 0.101 ┆ 0.440 β”‚
β”‚ true ┆ false ┆ true ┆ β–’β–’β–’β–’β–’β–’β–’β–’β–Œ ┆ β–’β–’β–’β–’β–’β–’β–’β–’β–‰ ┆ 0.878 ┆ 0.557 ┆ 0.600 ┆ 0.519 ┆ 0.811 ┆ 0.121 ┆ 0.655
import os
import tiktoken
import requests
# Configuration
DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY")
MODEL = "deepseek-chat"
ENCODING = tiktoken.get_encoding(
"cl100k_base"
) # DeepSeek uses similar tokenization
@NikolayXHD
NikolayXHD / response_swagger.json
Created January 23, 2023 10:25
instruments.shares
This file has been truncated, but you can view the full file.
{
"instruments": [
{
"figi": "BBG000FXW512",
"ticker": "PKI",
"classCode": "SPBXM",
"isin": "US7140461093",
"lot": 1,
"currency": "usd",
"shortEnabledFlag": false,
@NikolayXHD
NikolayXHD / terminal.js
Last active July 4, 2022 15:20
denser tinkoff terminal
// ==UserScript==
// @name dense_tinkoff_terminal
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Denser Tinkoff investment terminal
// @author NikolayXHD
// @match https://www.tinkoff.ru/invest-terminal/*
// @grant none
// ==/UserScript==