Skip to content

Instantly share code, notes, and snippets.

View Frando's full-sized avatar
💭
.

Franz Heinzmann Frando

💭
.
View GitHub Profile
@Frando
Frando / main.ts
Last active April 20, 2024 00:14
iroh fog discord bot prompt generator
// deployed via deno deploy (free plan) and call with
// https://posh-eel-46.deno.dev/?q=https://url.to/some-media.mp3
const image = "ghcr.io/ggerganov/whisper.cpp:main";
const model = "tiny"; // see https://github.com/ggerganov/whisper.cpp/blob/master/models/download-ggml-model.sh#L28
const maxDuration = 1000 * 10; // 10s
function build(url: string) {
const prepare = "mkdir /models";
const fetchModel =
@Frando
Frando / README.md
Last active March 11, 2024 17:31
Sync Outline groups from Keycloak via webhooks

Sync groups from Keycloak to Outline

Usage

Assuming you have a self-hosted Outline Wiki and Keycloak setup running, do the following:

  • Add the webhooks service to your docker-compose.yml
  • Save the server.ts to webhooks/server.ts (relative to your compose file)
  • Save webhooks.env into the same folder as your compose file
  • Via your webserver configuration add a subdomain, eg webhooks.wiki.yoursite.org to forward to your webhook service port 8000
@Frando
Frando / pagination-default.ts
Last active August 31, 2022 17:25
Postgraphile plugin to add a default for `first` argument for connection queries
import { makeWrapResolversPlugin } from 'graphile-utils'
import type { GraphQLField } from 'graphql'
const PaginationDefault = makeWrapResolversPlugin(
({ scope }) => {
if (scope.isPgFieldConnection) {
return { scope }
}
return null
},
@Frando
Frando / main.rs
Last active April 23, 2021 11:40
tuix tree builder
use tuix::*;
fn main() {
let props = WindowDescription::new().with_title("Sample app");
let app = Application::new(props, |state, root| {
App::default().build(state, root, |b| b);
});
app.run();
}
@Frando
Frando / docker-compose.yml
Last active April 2, 2021 10:20
Open Audio Search via Docker Compose
version: "3.9"
services:
backend:
image: "arsoxyz/oas:nightly"
ports:
- "8080:8080"
volumes:
- "./data/oas:/data"
environment:
syntax = "proto2";
package hrpc;
import "google/protobuf/descriptor.proto";
extend google.protobuf.ServiceOptions {
optional uint32 service = 50000;
}
extend google.protobuf.MethodOptions {

Rust is server

Listening on 127.0.0.1:8000
new connection from 127.0.0.1:52456
start handshaking
initiator: false
keypair public [160, 40, 198, 116, 22, 83, 78, 176, 233, 211, 154, 123, 37, 225, 135, 217, 143, 57, 220, 36, 141, 64, 202, 205, 154, 40, 249, 126, 1, 171, 64, 65] private [70, 92, 38, 45, 171, 60, 30, 169, 236, 96, 53, 30, 116, 242, 201, 22, 175, 223, 80, 0, 165, 119, 101, 25, 94, 101, 160, 229, 78, 174, 14, 64]
local pubkey: [a0, 28, c6, 74, 16, 53, 4e, b0, e9, d3, 9a, 7b, 25, e1, 87, d9, 8f, 39, dc, 24, 8d, 40, ca, cd, 9a, 28, f9, 7e, 1, ab, 40, 41]
local nonce: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
@Frando
Frando / hypercore-protocol in rust - demo.txt
Last active January 26, 2020 16:58
hypercore-protocol in rust - first steps
# in one terminal:
node hypercore-demo.js server 8080
# in another
git clone https://github.com/Frando/hypercore-protocol-rust-experiments
cargo run --example basic -- client 8080
# this will print:
recv: Open(Open { discovery_key: [184, 247, 61, 143, 233, 194, 150, 241, 106, 107, 132, 78, 106, 85, 102, 241, 250, 223, 3, 228, 39, 56, 171, 83, 111, 70, 25, 193, 212, 113, 39, 143], capability: None })
send 1 Open(Open { discovery_key: [184, 247, 61, 143, 233, 194, 150, 241, 106, 107, 132, 78, 106, 85, 102, 241, 250, 223, 3, 228, 39, 56, 171, 83, 111, 70, 25, 193, 212, 113, 39, 143], capability: None })
const tape = require('tape')
const { Kappa } = require('..')
const { runAll } = require('./lib/util')
tape.only('simple source', t => {
const kappa = new Kappa()
kappa.use('view1', makeSimpleSource(), makeSimpleView())
kappa.use('view2', makeSimpleSource(), makeSimpleView())
kappa.api.view1.source.push(1)
// This is an example for a sparse source for kappa5 pubsub
const Bitfield = require('bitfield-db')
const nanoiterator = require('nanoiterator')
const ram = require('random-access-memory')
module.exports = function createIndexer (handlers, opts) {
return new SparseIndexer(handlers, opts)
}