Skip to content

Instantly share code, notes, and snippets.

View cofob's full-sized avatar
🏳️‍🌈

Egor Ternovoi cofob

🏳️‍🌈
View GitHub Profile
@cofob
cofob / 0_README.md
Last active August 8, 2025 15:20
ai-copy: Smart code copying for AI with proper paths and .gitignore in one command.

🤖 AI Copy - Smart Code Copier for AI Prompts

Copy code to clipboard with properly formatted relative paths—perfect for sending to AI assistants. This tool preserves your project's directory structure while respecting .gitignore rules and allowing custom messages.

✨ Features

  • AI-Ready Format: Files are prefixed with ./relative/path headers, followed by their content.
  • Git Aware: Respects .gitignore rules by default (use --no-ignore to override).
  • Robust and Safe: Uses Python's pathlib and argparse for reliable cross-platform path and argument handling.
  • Efficient: Gets all ignored files from Git in a single, fast operation.

Cloudflare Link Shortener with D1 and OIDC Authentication

A powerful, secure, and serverless link shortener built to run on the Cloudflare network, featuring Cloudflare Workers, a D1 database, and robust OpenID Connect (OIDC) authentication. This project provides a complete solution for creating, managing, and tracking short URLs with a secure admin interface.

Features

  • Serverless Architecture: Runs entirely on Cloudflare's global network, ensuring high performance and scalability with no servers to manage.
  • Flexible & Secure Authentication:
    • OpenID Connect (OIDC): Modern, standard-based authentication for secure login. Integrate with any OIDC-compliant provider (e.g., Google, Okta, Auth0).
  • Secret Token: A simple, backward-compatible secret token method is also available.
@cofob
cofob / 0_README.md
Last active May 15, 2025 15:57
Voice to text bot hosted on Cloudflare Workers and using DataCrunch API for Whisper X @yobaniy_ty_v_rot_bot

Telegram Voice Transcription Bot

A Cloudflare Workers-based Telegram bot that automatically transcribes voice messages and video notes using WhisperX AI.

Features

  • Transcribes voice messages and audio notes to text
  • Supports speaker diarization for video notes (identifies different speakers)
  • Secure authentication system with admin permissions
  • Selective chat approval (only works in chats approved by admins)
@cofob
cofob / telegram_html_export_parser.py
Created May 6, 2025 23:49
A Python script that converts Telegram HTML chat exports into a structured SQLite database.
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "beautifulsoup4>=4.13.4",
# "lxml>=5.4.0",
# "python-dateutil>=2.9.0.post0",
# ]
# ///
import os
# tidalapi==0.8.3
import tidalapi, json
# 1. Авторизация
session = tidalapi.Session()
# Выполняем вход
session.login_oauth_simple()
print(session.check_login())

NixOS Binary Cache Proxy

nixos-cache-proxy.cofob.dev is a simple reverse proxy to cache.nixos.org, running over the Cloudflare network and utilizing its cache.

It is intended for use if you:

  1. Do not have access to cache.nixos.org (e.g., your government has blocked it).
  2. You experience low speed on cache.nixos.org.

How to Use It

@cofob
cofob / install.sh
Created July 11, 2024 13:01
Easy install ffsend script
#!/usr/bin/env bash
# Version
VERSION="v0.2.76"
# URL to download
URL="https://github.com/timvisee/ffsend/releases/download/${VERSION}/ffsend-${VERSION}-linux-x64-static"
# Destination path
DEST="/usr/local/bin/ffsend"
@cofob
cofob / migrate.py
Last active March 29, 2024 15:54 — forked from chirauki/migrate.py
KVM migration script
#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p python3Packages.libvirt python3Packages.paramiko python3Packages.urllib3
import logging
import argparse
import libvirt
import sys
import os
import subprocess
import paramiko
import xml.etree.ElementTree as ET
@cofob
cofob / arduino.ino
Last active March 29, 2024 09:27
Accelerometer + button
#include <Wire.h> // Wire library - used for I2C communication
int ADXL345 = 0x53; // The ADXL345 sensor I2C address
float X_out, Y_out, Z_out; // Outputs
const int BUTTON_READ_PIN = 5;
const int BUTTON_POWER_PIN = 6;
void setup() {
@cofob
cofob / install_nixos.sh
Created March 18, 2024 14:30
Aeza install NixOS
#!/usr/bin/env bash
curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-23.11 doNetConf=y bash -x