Skip to content

Instantly share code, notes, and snippets.

View Frando's full-sized avatar
🐢
on parental leave, slow to respond

Franz Heinzmann Frando

🐢
on parental leave, slow to respond
View GitHub Profile
struct Item;
struct Foo { recv_wakers: VecDeque<GuardedWaker> }
impl Foo {
fn wake_recv(&mut self) {
while let Some(waker) = self.recv_wakers.pop_front() {
if waker.wake_if_alive() {
break;
}
}
}
@Frando
Frando / INFO.md
Last active July 12, 2024 09:05
Rust channel benchmark with many tasks
@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 August 19, 2024 10:04
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: