(through https://rustup.rs)
hyperfine --warmup=1 'cargo install -f ripgrep@14.1.0'
{ | |
config, | |
pkgs, | |
options, | |
... | |
}: let | |
hostname = "oatman-pc"; # to alllow per-machine config | |
in { | |
networking.hostName = hostname; |
(through https://rustup.rs)
hyperfine --warmup=1 'cargo install -f ripgrep@14.1.0'
#![allow(dead_code, unused_variables)] | |
fn main() {} | |
struct Machine<State> { | |
data: Vec<u16>, | |
state: State, | |
} | |
struct State1 {} | |
struct State2 {} |
use std::thread; | |
struct User { | |
age: u16, | |
} | |
fn simple_thread() { | |
let user = User { age: 30 }; | |
// thread::spawn(|| &user); // can't borrow `user` as thread may outlive current function | |
thread::spawn(|| user); // can only move into thread, then it's gone. |
head: 0atman:branch-name-with-your-changes assignee: 0atman base: local-branch-name-on-this-repo draft: true issue: linked issue url? reviewers:
#! blaze sh
One of the problems with tech documentation (api, installation instructions etc) is that they get stale. APIs change, software and plugins alter their interface and commands, and websites go away.
To solve this, I propose we write our documentation in a way that can be executed, or verified.
Luckily, I wrote blaze
to execute codeblocks inside of markdown, which means that with a little help from a few common unix tools, we can solve this problem.
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['<alt>1']" | |
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-2 "['<alt>2']" | |
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-3 "['<alt>3']" | |
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-4 "['<alt>4']" | |
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-1 "['<alt><shift>1']" | |
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-2 "['<alt><shift>2']" | |
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-3 "['<alt><shift>3']" | |
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-4 "['<alt><shift>4']" |
use std::fs; | |
use std::io::{self, BufRead, Write}; | |
use std::{thread, time}; | |
/// stdout readline implementation | |
fn wait() { | |
io::stdin().lock().lines().next(); | |
} | |
/// Type the script at 300wpm |
from functools import reduce | |
def thread(*args): | |
""" | |
Functional thread ->, inspired by clojure and https://stackoverflow.com/a/17122666/333294 | |
Toy example that only works for functions or airity 1 | |
""" | |
caller = lambda x, y: y(x) | |
return reduce(caller, args[1:], args[0]) |