Skip to content

Instantly share code, notes, and snippets.

@pims
pims / vectorsearch.html
Created October 10, 2024 13:34 — forked from raidendotai/vectorsearch.html
In-browser, local vector similarity search, powered by pglite
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Semantic Search Demo</title>
<link
href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css"
rel="stylesheet"
/>
# copied from https://github.com/Ajnasz/sekret.link/blob/441806f29fce8a6dbbcfff22a93c3e8d52d12962/hurl/createdelete.hurl
# Create a new entry
POST {{api_host}}/api/
content-type: application/json
{
"name": "John Doe",
"email": "john.do@acheron.space"
}
@pims
pims / envoy.yaml
Created January 24, 2024 20:48
envoy stats
stats_config:
stats_matcher:
exclusion_list:
patterns:
- suffix: upstream_cx_length_ms #statsd format
histogram_bucket_settings:
- match:
suffix: upstream_rq_time
# defaul buckets with 600000,1800000,3600000 dropped
buckets: [0.5,1,5,10,25,50,100,250,500,1000,2500,5000,10000,30000,60000,300000]
@pims
pims / app.py
Last active June 9, 2024 22:58
Example of running a python script via python-wasi using the wasmtime wasm runtime
print("hello from a python script")
[
"abogado",
"ac",
"academy",
"accountant",
"accountants",
"actor",
"ad",
"adult",
"ae",
@pims
pims / hello.ts
Last active March 29, 2021 20:48
function handleRequest(request) {
const NAME = "experiment-0"
// The Responses below are placeholders. You can set up a custom path for each test (e.g. /control/somepath ).
const TEST_RESPONSE = new Response("Test group") // e.g. await fetch("/test/sompath", request)
const CONTROL_RESPONSE = new Response("Control group") // e.g. await fetch("/control/sompath", request)
// Determine which group this requester is in.
const cookie = request.headers.get("cookie")
if (cookie && cookie.includes(`${NAME}=control`)) {
import kopf
import kubernetes
import yaml
@kopf.on.create('zalando.org', 'v1', 'databases')
def create_fn(body, spec, **kwargs):
# Get info from Database object
name = body['metadata']['name']
namespace = body['metadata']['namespace']
type = spec['type']
@pims
pims / http.go
Created December 13, 2019 21:45
var httpClient = &http.Client{
Timeout: defaultHTTPTimeout,
// There is a bug in Go's HTTP/2 implementation that occasionally causes it
// to send an empty body when it receives a `GOAWAY` message from a server:
//
// https://github.com/golang/go/issues/32441
//
// This is particularly problematic for this library because the empty body
// results in no parameters being sent, which usually results in a 400,
@pims
pims / itunes.log
Created August 29, 2017 05:39
Blank page for iTunes store.
Aug 28 21:34:01 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 21-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:02 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 37-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:02 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 43-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:02 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 51-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:04 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 10-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:07 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 78-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:09 home-2 com.apple.usbmuxd[103]: error MuxTCPS
// Copyright 2015 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import (
"flag"