At the beginning of a session:
- Read this file.
- Read
~/memory/active-projects.md. - Read the last few days of session logs in
~/memory/session-logs/ - Read the relevant project files for the current request.
| ─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ╌ ╍ ╎ ╏ | |
| ┌ ┍ ┎ ┏ ┐ ┑ ┒ ┓ | |
| └ ┕ ┖ ┗ ┘ ┙ ┚ ┛ | |
| ├ ┝ ┞ ┟ ┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ | |
| ┬ ┭ ┮ ┯ ┰ ┱ ┲ ┳ |
| ┏━━━┓ | |
| ┃ ┃ | |
| ┗━━━┛ | |
| ┏━┳━┳━┓ | |
| ┃ ┃ ┃ ┃ | |
| ┗━┻━┻━┛ | |
| ╭───╮ | |
| │ │ |
| #![feature(allocator_api)] | |
| use std::alloc::Allocator; | |
| use std::alloc::Global; | |
| use std::marker::PhantomData; | |
| // Basicaly a Vec. | |
| pub struct V<T, A: Allocator = Global> { | |
| pub buf: Rv<T, A>, | |
| pub len: usize, |
| use rand::Rng; | |
| use std::default::Default; | |
| use std::{cell::RefCell, collections::HashMap, time::Duration}; | |
| use tokio::{self, select, task, task_local, time::timeout}; | |
| fn rand_gen_millis() -> (u64, u64) { | |
| let mut rng = rand::thread_rng(); | |
| let t1 = rng.gen_range(0..10); | |
| let t2 = rng.gen_range(0..10); | |
| (t1, t2) |
| use tokio; | |
| use tokio::{task, task_local}; | |
| use std::cell::RefCell; | |
| use std::collections::HashMap; | |
| #[tokio::main] | |
| async fn main() { | |
| let handler = task::spawn(async { | |
| task_local! { | |
| pub static WRITER: RefCell<HashMap<String, i64>>; |
| // Rust Idiom: | |
| // prefixing a variable with an underscore | |
| // signals to others that the variable | |
| // isn't going to be used, not that it is | |
| // intentionally private or an updated | |
| // variable. | |
| main () { | |
| let x = 12; | |
| // _x reads as |
| // NB. fix | |
| // #[derive(Debug, Clone)] | |
| #[derive(Debug)] | |
| struct Context; | |
| fn dupe_context(context: &Context) -> Context { | |
| context.clone() | |
| } | |
| fn main() { |
| #[derive(Debug, Clone)] | |
| struct Resource(usize); | |
| #[derive(Debug)] | |
| struct Error; | |
| fn may_fail(ix: usize) -> Result<Resource, Error> { | |
| if rand::random::<f64>() < 0.5 { | |
| Err(Error) | |
| } else { |
| : {d1:=1} | |
| : {d2:=2} | |
| : {op:?"provide an operator for comparison"} | |
| lhs=date -j -f "%F" "$d1" +%s 2>/dev/null | |
| rhs=date -j -f "%F" "$d2" +%s 2>/dev/null | |
| case $op in | |
| "eq") | |
| [ lhs -eq rhs ] ;; | |
| "ge") |