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

Caveat Emptor

I (instagibbs) was asked to draft a statement, I feel this is a fair summation of the project's direction. I might be wrong

Retiring the 80-Byte OP_RETURN Limit

Bitcoin Core’s next release will, by default, relay and mine transactions whose OP_RETURN outputs exceed 80 bytes and allow any number of these outputs. The long-standing cap, originally a gentle signal that block space should be used sparingly for non-consensus data has outlived its utility.

@RandyMcMillan
RandyMcMillan / usize_overflow.rs
Created April 12, 2025 15:07 — forked from rust-play/playground.rs
Code shared from the Rust Playground
fn main() {
let max_usize = std::usize::MAX;
println!("std::usize::MAX/2: {}", std::usize::MAX / 2);
if !is_debug() {
let overflow_release = max_usize.wrapping_add(1);
println!("Overflow: {}", overflow_release); // Output in release: 0
} else {
#[warn(arithmetic_overflow)]
#[cfg(debug_assertions)]
@RandyMcMillan
RandyMcMillan / print_cargo_toml.rs
Created April 3, 2025 12:10 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::env;
fn env_vars() {
// Iterate over all environment variables.
for (key, value) in env::vars() {
println!("{}: {}", key, value);
}
// You can also filter the environment variables.
println!("\nFiltered environment variables:");
@RandyMcMillan
RandyMcMillan / env_var_loop.rs
Last active April 3, 2025 12:02 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::env;
fn env_vars() {
// Iterate over all environment variables.
for (key, value) in env::vars() {
println!("{}: {}", key, value);
}
// You can also filter the environment variables.
println!("\nFiltered environment variables:");
@RandyMcMillan
RandyMcMillan / empty_playground.rs
Created March 31, 2025 12:07 — forked from rust-play/playground.rs
Code shared from the Rust Playground
//
@RandyMcMillan
RandyMcMillan / self_bytes.rs
Created March 31, 2025 12:04 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::str;
fn main() {
let self_bytes: &[u8] = include_bytes!("main.rs");
match str::from_utf8(self_bytes) {
Ok(s) => println!("{}", s),
Err(e) => println!("Error: {}", e),
}
}
@RandyMcMillan
RandyMcMillan / install_nvm.rs
Created March 31, 2025 11:35 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::env;
//use std::env::consts::OS;
use std::fs;
use std::path::Path;
use std::process::{Command, Stdio};
use std::str;
fn nvm_has(command: &str) -> bool {
Command::new("type")
.arg(command)
@RandyMcMillan
RandyMcMillan / global_rt.rs
Created March 26, 2025 04:04 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use once_cell::sync::OnceCell;
// global_rt
pub fn global_rt() -> &'static tokio::runtime::Runtime {
static RT: OnceCell<tokio::runtime::Runtime> = OnceCell::new();
RT.get_or_init(|| tokio::runtime::Runtime::new().unwrap())
}
#[cfg(test)]
mod tests {
@RandyMcMillan
RandyMcMillan / psuedo_rand_bloch_vec.rs
Last active March 22, 2025 15:18 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::time::{SystemTime, UNIX_EPOCH};
const EPSILON_TWEAK: f64 = f64::EPSILON * /*adjust for granularity*/ 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct BlochVector {
pub x: f64,
pub y: f64,
pub z: f64,
}
@RandyMcMillan
RandyMcMillan / if_git.rs
Created March 15, 2025 12:10 — forked from rust-play/playground.rs
if_git.rs
use std::process::Command;
fn main() {
if is_git_installed() {
println!("Git is installed. Initializing Git repository...");
if let Err(e) = initialize_git_repo() {
eprintln!("Failed to initialize Git repository: {}", e);
} else {
println!("Git repository initialized successfully.");
}