Skip to content

Instantly share code, notes, and snippets.

@zigforge
zigforge / agent.py
Created July 31, 2025 03:12 — forked from leerob/agent.py
agent.py
import os
import json
import subprocess
from anthropic import Anthropic
# Tool definitions
TOOLS = [
{
"name": "list_files",
"description": "List files and directories at a given path",
@zigforge
zigforge / WorkerQueue.ts
Created December 9, 2024 14:58 — forked from yonathan06/WorkerQueue.ts
WorkerQueue.ts (54 lines lightweight typescript worker queue)
interface QueueItem<T, R> {
task: T;
resolve: (result: R) => void;
reject: (error: Error) => void;
}
type Worker<T, R> = (task: T) => Promise<R>;
export class WorkerQueue<T, R> {
queue: QueueItem<T, R>[];
import { Client } from "@upstash/qstash"
import { NextRequest } from "next/server"
const baseUrl = process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL
? `https://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`
: "http://localhost:3000"
interface Step<I> {
create: <O>(action: (prevResult: Awaited<I>) => O) => Step<O>
finally: (action: (prevResult: Awaited<I>) => any) => any
@zigforge
zigforge / README.md
Created November 14, 2024 16:04 — forked from cld4h/README.md
Bypass the GFW; clash fake-ip and tproxy; iptables and transparent proxy on Linux; 在Linux上通过 iptables 以及 clash 配置透明代理用于本机及局域网翻墙网关; Linux 翻墙路由器配置

This article show you the ultimate way to set up a transparent proxy on Linux using clash and iptables to bypass the GFW in China.

We use:

You can go to github gist to download all files mentioned in this article.

@zigforge
zigforge / hls.sh
Created November 9, 2024 00:29 — forked from stenuto/hls.sh
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
@zigforge
zigforge / 00_install_fbsd_14_1_hetzner.md
Created October 11, 2024 12:55 — forked from ctsrc/00_install_fbsd_14_1_hetzner.md
Install FreeBSD 14.1 on Hetzner

Install FreeBSD 14.1 on Hetzner server

Hetzner no longer offers direct install of FreeBSD, but we can do it ourselves. Here is how :)

Boot the server into rescue mode

Boot the Hetzner server in Hetzner Debian based rescue mode. ssh into it.

The Hetzner rescue image will tell you hardware details about the server in the login banner. For example, with one of my servers I see:

@zigforge
zigforge / app.py
Created September 21, 2024 06:13 — forked from nicekate/app.py
这是用pixtral streamit应用,记得先在本地添加一个.env的文档,将你的API key放在里面。
import os
import base64
import streamlit as st
from mistralai import Mistral
from PIL import Image
import io
from dotenv import load_dotenv
# 加载 .env 文件
load_dotenv()
@zigforge
zigforge / t14.py
Created September 18, 2024 23:32 — forked from sachnaror/t14.py
Create a zero-downtime deployment script for a Django project with multiple websites (each as a separate app) hosted on an Ubuntu server, passing through GitHub Actions and using MySQL on a separate database server.
# Zero-downtime deployment script for a Django project with multiple websites (each as a separate app)
#hosted on an Ubuntu server, passing through GitHub Actions and using MySQL on a separate database server,
#follow these steps. This process ensures that updates are deployed without downtime.
#!/bin/bash
# Set the directory path
directory="/Users/homesachin/Desktop/zoneone/practice"
@zigforge
zigforge / Bind9-caching.md
Created September 5, 2024 16:17 — forked from mrpeardotnet/Bind9-caching.md
Configure BIND9 as caching nameserver

Install and configure BIND9 as caching DNS nameserver [Debian/Ubuntu]

This tutorial shows how to set-up and configure BIND9 as domain name server (DNS) in caching mode on Debian/Ubuntu based Linux system.

Instalation

sudo apt-get install bind9

BIND configuration

@zigforge
zigforge / dps_sup_nodes.md
Created August 29, 2024 13:13 — forked from VictorTaelin/dps_sup_nodes.md
Accelerating Discrete Program Search with SUP Nodes

Accelerating Discrete Program Search

I am investigating how to use Bend (a parallel language) to accelerate Symbolic AI; in special, Discrete Program Search. Basically, think of it as an alternative to LLMs, GPTs, NNs, that is also capable of generating code, but by entirely different means. This kind of approach was never scaled with mass compute before - it wasn't possible! - but Bend changes this. So, my idea was to do it, and see where it goes.

Now, while I was implementing some candidate algorithms on Bend, I realized that, rather than mass parallelism, I could use an entirely different mechanism to speed things up: SUP Nodes. Basically, it is a feature that Bend inherited from its underlying model ("Interaction Combinators") that, in simple terms, allows us to combine multiple functions into a single superposed one, and apply them all to an argument "at the same time". In short, it allows us to call N functions at a fraction of the expected cost. Or, in simple terms: why parallelize when we can sha