Skip to content

Instantly share code, notes, and snippets.

View shaposhnikoff's full-sized avatar
🏠
Working from home

Shaposhnikoff shaposhnikoff

🏠
Working from home
  • Kiev,Ukraine
View GitHub Profile
@Jordanh1996
Jordanh1996 / repro_prompt_too_long.py
Created March 27, 2026 20:57
Reproduction: SummarizationMiddleware token underestimation with ChatAnthropicVertex
"""Reproduction: SummarizationMiddleware token underestimation with ChatAnthropicVertex.
LangChain's _get_approximate_token_counter checks model._llm_type == "anthropic-chat",
but ChatAnthropicVertex._llm_type returns "anthropic-chat-vertexai". This causes the
token counter to use 4.0 chars/token instead of 3.3, underestimating by ~16%.
The summarization middleware never triggers, and the API rejects the prompt.
Additionally:
- use_usage_metadata_scaling is gated on response_metadata["model_provider"], which
ChatAnthropicVertex never sets. The scaling safety net is a no-op.
<!DOCTYPE html>
<!--
Coded by veax / spreadingmoney on discord.
You can take this landing page but leave this message or website will be taken down legally.
-->
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdAAAAEtCAYAAAC4UTHHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAP+lSURBVHhe7P1ptybJbSYIPnB/770RkRm5kLkyuWorLSWpSkuXRjXqUfX06Zkzv0o/a86cOj1Ta5ckilqpEklJFEWK4pJbrHd5X3fMB+CBweDm90ZSVPUXIuK97gaDwWBmMMA2d5cvfOELip/AT+An8BP4CfwEfgKfCKaK+An8BH4CP4GfwE/gJ3A3yGuffkdFBCIC1TIZFUABrAJABNLHQiDYIB1EdiIATNPWb4sIJgVEjaXC8u9yFWBNeMYoAM1kt+T9InGTZvkETKIKiDQZZVCODKo6LGuGKk8NW7maDKvjLXx72h4UIlUWtreX+zZZa1sQ3ck3ijecinTx1LWaZ9B7/F6ZVNV0YCr1pWq5eDrqNuMy1LwrVHpCTbfHH0mPCVlvR5D1GDBduw06etfLFtZo4X8KrCu1roda7lz+3AaEPT4VVHVTl1kPatwekE+VRXTd4aEwNPOvLcX4Lay6tu60A+M84VrCvFoeCoWsFojye5iwz9PgReKjHT1PQtW9xeuttfvSxa9S+NW8teffwW1xBVQV8x2qtCZemsLsL6JjPQOMaIRuYJkr9Ccz0E8CIoJJJlOQHcOeYc/43wYq/e+FYY/WRd2TRWTCNAmm4ogssv262ISPcKao8QPIjm0ELxK/4e+dVyZro5qeuFHcCCr9Xekq3fBXE1W4teN+
@recollir
recollir / Generate calendar.csv and heatmap
Last active March 27, 2026 21:18
Create GitHub styled heatmaps with gnuplot
# Generate calendar.csv as input data for heatmap
curl -s https://curl.se/docs/releases.csv |\
awk -F';' '{print $4}' |\
while read -r d; do
wday=$(date -d "$d" +%u) # 1=Mon..7=Sun
week=$(date -d "$d" +%V) # ISO week 01..53
printf "%s,%s,%s\n" "$d" "$week" "$wday"
done |\
awk -F',' '{ key=$2","$3; c[key]++ }
END {for (k in c) print k","c[k]}' |\
@gsingal
gsingal / gist:e57a00fc4245b547cfb5c3af604ccbf4
Created March 27, 2026 19:22
Fraud Reduction Initiative — Full Summary (for Ahmed & Mahmoud)
# Fraud Reduction Initiative — Complete Summary
**Date:** 2026-03-25 to 2026-03-27
**Trigger:** Megan's Slack report of recurring Bancorp scammer
**PR:** #3454 (ready for review)
**Reviewer:** @ApxSnowflake
---
## What Happened
!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EnergySave</title>
<style>
* { margin:0; padding:0; box-sizing:border-box; }
:root { --g:#2ECC71; --dg:#1a9e52; --bg:#0f1923; --c1:#1a2634; --c2:#223044; --txt:#f0f4f8; --m:#8899aa; --a:#4FC3F7; }
body { font-family:-apple-system,sans-serif; background:var(--bg); color:var(--txt); min-height:100vh; }
*,*::before, *::after {
margin: 0;
padding: 0;
border: none;
box-sizing: border-box;
}
a, a:visited, a:hover {
text-decoration: none;
color: inherit;
import os
import cv2
import random
import argparse
def extract_random_interval_frames(
video_path: str,
output_dir: str,
min_interval_sec: float = 2.0,
@leon2017
leon2017 / claude.zsh
Created February 28, 2026 06:04 — forked from LeslieLeung/claude.zsh
A sleek script to switch between Claude Code providers.
function claude() {
# 默认渠道配置
local default_provider=""
# 定义不同服务的配置
local base_url=""
local auth_token=""
local api_key=""
local model=""
local small_fast_model=""