Skip to content

Instantly share code, notes, and snippets.

View serg-yalosovetsky's full-sized avatar
🏢
Working from home

Serhii Yalosovetskyi serg-yalosovetsky

🏢
Working from home
View GitHub Profile
@serg-yalosovetsky
serg-yalosovetsky / postman_ai_tests.py
Last active September 17, 2025 22:42
Iterate a Postman collection (v2.1), generate per-request Postman tests with OpenAI, inject them as "test" events, and write an updated collection.
#!/usr/bin/env python3
"""
postman_ai_tests.py
--------------------------------
Iterate a Postman collection (v2.1), generate per-request Postman tests
with OpenAI, inject them as "test" events, and write an updated collection.
Usage:
python postman_ai_tests.py --in collection.json --out collection.with.tests.json \
--model gpt-4.1-mini --max-per-req-tokens 600 --temperature 0.1
@serg-yalosovetsky
serg-yalosovetsky / prompt.txt
Created August 19, 2025 09:01
human prompt
{
"context": "Write in a natural, human way. Keep it simple, clear, and direct. No AI clichés or forced tone.",
"rules": [
"Use short, plain sentences.",
"Cut filler and extra words.",
"No hype or marketing language.",
"Avoid clichés like 'dive into' or 'unlock potential.'",
"Sound conversational. It's okay to start with 'and' or 'but.'",
"Be real. Honest > fake friendly.",
"Casual grammar is fine (e.g., 'i think' instead of 'I think').",
@serg-yalosovetsky
serg-yalosovetsky / prompt.md
Created July 3, 2025 22:14
Знайшов на просторах Reddit (https://www.reddit.com/r/ChatGPT/comments/1lnfcnt/after_147_failed_chatgpt_prompts_i_had_a/) ідеальний промт для тих, хто не хоче писати промти (для вас) 😊 Ідея наступна: помічник Ліра буде задавати вам уточнюючі питання, допоки LLM не буде впевнена, що зможе правильно відповісти на ваш запит. Іншими словами: витягув…

You are Lyra, a master-level AI prompt optimization specialist. Your mission: transform any user input into precision-crafted prompts that unlock AI's full potential across all platforms.

THE 4-D METHODOLOGY

1. DECONSTRUCT

  • Extract core intent, key entities, and context
  • Identify output requirements and constraints
  • Map what's provided vs. what's missing

2. DIAGNOSE

@serg-yalosovetsky
serg-yalosovetsky / compress_all.ps1
Created June 26, 2025 10:56
compress gopro videos win
<#
Стискає усі *.mp4 у папці через NVIDIA HEVC (NVENC) і показує прогрес-бар.
Вихідні файли кладуться у підпапку .\compressed з суфіксом _nv.mp4
#>
# -------- Налаштування --------
$srcDir = "F:\Downloads\GoPro-1750887512"
$dstDir = Join-Path $srcDir 'compressed'
$cq = 25 # 24-27: менше число = краща якість, більший розмір
$preset = "p5" # p1 швидко, p7 якісно
@serg-yalosovetsky
serg-yalosovetsky / youtube_liked_song_copier.gscript
Created June 18, 2025 19:56
function to copy from yt songs that i liked to my own liked playlist, to be able to download whole playlist
/** Кладёт все лайкнутые видео (до 5k) в указанный плейлист. */
function addLikedVideosToPlaylist() {
const targetPlaylistId = 'PLEJYPrcLjkrViJpaliSuODRtJC0ILQzSA'; // куда кладём
const likesPlaylistId = 'LL'; // системный плейлист «Liked videos»
// 1. соберём уже лежащие в целевом плейлисте
const inPlaylist = new Set(getExistingVideos(targetPlaylistId));
let next = '';
let checked = 0, added = 0;
@serg-yalosovetsky
serg-yalosovetsky / function_calling.py
Last active May 4, 2025 14:01
function_calling.py
import asyncio
import math
import ollama
def calc_hypotenuse(a: float, b: float) -> float:
"""
Calculate the hypotenuse of a right triangle
Args:
a: The first leg of the triangle
@serg-yalosovetsky
serg-yalosovetsky / multi_reverse_select.py
Created January 22, 2025 11:50
The code fetches an Order record along with related fields from Chat and Dispute using a combination of ORM-defined relationships and custom SQL for precise control. This approach is ideal for complex queries requiring a mix of ORM convenience and raw SQL flexibility to overcome aliasing or join limitations.
t_order_columns = ['id', 'advertisement', 'buyer', 'amount_mantissa', 'amount_exponent', 'payment_method', 'order_status', 'wallet', 'price_per_unit_mantissa', 'price_per_unit_exponent', 'is_satisfied', 'comment', 'created_at', 'expires_at', 'completed_at']
def _cols(table: type[Users] | type[Wallets] | type[Banks] | type[BankPaymentMethods] | type[UserPaymentMethods] | type[Advertisement] | type[Order]|
ForeignKey[Users] | ForeignKey[Wallets] | ForeignKey[Banks] | ForeignKey[BankPaymentMethods] | ForeignKey[UserPaymentMethods] | ForeignKey[Advertisement] | ForeignKey[Order],
model: type[Users] | type[Wallets] | type[Banks] | type[BankPaymentMethods] | type[UserPaymentMethods] | type[Advertisement] | type[Order]) -> list[Column]:
return [getattr(table, t_col) for t_col in types[model]]
order = await Order.select(
*_cols(Order, Order),
@serg-yalosovetsky
serg-yalosovetsky / generate_pydantic_model_from_attrs.py
Last active January 20, 2025 18:23
Dynamic Pydantic Model Generation with attrs This gist demonstrates how to generate Pydantic models from attrs-based models dynamically. Since FastAPI does not work well with attrs models, the code converts them into Pydantic models for response handling. The following process is used: The is_attrs_model function checks if a given model is an at…
import types
from pydantic import BaseModel, create_model
from attrs import define, has
import attrs
from typing import Any, Dict, Protocol, Type, Callable, Iterator, Tuple
import pydantic
class AttrsModelProtocol(Protocol):
from piccolo.table import Table
from piccolo.columns import (
Varchar,
Integer,
BigInt,
Boolean,
Timestamp,
ForeignKey,
Text,
Numeric,
@serg-yalosovetsky
serg-yalosovetsky / readme.txt
Last active October 10, 2024 03:17
how to run android app on windows with wsa
# i have wsa 2407.4 and windows [email protected]
first do install wsa in https://gist.github.com/HimDek/eb8704e2da1d98240153165743960e17
after installed
in system, set enable viewing in optional diagnostic data
in system, unset block installation of malicious apps
in advanced, enable developer mode
in experimental, enable local network access, vulkan driver and share user folders
optionally change share folder to downloads folder
click on files or on manage developer settings - this starting wsa