Skip to content

Instantly share code, notes, and snippets.

View srenatus's full-sized avatar
🍉

Stephan Renatus srenatus

🍉
View GitHub Profile
@srenatus
srenatus / Caddyfile
Created April 15, 2024 10:06
use @styra/opa from a browser -- for experiments! It's not somethng you want to do in most cases. ⚠️ Run OPA on http://localhost:8181, and `caddy run --config Caddyfile`
:8000 {
handle_path /opa/* {
reverse_proxy http://localhost:8181
}
handle {
root * .
file_server
}
}
@srenatus
srenatus / deno.json
Last active April 15, 2024 09:14
example: use opa-typescript from deno -- run via `deno task dev`
{
"tasks": {
"dev": "deno run --allow-net --watch main.ts"
},
"imports": {
"opa": "https://esm.sh/@styra/opa@0.2.5"
}
}
@srenatus
srenatus / make.bb
Last active April 10, 2024 13:47
babashkba make helper, to be called as `make`
#!/usr/bin/env bb
(require '[babashka.fs :as :fs]
'[babashka.process :refer [shell]])
(def make "/usr/bin/make")
(defn find-root
([] (find-root (fs/cwd)))
([wd] (cond
(fs/exists? (fs/path wd "Makefile")) {:dir wd}
const events = await db.sql`select
    created_at,
    last_updated_at,
  from events
`;
const stackPeriod = () => {
@srenatus
srenatus / query.md
Created March 4, 2024 10:54
custom SQL query page for Observable Framework + DuckDB

Custom Queries

const db = await DuckDBClient.of({
  table_one: FileAttachment("data/table_ond.parquet"),
  table_two: FileAttachment("data/table_two.parquet"),
});
diff --git a/topdown/arithmetic.go b/topdown/arithmetic.go
index c75f816a4..b0061074f 100644
--- a/topdown/arithmetic.go
+++ b/topdown/arithmetic.go
@@ -6,6 +6,7 @@ package topdown
import (
"math/big"
+ "strconv"
package ms bytes allocs
internal/bytealg 0.002 0 0
runtime 0.097 0 0
errors 0.007 0 0
math 0.002 0 0
strconv 0.006 32 2
sync 0.003 16 1
unicode 0.096 12456 11
reflect 0.002 0 0
io 0.002 144 9
{:deps {djblue/portal {:mvn/version "0.37.1"}}}
@srenatus
srenatus / README.md
Created October 31, 2022 19:14
opa wasm example
  1. put example_main.go in example/main.go in an OPA checkout
  2. compile via Go: GOOS=js GOARCH=wasm go build -o example.wasm ./example/
  3. Use with wasm_exec.js, and some index.html
  4. call opa.parse("package foo") in the browser's dev tools console
@srenatus
srenatus / gist:cca8e0ad152c879bf2332ee933a7c5fe
Created October 26, 2022 11:59
words with "opa" in them, sorted by length (`awk '/opa/{ print length, $0 }' /usr/share/dict/words | sort -n -s | cut -d" " -f2-`)
copa
dopa
opah
opal
chopa
copal
Mopan
nopal
oopak
popal