This file contains 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
pub fn catenary(start: Pos2, end: Pos2, h: f32, m: f32, n: usize) -> impl Iterator<Item = Pos2> { | |
fn find_t0(k: f32, c: f32) -> f32 { | |
if c == 0.0 { | |
return 0.5; | |
} | |
let a = k.cosh(); | |
let b = k.sinh(); | |
let d = 1.0 - (a - b); |
This file contains 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
import subprocess | |
import sys | |
files = sys.argv[1:] | |
probe_args = [ | |
"-v", | |
"error", | |
"-select_streams", | |
"v:0", |
This file contains 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
class Ast(): | |
kind: str | |
def __repr__(self): | |
return f"{self.kind}: {self.child()}" | |
class BinOp(Ast): | |
def __init__(self, lhs, op, rhs): | |
self.kind = "binop" |
This file contains 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
fn main() { | |
use std::sync::mpsc; | |
let handles: Vec<(std::thread::JoinHandle<()>, mpsc::Sender<()>)> = (0..2) | |
.map(|_| { | |
let (tx, rx) = mpsc::channel::<()>(); | |
( | |
std::thread::spawn(move || loop { | |
let work = rx.recv().unwrap(); | |
work | |
}), |
This file contains 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
class ConfigParam(): | |
def __init__(self, param_name, param_type, default): | |
self.param_name = param_name | |
# get parameter from config | |
_param = param_from_config() | |
if param_type: | |
# cast it to required type | |
self.value = asWhateverType(_param) |