Skip to content

Instantly share code, notes, and snippets.

View Frando's full-sized avatar
💭
.

Franz Heinzmann Frando

💭
.
View GitHub Profile
@Frando
Frando / STDOUT
Last active June 29, 2024 17:11
iroh-net local accept&connect loop
round 0: bind 3ms | addr 370ms | conn 194ms
round 1: bind 8ms | addr 348ms | conn 8ms
round 2: bind 5ms | addr 342ms | conn 8ms
round 3: bind 7ms | addr 360ms | conn 5ms
round 4: bind 4ms | addr 349ms | conn 8ms
round 5: bind 15ms | addr 356ms | conn 3ms
round 6: bind 5ms | addr 365ms | conn 8ms
round 7: bind 13ms | addr 340ms | conn 8ms
round 8: bind 11ms | addr 346ms | conn 8ms
round 9: bind 6ms | addr 336ms | conn 201ms
// Exploration how we will expose willow in iroh.
// No client API exists atm in the willow branch. This is a design sketch.
// Willow adds more complexity especially around capabilities.
// I will first write a "full power" version, and then try to simplify it for common use cases.
let node = Node::memory().spawn().await?;
// We create an author. This could stay roughly the same as currently.
// Note that in iroh-willow, what we call an author is called a user.
@Frando
Frando / main-sync.rs
Last active May 16, 2024 15:06 — forked from dignifiedquire/main-sync.rs
quick-start-rust-iroh
use anyhow::Result;
use futures_lite::stream::StreamExt;
use iroh::{
base::node_addr::AddrInfoOptions,
client::docs::{LiveEvent, ShareMode},
docs::{store::Query, DocTicket},
node::MemNode,
};
#[tokio::main]
@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 May 23, 2024 11:47
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]