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
# Based on Cygwin /etc/skel/.inputrc | |
# the following line is actually | |
# equivalent to "\C-?": delete-char | |
"\e[3~": delete-char | |
# VT | |
"\e[1~": beginning-of-line | |
"\e[4~": end-of-line |
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
# Detect the correct TERM value for new sessions. | |
# if-shell uses /bin/sh, so bashisms like [[ do not work. | |
if "[ $(tput colors) = 16777216 ]" { | |
set -g default-terminal "tmux-direct" | |
} { | |
if "[ $(tput colors) = 256 ]" { | |
set -g default-terminal "tmux-256color" | |
} { | |
set -g default-terminal "tmux" | |
} |
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
#!/usr/bin/env -S rust-script -t nightly | |
#![allow(dead_code)] | |
#![feature(unix_sigpipe)] | |
use std::io::Write; | |
fn title(t: &str) { | |
println!("{}\n{:-<2$}", t, "", t.len()) | |
} |
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
#!/usr/bin/env rust-script | |
//! ```cargo | |
//! [dependencies] | |
//! anyhow = "1" | |
//! libc = "0.2" | |
//! procfs = { version = "0.16", default-features = false } | |
//! ``` | |
use procfs::process::Process; |
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
#!/usr/bin/env -S rust-script -t nightly | |
#![feature(unix_sigpipe)] | |
use std::cmp::max; | |
const BASIC_COLORS: &[&str] = &[ | |
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", | |
]; | |
fn title(t: &str) { |
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
#!/usr/bin/env rust-script | |
//! ```cargo | |
//! [dependencies] | |
//! anyhow = "1" | |
//! libc = "0.2" | |
//! procfs = "0.16" | |
//! ``` | |
use procfs::process::Process; |
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
use std::collections::VecDeque; | |
use std::future::Future; | |
use std::pin::Pin; | |
use std::sync::atomic::AtomicUsize; | |
use std::sync::{Arc, Mutex}; | |
use std::task::{Context, Poll, Waker}; | |
struct State<T> { | |
queue: VecDeque<T>, | |
tx_count: usize, |
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
0eNq9XctuHUeS/ZWG1mYj3w9vZzW72Q8aA0q6tomhSA4fjTYa/ve5ktzNsliRdc4J6+4kUTwRGZWZERnPf757f/tyeni8uXt+9+M/3918uL97evfjf//z3dPNz3fXt5//7fnXh9O7H9/dPJ8+vfvh3d31p89/+3B//uFvP7y7uft4+se7H+NvPxz+ysPt9dPzzYer99ePm99Mv/3th3enu+eb55vTV8pf/vLr/9y9fHp/ejxD/xvgp/PvXz0/Xt89Pdw/Pl+9P90+n9Ef7p/Ov3t/95nuGe8qpvLX+sO7X8+/GeNf65nSx5vH04ev/6V85vMbAslBICAEMk2gcisoDgLQCurrR7x5OF0931/9/Hj/cvdxD/sz4ob5HbSmoUGcdgI7tCNOh4YGcTrZjxbIjxaDgwK07yJ9NgN5NmNyUMCk9Ho6T/94eDw9PV09PdzePD+ff7h7cn4HzxB4cdwtCaJQHWcfo/DH47oLmf66FcseSD8GyYcg4xgkHILMY5B4BJLCIUgchyDxGGQegqRjkHYIko9B+iFIOQYphyD1GKQeghzv2Hi4Y9Pxjo2HOzYNxxUMnc7kUSPQHZaD4wrGKHjUCCSlnN5c8mctfnr8qs2Ry7i8IfPDv63cu4eX53d7VL8x/CCS1Ufy+BBuFlX3d21mzL3NtV0MuKbB1W/X3/bAGYNvox3egKc98Nfj+/7+5nbfIthc9PvLnwhIXYOUgICkA5CoGd4FeoMAiigc7bySHbcZxmZxUKgQheq4zTAKzUEBk1L33pfdvrzuX56N26sM14Wp0ZzMBfK6wLa/g+vrQQVM8WDzvncf1dcDfHP3dHo03igbq7FBr/tE8LwBx3jODPggwQsD3knwyoA3Erxhn7KQn7IzPFeS58GAFxJ8YgLJnEAacx434BDPTVSoxt3RkkM3YdLIDs2BUSiUOyXYd/ceePWqpSHY1K25tJJEsjNm/DS2E+AuqYcgr8fywy+nTzcfrm+vHm6v757XjpP0xvd2FuL5zzdf1v10f3v |
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
0eNq9XctuHUeS/ZWG1qaR74cXs5kfmP2gMaCka5sYiuTwYbTR8L/PleRulqSKrHNOWHcnieKJyKjMjMh4/vPN29uX08Pjzd3zm5/++ebm3f3d05uf/vufb55ufrm7vv34b8+/P5ze/PTm5vn04c0Pb+6uP3z827v78w//+OHNzd370z/e/BT/+OHwVx5ur5+eb95dvb1+3Pxm+uPvP7w53T3fPN+cPlP+9Jff/+fu5cPb0+MZ+t8AP59//+r58fru6eH+8fnq7en2+Yz+cP90/t37u490z3hXMZUf6w9vfj//Zow/1jOl9zePp3ef/0v5yOdXBJKDQEAIZJpA5VZQHASgFdTXj3jzcLp6vr/65fH+5e79HvZHxA3zO2hNQ4M47QR2aEecDg0N4nSyHy2QHy0GBwVo30X6bAbybMbkoIBJ6fV0nv7x8Hh6erp6eri9eX4+/3D35PwJniHw4rhbEkShOs4+RuHL47oLmX7cimUPpB+D5EOQcQwSDkHmMUg8AknhECSOQ5B4DDIPQdIxSDsEyccg/RCkHIOUQ5B6DFIPQY53bDzcsel4x8bDHZuG4wqGTmfyqBHoDsvBcQVjFDxqBJJSTt9c8mctfnr8rM2Ry7h8Q+aHf1u5dw8vz2/2qH5l+EEkq4/k8SHcLKru79rMmHuba7sYcE2Dq1+vv+2BMwbfRjt8A572wF+P79v7m9t9i2Bz0e8vfyIgdQ1SAgKSDkCiZngX6A0CKKJwtPNKdtxmGJvFQaFCFKrjNsMoNAcFTErde192+/K6f3k2bq8yXBemRnMyF8jrAtv+Dq6vBxUwxYPN+959VF8P8M3d0+nReKNsrMYGve4TwfMGHOM5M+CDBC8MeCfBKwPeSPCGfcpCfsrO8FxJngcDXkjwiQkkcwJpzHncgEM8N1GhGndHSw7dhEkjOzQHRqFQ7pRg39174NWrloZgU7fm0koSyc6Y8dPYToC7pB6CvB7Ld7+ePty8u769eri9vnteO07SN763sxDPf775tO6n+9u |
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 imagehash(path: &Path) -> std::io::Result<Digest> { | |
let mut f = File::open(path)?; | |
let mut buffer = [0u8; 1024*1024]; | |
let mut context = Context::new(); | |
loop { | |
let read = f.read(&mut buffer)?; | |
if 0 == read { | |
return Ok(context.compute()); | |
} |
NewerOlder