Skip to content

Instantly share code, notes, and snippets.

View cwahn's full-sized avatar

lighthouse cwahn

  • Ars Vivendi
  • Seoul, Republic of Korea
  • 08:08 (UTC +09:00)
View GitHub Profile
@cwahn
cwahn / agent.rs
Created July 12, 2025 14:32
A node with no-public language, but knows public node
use std::time::Duration;
use kameo::prelude::*;
use libp2p::{
Multiaddr, SwarmBuilder,
futures::{StreamExt, channel::oneshot},
swarm::SwarmEvent,
tcp,
};
use serde::{Deserialize, Serialize};
@cwahn
cwahn / kbn.rs
Created July 12, 2025 14:30
A node with public addresses mean to be spawned in pair
// Kademila Distributed Hash Table Bootstrap Node
use std::{sync::Arc, time::Duration};
use kameo::prelude::*;
use libp2p::{
Multiaddr, SwarmBuilder, futures::StreamExt, identity::ed25519, swarm::SwarmEvent, tcp,
};
use serde::{Deserialize, Serialize};
@cwahn
cwahn / traffic-light-example.cpp
Last active June 13, 2024 06:09
traffic-light-example
struct TrafficLight {
struct Red {};
struct Green {};
struct Yellow {};
using Context = Enum<Red, Green, Yellow>;
Context _context = Red{};
using I = Enum<Time::DelayFor, Time::Now>;