Skip to content

Instantly share code, notes, and snippets.

View julien-c's full-sized avatar
Real artists ship

Julien Chaumond julien-c

Real artists ship
View GitHub Profile
@julien-c
julien-c / hammer.py
Created June 4, 2026 08:54
hammer.py
#!/usr/bin/env python3
"""Traffic hammer + canary for reproducing llama-server output corruption.
Mimics the production traffic pattern that preceded the 2026-06-03 '/////'
corruption: small chats with a growing shared prefix (checkpoint restores),
long generations cancelled mid-stream, 4-way parallel bursts, slot swapping,
and >10s idle gaps (CUDA/HIP graph-cache eviction boundary).
After every round, a temperature-0 canary probe checks output sanity.
On canary failure the harness logs the round + action history and exits 42.
@julien-c
julien-c / llama-cpp.ts
Last active May 15, 2026 17:49
pi-mono extension: llama.cpp provider with dynamic model + context window discovery
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
import { Type } from "typebox";
import { Compile } from "typebox/compile";
const DEFAULT_BASE_URL = "http://localhost:8080/v1";
const PROPS_TIMEOUT_MS = 120_000;
const ModelsResponseSchema = Type.Object({
data: Type.Optional(
Type.Array(
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import { spawn } from "node:child_process";
import puppeteer, { Browser, BrowserContext, Page } from "puppeteer-core";
import { fileURLToPath } from "url";
import { dirname } from "path";
import { setTimeout } from "node:timers/promises";
const LIGHTPANDA_PORT = 9222;
Map(98) {
'unspecified' => 6519,
'unknown' => 230,
'cc-by-4.0' => 131,
'cc-by-sa-4.0' => 76,
'mit' => 73,
'apache-2.0' => 41,
'cc0-1.0' => 40,
'cc-by-nc-sa-4.0' => 36,
'cc-by-nc-4.0' => 21,
import os
import subprocess
from huggingface_hub.hf_api import HfApi
from huggingface_hub.repository import Repository
os.makedirs("./Helsinki-NLP/", exist_ok=True)
os.environ["GIT_LFS_SKIP_SMUDGE"] = "1"
# Important, to not download the large files
@julien-c
julien-c / ModelInfo.ts
Last active October 15, 2020 20:46
Model tag <=> pipeline type logic, for public reference
export class ModelInfo {
/**
* Key to config.json file.
*/
key: string;
etag: string;
lastModified: Date;
size: number;
modelId: ModelId;
author?: AuthorId;
@julien-c
julien-c / ec2instances.md
Created April 3, 2020 20:12
simple markdown table of AWS instance types with vCPU/RAM/price (us-east-1)
API Name Memory vCPUs Physical Processor Network Performance Linux On Demand cost Linux Reserved cost
a1.2xlarge 16.0 GiB 8 vCPUs AWS Graviton Processor Up to 10 Gigabit $148.92 monthly $93.80 monthly
a1.4xlarge 32.0 GiB 16 vCPUs AWS Graviton Processor Up to 10 Gigabit $297.84 monthly $187.61 monthly
a1.large 4.0 GiB 2 vCPUs AWS Graviton Processor Up to 10 Gigabit $37.23 monthly $23.43 monthly
a1.medium 2.0 GiB 1 vCPUs AWS Graviton Processor Up to 10 Gigabit $18.61 monthly $11.75 monthly
a1.metal 32.0 GiB 16 vCPUs AWS Graviton Processor Up to 10 Gigabit $297.84 monthly $187.61 monthly
a1.xlarge 8.0 GiB 4 vCPUs AWS Graviton Processor Up to 10 Gigabit $74.46 monthly $46.93 monthly
c1.medium 1.7 GiB 2 vCPUs Intel Xeon Family Moderate $94.90 monthly $66.43 monthly
import logging
from transformers.modeling_bart import BartForSequenceClassification
from transformers.pipelines import TextClassificationPipeline
from transformers.tokenization_bart import BartTokenizer
logging.basicConfig(level=logging.INFO)
To get it to work please follow the steps:
1) Create test user by toggling the Authorize test users for this app and grant permissions "manage_pages" and "page_messaging".
2) Use the Edit Button and get an access token for this user (using v2.6). Please save this for later.
3) Use edit button to login as the test user
4) After login, create page as the test user
5) Use the user access token for the test user to get the page access token for this user. You can do this with the following call:
~~~
https://graph.facebook.com/v2.6/me/accounts?access_token=<TEST_USER_ACCESS_TOKEN>
~~~
@julien-c
julien-c / spacy.py
Created August 30, 2017 15:50
Spacy NER
import spacy
nlp = spacy.load('en')
doc = nlp(text)
# At this point entity annotations are in `doc.ents`
for token in doc:
print tok.ent_iob_ + '-' + mapping[tok.ent_type_] # `I-PER`, etc.