Skip to content

Instantly share code, notes, and snippets.

View stoiandan's full-sized avatar

Stoian Dan stoiandan

  • Romania
View GitHub Profile
@stoiandan
stoiandan / calendar.lotr
Created February 20, 2026 15:05
macOS (Mac OS X) Lord of the Rings calendar — extracted from OS X 10.6.8 Snow Leopard
/*
* Lord Of The Rings
*
* $FreeBSD: src/usr.bin/calendar/calendars/calendar.lotr,v 1.2 2003/10/09 00:31:48 grog Exp $
*/
#ifndef _calendar_lotr_
#define _calendar_lotr_
01/05 Fellowship enters Moria
use std::net::SocketAddr;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpListener;
use tokio::select;
use tokio::sync::broadcast;
#[tokio::main]
async fn main() {
let listener = TcpListener::bind("localhost:7878").await.unwrap();
@stoiandan
stoiandan / experimental_multicast.rs
Created May 4, 2024 05:48
Experimental IPv6 multicast to link-local adresses
use std::net::{SocketAddrV6, UdpSocket};
use std::str::{self, FromStr};
use std::sync::mpsc;
use std::thread;
fn main() {
let multicast_socket =
SocketAddrV6::from_str("[ff02::1%1]:1234").expect("Can't parse multicast address");
let sender_socket = UdpSocket::bind("[::]:0").expect("Can't bind to local address");
@stoiandan
stoiandan / multicast.rs
Created May 4, 2024 05:31
Rust example of using IPv6 link-local multicast
use std::net::{ToSocketAddrs, UdpSocket};
use std::str;
use std::sync::mpsc;
use std::thread;
fn main() {
let multicast_socket = ("ff02::1%en0", 1234)
.to_socket_addrs()
.expect("Can't parse multicast socket address")
.next()