Skip to content

Instantly share code, notes, and snippets.

@paralin
paralin / aider-coder.md
Created May 4, 2024 19:47
aider coder overview

Classes:

  1. MissingAPIKeyError: Inherits from ValueError. Represents an error when the API key is missing.
  2. ExhaustedContextWindow: Inherits from Exception. Represents an error when the context window is exhausted.
  3. Coder: The main class representing the Coder functionality.

Functions:

  1. wrap_fence(name): Returns a tuple of opening and closing fence tags for the given name.
  2. Coder.create(...): A class method to create an instance of the Coder class based on the provided parameters.
  3. Coder.__init__(...): The constructor method for the Coder class, initializing various attributes.
  4. Coder.show_announcements(): Displays announcement messages.
@paralin
paralin / minimize-go-wasm-size.md
Last active April 12, 2024 02:08
Minimizing Go wasm binaries size: a multi-pronged approach

My approach to smaller Go wasm binaries:

  • protoc-gen-go-lite: Removes dependency on reflection, making your binaries lighter.
  • goweight: Analyze the size of your binaries. This is a fork with added wasm support.
  • goda: Use to find why something is imported by executing:
    goda graph "reach(.:all, gonum.org/v1/gonum/mat)" | dot -Tsvg -o graph.svg
    
  • wasm-opt: Optimize wasm binaries for size with the command:
@paralin
paralin / lima.yaml
Created March 19, 2024 19:14
debian sid lima config
images:
- location: "https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-genericcloud-arm64-daily.qcow2"
arch: "aarch64"
mounts:
- location: "~"
- location: "/tmp/lima"
writable: true
mountType: virtiofs
vmType: vz
@paralin
paralin / x2x-on-macos.md
Created December 27, 2023 22:56
x2x on MacOS

X2X on MacOS

It works! Sort of.

Using X2X from MacOS

  1. Install XQuartz
  2. Set up your Linux host with X11, x2x, and a SSH server.
  3. Add your host to ~/.ssh/config so you can use ssh myhost to connect.
  4. Open XQuartz. Select in the top menu: Applications -> Terminal
@paralin
paralin / idb-prefix.ts
Created October 4, 2023 01:02
IndexedDB filter by prefix
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
// https://gist.github.com/inexorabletash/5462871
// https://github.com/w3c/IndexedDB/issues/47
// IDBKeyRangeWithPrefix returns an IDBKeyRange from the given prefix.
//
// Basic p(r)olyfill for proposed feature
//
// This defines no successor of empty arrays, so the range for prefix
@paralin
paralin / gist:d4acde4dae926d62fc56169be3cb27f4
Created August 23, 2023 22:00
llama.cpp docker cublas make it go fast
docker rm -f rocm
sudo docker run -d \
--name=rocm \
--privileged \
-v /dev:/dev \
-v /mnt/persist/work/rocm:/home/rocm-user \
--security-opt seccomp=unconfined \
--group-add video \
rocm/rocm-terminal \
bash -c "sleep infinity"
@paralin
paralin / main.go
Created August 23, 2023 16:45
esbuild resolve api
package main
import (
"fmt"
"os"
"strconv"
"github.com/evanw/esbuild/pkg/api"
)
@paralin
paralin / PROMPT.txt
Created August 10, 2023 19:02
TheBloke LLM Tests with Llama.cpp
Read the following article:
Get ready for Megan Fox, the poet. The debut poetry collection by the "Jennifer’s Body" actress titled "Pretty Boys are Poisonous," is set for release in November. Gallery Books, a division of Simon & Schuster, will publish. According to the official synopsis, Fox "shows fans her wicked humor through a heartbreaking and dark collection of poetry. Over the course of 80+ poems Fox chronicles all the ways in which we fit ourselves into the shape of the ones we love, even if it means losing ourselves in the process." In a statement Fox said, "These poems were written in an attempt to excise the illness that had taken root in me because of my silence. I’ve spent my entire life keeping the secrets of men, my body aches from carrying the weight of their sins. She continued, "My freedom lives in these pages, and I hope that my words can inspire others to take back their happiness and their identity by using their voice to illuminate what’s been buried, but not forgotten, in the darkness."
@paralin
paralin / llama-metal.sh
Last active October 27, 2023 22:03
Run llama2 on Metal on MacOS with GGML
#!/bin/bash
set -x
if [ -z "$LLM_PROMPT" ]; then
echo "Please set the LLM_PROMPT environment variable."
echo "export LLM_PROMPT=\"Who is JFK?\""
echo "./llama-metal.sh"
exit 1
fi
@paralin
paralin / notify-discord.py
Created July 4, 2023 01:49
motion eye discord hook
import os
import glob
import json
import argparse
import requests
class MotionEyeDiscordWebHook:
def __init__(self, args):
self.args = args