Skip to content

Instantly share code, notes, and snippets.

@paralin
paralin / buildroot-update-go.py
Created October 26, 2024 04:56
Buildroot update go python script
#!env python3
# buildroot-update-go.py
# by: Christian Stewart <[email protected]>
# license: MIT
import json
import sys
import requests
import re
@paralin
paralin / Go Git CLI Extensions
Last active July 13, 2024 20:34
git utilities written in Go
Copyright 2024 Christian Stewart <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH TH
@paralin
paralin / idbkeyrange_forprefix.js
Created May 20, 2024 02:54 — forked from inexorabletash/idbkeyrange_forprefix.js
Helper for creating an IDBKeyRange for all keys with a given prefix
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
// Basic p(r)olyfill for proposed feature
// This defines no successor of empty arrays, so the range for prefix
// [] or [[],[]] has no upper bound.
// An alternate definition would preclude adding additional nesting,
// so the range for prefix [] would have upper bound [[]] and the
// range for prefix [[], []] would have upper bound [[], [[]]].
@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 September 27, 2024 08:13
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"
)