Skip to content

Instantly share code, notes, and snippets.

View ugovaretto's full-sized avatar

Ugo Varetto ugovaretto

View GitHub Profile
@ugovaretto
ugovaretto / nerdfonts.js
Last active October 7, 2026 08:51
Show nerdfonts in Deepseek Harness web terminal using Tampermonkey scriot
// Tampermonkey scriot: USE EXISTING HEADER, REMOVE THIS HEADER AND ONLY COPY THE CODE AFTER 'user strict'
// ==UserScript==
// @name DeepSeek Local Nerd Font Canvas Enforcer
// @match *://*:3080/*
// @run-at document-start
// @grant none
// ==UserScript==
(function() {
'use strict';
@ugovaretto
ugovaretto / APPEND_SYSTEM.md
Last active July 25, 2026 15:11
Pi coding agent append to system prompt

MANDATORY RULES

  • Do not use XML tags like <tool_call> or <function> or any XML tag at all.
  • You must respond strictly using standard OpenAI JSON tool calling syntax.
  • If you need to call a tool, output a JSON object matching this schema: {"name": "tool_name", "arguments": {"arg1": "value", "arg2":"value",...,"argN":"value"}}.
  • Stick to the plan, do not go off and do things which are not related to the current task.
  • Follow user instructions e.g. if the user asks you to load a skill just load, undersrand and memorize the skill DO NOT USE IT until it's required.
  • You can only access resources in the current directory; you are not allowed to access resources outside the current directory.
  • Always think before making any chage to the code.
  • Create a mental sandbox to simulate the impact of the chages you make before making them.
@ugovaretto
ugovaretto / remote-proxy.sh
Created July 22, 2026 08:40
Reverse proxy from compute node to remote client
ssh -J <username>@<remote-cluster-login-address> -R 7777:localhost:7777 <username>@<compute-node name e.g. nid20080> -N
# uv venv
# uv pip install gguf
# uv run gguf-jinja-dump.py <gguf ..0001 file>
from gguf import GGUFReader
import sys
def get_jinja_template(file_path):
reader = GGUFReader(file_path)
# The key is standard for tokenizer chat templates
@ugovaretto
ugovaretto / concurrent.py
Created January 29, 2026 07:54
concurrent python async vs sync vs multithreading
import asyncio
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
import sys
async def do_async_work(task_id: int, duration: float = 0.1) -> str:
await asyncio.sleep(duration)
return f"Task {task_id} completed"
async def run_asyncio(tasks: int=5):
@ugovaretto
ugovaretto / crush.json
Created December 18, 2025 09:22
Crush AI configuration
{
"$schema": "https://charm.land/crush.json",
"mcp": {
"websearch-fetch-mcp": {
"type": "stdio",
"command": "uv",
"args": [
"run",
"--with", "fastmcp",
"--with", "requests",
@ugovaretto
ugovaretto / bash-ai.py
Created December 15, 2025 16:16
Use AI to generate system commands
#!/usr/bin/env python3
import os
import sys
import requests
import json
import argparse
def generate_bash_command(prompt):
api_key = os.getenv('BASH_AI_KEY')
api_url = os.getenv('BASH_URL_KEY', "http://localhost:11434/v1/chat/completions")
@ugovaretto
ugovaretto / extract-links.py
Created December 2, 2025 11:01
Headless Selenium for webscraping
@ugovaretto
ugovaretto / config.yml
Created November 14, 2025 13:33
llama-swap configuration
# llama-swap configuration
models:
VibeThinker-1.5B:
cmd: llama-server --port ${PORT} -c 0 --model /home/ugo/.cache/llama.cpp/VibeThinker-1.5B.f16.gguf -ngl 99
Aquif-3.5-Max-42B-A3B:
cmd: >
llama-server --port ${PORT}
--model /home/ugo/.cache/llama.cpp/unsloth-aquif-3.5-Max-42B-A3B-GGUF/aquif-3.5-Max-42B-A3B-UD-Q6_K_XL.gguf -ngl 99 -fa on
Aquif-3.5-Max-42B-A3B-Coding-Q6_K_XL-KVQ8:
cmd: >
@ugovaretto
ugovaretto / hf-dload-llamacpp.sh
Created November 9, 2025 07:45
download from huggingface into llama.cpp directory
#!/usr/bin/env bash
hf download $1 --local-dir "$HOME/.cache/llama.cpp/$1/$2" --include="*$2.gguf"