A simple Livebook for doing audio-to-text transcription using OpenAI's Whisper model.
This is an extremely simply identity provider module for Livebook when running Livebook behind a reverse proxy with forwarded authentication, such as when using Tailscale. For more information, see https://github.com/tailscale/tailscale/tree/main/cmd/nginx-auth and https://caddyserver.com/docs/caddyfile/directives/forward_auth#tailscale.
To use this, just stick webauth.exs
in /app/user/extensions
or, if using a Docker container for Livebook, stick it somewhere else and mount it into the Docker container via -v /path/to/webauth.exs:/app/user/extensions/webauth.exs:ro
. Then, just set LIVEBOOK_IDENTITY_PROVIDER=custom:Webauth
when running the Livebook server.
I had a very specific configuration I was trying to get working for personal usage. After a bunch of running in circles, this was the result. I figured I'd stick it somewhere public in case anyone else finds it useful.
Note that the following steps are intended as a rough outline. They are exact steps to replicate my setup, but your setup might differ depending on, for example, using an init system other than systemd or various other factors. Adjust as necessary.
- Run
docker volume create livebook-data
anddocker volume create livebook-config
. - Place the
livebook.service
file in$HOME/.config/systemd/user
. - Run
systemctl --user enable --now livebook.service
. - Place the
dev.livebook.Livebook.desktop
file in$HOME/.local/share/applications
. - Place the
dev.livebook.Livebook.svg
file in$HOME/.local/share/icons/hicolor/scalable/apps
.
func FormHandler[T any](f func(T) templ.Component) http.Handler { | |
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { | |
req.ParseForm() | |
var data T | |
d := formam.NewDecoder(nil) | |
d.Decode(req.Form, &data) | |
// TODO: Handle errors. | |
templ.Handler(f(data)).ServeHTTP(rw, req) |
This is a quick little program that gathers some info about Tailscale peers that isn't readily available from the usual CLI tools.
package main | |
import ( | |
"context" | |
"database/sql" | |
"fmt" | |
"log/slog" | |
"net" | |
"net/http" | |
"os" |
module test | |
go 1.22 |
To try this code, you can use the modified Go toolchain found at https://github.com/DeedleFake/go/tree/pipe-operator.