Skip to content

Instantly share code, notes, and snippets.

View yoshuawuyts's full-sized avatar

Yosh yoshuawuyts

View GitHub Profile
@yoshuawuyts
yoshuawuyts / kqueue.rs
Created August 28, 2024 01:28 — forked from Noah-Kennedy/kqueue.rs
kqueue example
#![cfg(target_os = "macos")]
use rustix::event::kqueue;
use std::io::{Read, Write};
use std::net::{TcpListener, TcpStream};
use std::os::fd::AsRawFd;
use std::time::Duration;
fn main() {
// kickoff a simple echo server we can hit for demo purposes
#|
Written by Chuck in 2024
https://bogorad.github.io/
Based on the brilliant Miryoku_kmonad => Kinesis layout
https://github.com/manna-harbour/miryoku_kmonad
With enormous help from the author of Kanata
https://github.com/jtroo
@yoshuawuyts
yoshuawuyts / karabiner.json
Created July 14, 2024 15:44
This is the good modifier for Karabiner - use this as a "complex modification" - it makes the caps key work the way it should
{
"description": "Change caps_lock to left_control if pressed with other keys, change caps_lock to escape if pressed alone.",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]

CADR per person

Clean Air Delivery Rate per person - How much clean air do we need to feed into a room?

Location m3/hr/person
Dining 102
Gym 136
Classroom 68
Convention 102
//! This module handles the conversion from `Pollable` -> `Future`. We do this
//! by creating an equivalent implementation to the `polling` crate. Once
//! https://github.com/smol-rs/polling/issues/102 has been resolved, this module
//! will likely no longer be needed.
use slab::Slab;
use std::mem;
use wasi::io::poll::{poll, Pollable};
/// Waits for I/O events.

Concurrency vs Parallelism, in table form

Concurrency is a system-structuring mechanism, parallelism is a resource. (ref)

There's an important distinction between "parallelism" as a resource, and "parallel execution". The two are often confused, but they are in fact distinct. The key separator is "concurrency":

no parallelism has parallelism
no concurrency sequential execution sequential execution †
has concurrency concurrent execution ‡ parallel execution
use crate::headers::{HeaderName, HeaderValue, Headers, ToHeaderValues};
struct CustomHeader {}
impl CustomHeader {
/// Create a new instance of `CustomHeader`.
fn new() -> Self {
todo!();
}
PS C:\Users\yoshu\Code\rust> py ./x.py build
Updating only changed submodules
Submodules updated in 0.26 seconds
Blocking waiting for file lock on package cache
Blocking waiting for file lock on package cache
Finished dev [unoptimized + debuginfo] target(s) in 2.21s
Building stage0 std artifacts (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc)
Finished release [optimized] target(s) in 0.62s
Copying stage0 std from stage0 (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc / x86_64-pc-windows-msvc)
Building LLVM for x86_64-pc-windows-msvc
@yoshuawuyts
yoshuawuyts / tracing_log.rs
Created June 29, 2020 19:11 — forked from KodrAus/tracing_log.rs
Converting between `tracing` key values and `log` key values
use std::fmt;
use log::kv::{self, Source, value::{self, Fill}};
use tracing::{Value, Field, field::{self, Visit}};
#[doc(hidden)]
pub struct LogField<'kvs>(&'kvs Field, &'kvs dyn Value);
impl fmt::Debug for LogField<'_> {