This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![feature(trace_macros)] | |
| #![feature(log_syntax)] | |
| // Rule of thumb | |
| // - write macro rules from most-specific to least-specific. | |
| // - Write macros at the top of your module. | |
| // To remember: | |
| // - Once the parser begins consuming tokens for a capture, it cannot stop or backtrack. | |
| // - Substitution is not token-based. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| for f in *mkv; do | |
| source="$f" | |
| target=$(echo "$f" | sed -r 's/Modern Family S([[:digit:]]+)E([[:digit:]]+)[^.]*.mkv/Modern Family S\1E\2.mkv/') | |
| echo "$source => $target" | |
| mv "$source" "$target" | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE BangPatterns #-} | |
| module Main where | |
| import Data.Void | |
| -- We still need to pattern-match against Left because | |
| -- laziness allows that branch to still be valid even if Void is unhabited | |
| -- i.e. it could still be populated by bottom values. | |
| f :: Either Void Int -> Int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE DerivingVia #-} | |
| {-# LANGUAGE PolyKinds #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE RebindableSyntax #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| module IxMonad where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "backcolor": "#ffffff", | |
| "name": "keyboard.io Model 01 - james's layout, based on algernon's Dvorak version", | |
| "author": "James Cash <james.cash@occasionallycogent.com>", | |
| "switchMount": "alps", | |
| "switchBrand": "matias", | |
| "switchType": "PG155B01", | |
| "pcb": false, | |
| "plate": true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::collections::BTreeMap; | |
| trait ToValue { | |
| fn to_value(self) -> Value; | |
| } | |
| impl ToValue for bool { | |
| fn to_value(self) -> Value { | |
| Value::Bool(self) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use futures::{stream::FuturesUnordered, StreamExt}; | |
| async fn do_something(i: u8) -> String { | |
| format! {"Future {i:#b}"} | |
| } | |
| #[tokio::main] | |
| async fn main() { | |
| let v = std::sync::Arc::new(tokio::sync::Mutex::new(vec![])); | |
| (0..100) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //! https://doc.rust-lang.org/std/panic/fn.catch_unwind.html | |
| use std::panic::UnwindSafe; | |
| use rand::random; | |
| struct Boxed<'a, T> { | |
| inner: &'a mut [T], | |
| } | |
| impl<'a, T> UnwindSafe for Boxed<'a, T> {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::error::Error; | |
| struct WindowsMut<'t, T> { | |
| slice: &'t mut [T], | |
| start: usize, | |
| window_size: usize, | |
| } | |
| trait LendingIterator { | |
| type Item<'a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{ | |
| error::Error, | |
| fs::File, | |
| io::{self, BufRead}, | |
| }; | |
| use clap::{ArgGroup, Parser}; | |
| #[derive(Parser, Debug)] | |
| #[command(author, version, about, long_about = None)] |
NewerOlder