Skip to content

Instantly share code, notes, and snippets.

Yoshua Wuyts yoshuawuyts

Block or report user

Report or block yoshuawuyts

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yoshuawuyts
yoshuawuyts / arch-linux-install.md
Created May 19, 2019 — forked from jamesmunns/arch-linux-install.md
Minimal instructions for installing arch linux on an UEFI NVMe system with full system encryption using dm-crypt and luks
View arch-linux-install.md
View std-features-lacking.rs
// required
let listener = TcpListener::bind((args.address.as_str(), args.port))?;
// what we want to be able to do
let listener = TcpListener::bind((&args.address, args.port))?;
View migrate-futures.sh
#!/bin/bash
set +ex
fr() {
rg -l "$1" | xargs sed -i "s/$1/$2/g"
}
# setup
fr 'atomic_waker' 'atomic_cx'
View udp-echo.js
#!/usr/local/bin/node
let dgram = require('dgram')
let socket = dgram.createSocket('udp4', (msg, rinfo) => {
let peer = `${rinfo.address}:${rinfo.port}`
socket.send(msg, peer, (err) => {
if (err) peer.close()
console.log(`Sent ${rinfo.size} of ${rinfo.size} bytes to ${peer}`)
})
View quote-problems.md

Current

error: only the main function can be tagged with #[foob]
  --> tests/hello.rs:45:1
   |
45 | fn hello() {
   | ^^
error: aborting due to previous error
error: Could not compile `runtime`.
To learn more, run the command again with --verbose.                                                                                                                   [runtime:1]
View tide-improvements.rs
let config = Config::from_args();
let mut app = tide::App::new(())
.address(config.address)
.port(config.port);
app.at("/").get(reply);
app.serve();
View current.rs
fn main() -> io::Result<()> {
executor::block_on(async {
let listener = TcpListener::bind(&"127.0.0.1:7878".parse().unwrap())?;
let mut incoming = listener.incoming();
while let Some(stream) = await!(incoming.next()) {
let stream = stream?;
let addr = stream.peer_addr()?;
juliex::spawn(async move {
let (mut reader, mut writer) = stream.split();
View bbox.rs
#[derive(StructOpt, PartialEq, Debug)]
pub struct Cli {
bbox_1: u32,
bbox_2: u32,
bbox_3: u32,
bbox_4: u32,
}
fn main () {
let args = Cli::from_args();
View 2018-11-01-duplex-connection-ergonomics.md

Layering RPC over duplex connections

This is just a thing I've been thinking about for a while, and I'm not sure what the best structure is here. I'd be keen to hear more about examples, literature, and experiences on how people have approached this. I feel it's an important thing to start thinking about early when talking about networking, especially with HTTP/2 & HTTP/3 on the horizon.

Background

Traditional HTTP servers can be expressed as asynchronous transform functions:

View current.rs
use wasm_bindgen::prelude::Closure;
use wasm_bindgen::JsCast;
use web_sys::{Document, EventTarget};
let document = Document::new().map_err(|_| ErrorKind::Document)?;
let target: EventTarget = document.into();
let cb = Closure::wrap(Box::new(move || {
println!("hello world from WASM");
}) as Box<Fn()>);
You can’t perform that action at this time.