Skip to content

Instantly share code, notes, and snippets.

View li-zhixin's full-sized avatar

历知辛 li-zhixin

View GitHub Profile

Serverless Claude Code Instances with Persistent Compute

1. Problem

We need a way to give each Discord channel its own persistent "computer" running Claude Code CLI, where:

  • The computer survives across sessions (disk persists)
  • It wakes up fast when a user sends a message (< 10s, ideally < 5s)
  • It costs near-zero when idle
using System;
using System.Collections.Generic;
using System.Linq;
namespace MemTestPlain
{
class Program
{
static void Main(string[] args)
{
@pcolby
pcolby / cpu.sh
Created September 14, 2013 04:29
Calculating CPU Usage from /proc/stat
#!/bin/bash
# by Paul Colby (http://colby.id.au), no rights reserved ;)
PREV_TOTAL=0
PREV_IDLE=0
while true; do
CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
unset CPU[0] # Discard the "cpu" prefix.
IDLE=${CPU[4]} # Get the idle CPU time.