Skip to content

Instantly share code, notes, and snippets.

View RandyMcMillan's full-sized avatar
🛰️
Those who know - do not speak of it.

@RandyMcMillan RandyMcMillan

🛰️
Those who know - do not speak of it.
View GitHub Profile
@RandyMcMillan
RandyMcMillan / pi_mantissa_hex.rs
Created March 14, 2025 17:43 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::f64;
use std::u8;
#[allow(dead_code)]
fn print_gnostr() {
let s = "gnostr";
for byte in s.as_bytes() {
print!("{:02X} ", byte);
}
set shell := ["sh", "-c"]
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
set allow-duplicate-recipes
set positional-arguments
set dotenv-load
set export
alias tmp := tmpdir
bt := '0'
@RandyMcMillan
RandyMcMillan / crossterm-lifecycle.rs
Last active March 12, 2025 23:16
crossterm-lifecycle.rs
// Cargo.toml
// [package]
// name = "crossterm-lifecycle"
// version = "0.1.0"
// edition = "2021"
//
// [dependencies]
// tokio = { version = "1.44.0", features = ["full"] }
// ratatui = "0.26"
// crossterm = "0.27"
@RandyMcMillan
RandyMcMillan / crossterm-lifecycle.rs
Last active March 12, 2025 21:20
crossterm-lifecycle.rs
// Cargo.toml
// [package]
// name = "crossterm-lifecycle"
// version = "0.1.0"
// edition = "2021"
//
// [dependencies]
// tokio = { version = "1.44.0", features = ["full"] }
// ratatui = "0.26"
// crossterm = "0.27"
@RandyMcMillan
RandyMcMillan / crossterm-lifecycle-with-args.rs
Created March 12, 2025 21:06
crossterm-lifecycle-with-args
// Cargo.toml
// [package]
// name = "crossterm-lifecycle"
// version = "0.1.0"
// edition = "2021"
//
// [dependencies]
// tokio = { version = "1.44.0", features = ["full"] }
// ratatui = "0.26"
// crossterm = "0.27"
@RandyMcMillan
RandyMcMillan / crossterm-lifecycle.rs
Created March 12, 2025 20:50
crossterm-lifecycle
// Cargo.toml
// [package]
// name = "crossterm-lifecycle"
// version = "0.1.0"
// edition = "2021"
//
// [dependencies]
// tokio = { version = "1.44.0", features = ["full"] }
// ratatui = "0.26"
// crossterm = "0.27"
@RandyMcMillan
RandyMcMillan / crossterm_lifecycle.rs
Last active March 12, 2025 19:49
crossterm_lifecycle
// Cargo.toml
// [package]
// name = "crossterm-lifecycle"
// version = "0.1.0"
// edition = "2021"
//
// [dependencies]
// tokio = { version = "1.44.0", features = ["full"] }
// ratatui = "0.26"
// crossterm = "0.27"
@RandyMcMillan
RandyMcMillan / tokio_async_command.rs
Last active March 12, 2025 17:58
tokio_async_command
// Cargo.toml
// [package]
// name = "tokio_async_command"
// version = "0.1.0"
// edition = "2021"
//
// [dependencies]
// tokio = { version = "1.44.0", features = ["full"] }
use tokio::io::{AsyncBufReadExt, BufReader};
@RandyMcMillan
RandyMcMillan / parse_env_args_count.rs
Last active March 12, 2025 19:50 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::env;
fn main() {
let mut args: Vec<String> = env::args().collect();
let mut verbose_count = 0;
let mut output_count = 0;
let mut output_files: Vec<String> = Vec::new();
// Simulating command-line arguments (for testing)
args.push("-v".to_string());
@RandyMcMillan
RandyMcMillan / parse_env_args.rs
Created March 12, 2025 13:07 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::env;
fn main() {
let mut args: Vec<String> = env::args().collect();
let mut verbose = false;
let mut output_file: Option<String> = None;
args.push("-v".to_string());
args.push("-o".to_string());
args.push("test.txt".to_string());
let mut i = 1; // Start from 1 to skip the executable path