Skip to content

Instantly share code, notes, and snippets.

@teleprint-me
teleprint-me / bpe.py
Created August 7, 2025 04:46
Byte-pair Encoding completely from scratch in Python
"""
Copyright ยฉ 2025 Austin Berrio
@file unicode.model.py
@license cc-by-sa-nc-4.0
@ref https://aclanthology.org/P16-1162/
@ref https://aclanthology.org/2025.coling-main.400/
@ref https://huggingface.co/blog/catherinearnett/dangers-of-tokenizer-recycling
"""
import argparse
@entrepeneur4lyf
entrepeneur4lyf / gist:d38d50e13cd09138fbca97316fef8ac7
Created February 28, 2025 01:43
Coding Prompt - Reward system self scoring
All code you write MUST be fully optimized.โ€œFully optimizedโ€ includes:
โ€ข Maximizing algorithmic big-O efficiency for memory and runtime (e.g., preferring O(n) over O(nยฒ) where possible, minimizing memory allocations).
โ€ข Using parallelization and vectorization where appropriate (e.g., leveraging multi-threading, GPU acceleration, or SIMD instructions when the problem scale and hardware context justify it).
โ€ข Following proper style conventions for the code language (e.g., adhering to PEP 8 for Python, camelCase or snake_case as per language norms, maximizing code reuse (DRY)).
โ€ข No extra code beyond what is absolutely necessary to solve the problem the user provides (i.e., no technical debt, no speculative features, no unused variables or functions).
โ€ข Ensuring readability and maintainability without sacrificing performance (e.g., using meaningful variable/function names, adding concise comments only where intent isnโ€™t obvious from the code).
โ€ข Prioritizing language-specific best practices and idiomatic
@tbogdala
tbogdala / kokoro_v1_0.py
Created February 13, 2025 01:37
Quick and dirty kokoro invocation that also plays the audio as well as saving it.
# 1๏ธโƒฃ Install required packages
# pip install kokoro soundfile sounddevice argparse
import sys
import argparse
from kokoro import KPipeline
import soundfile as sf
import sounddevice as sd
# ๐Ÿ‡บ๐Ÿ‡ธ 'a' => American English, ๐Ÿ‡ฌ๐Ÿ‡ง 'b' => British English
@Kelechiede
Kelechiede / Extracting_and_Visualizing_Stock_Data.ipynb
Created February 4, 2025 07:22
Analyzing Tesla and GameStop stock using yfinance and web scraping
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@netixc
netixc / main.py
Last active July 19, 2025 16:48
chatbot ollama/tts kokoro/stt speaches
import pyaudio
import wave
import time
import warnings
from openai import OpenAI
import json
import sys
import io
import numpy
import requests
@virattt
virattt / hedge-fund-agent-team-v1-3.ipynb
Last active July 31, 2025 15:25
hedge-fund-agent-team-v1-3.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@virattt
virattt / backtesting-101.ipynb
Created November 11, 2024 23:40
backtesting-101.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

๐Ÿš€ Agents with txtai

We're thrilled to share a preview version of txtai agents. Inspired by the simplicity of frameworks like OpenAI Swarm, txtai agents are built on top of the Transformers Agent framework. This supports all LLMs txtai supports (Hugging Face, llama.cpp, OpenAI + Claude + AWS Bedrock via LiteLLM).

The following example shows how to create an agent with txtai. Agents will be available in the upcoming txtai 8.0 release (available now in the txtai GitHub repo now - follow #804 - feedback welcome).

Install

@Skarlso
Skarlso / bulk-delete-packages.sh
Created October 22, 2024 07:58
Delete packages for a user using a glob
#!/bin/bash
set -e
# Variables
OWNER=$1 # Replace with your GitHub username or organization name
PACKAGE_GLOB=$2 # Glob pattern for package names passed as an argument (e.g., "package*" to match all)
# Function to delete a package version
delete_package_version() {
@alwin-augustin-dev
alwin-augustin-dev / code_review.sh
Created October 17, 2024 06:31
Automated code review using local LLMs
#!/bin/bash
# Define variables
REPO_PATH=""
PR_NUMBER=""
OLLAMA_API_URL="http://localhost:11434/api/generate"
OUTPUT_FILE="code_review_output.md"
MODEL="llama3.1:8b"
MAX_CONTEXT_LINES=20000