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 / Xoroshiro128PlusPlus.rs
Last active August 1, 2026 01:53 — forked from rust-play/Playground.toml
Xoroshiro128PlusPlus.rs
#![no_std]
// Conditionally link `std` when compiling an executable target (non-test binary)
#[cfg(not(test))]
extern crate std;
/// A lightweight, fast, `#![no_std]` Pseudo-Random Number Generator (PRNG)
/// based on the Xoroshiro128++ algorithm.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Xoroshiro128PlusPlus {
@RandyMcMillan
RandyMcMillan / jitter_bug.rs
Last active July 31, 2026 23:34 — forked from rust-play/Playground.toml
jitter_bug.rs
#[allow(unused_imports)]
use sha2::{Digest, Sha256};
#[allow(unused_imports)]
use std::time::Instant;
// ============================================================================
// Cross-Platform Hardware CPU Tick Counter
// ============================================================================
/// Reads the low-level CPU tick counter across x86/x86_64, AArch64, and RISC-V.
@RandyMcMillan
RandyMcMillan / knapsack.rs
Last active July 27, 2026 22:08 — forked from rust-play/Playground.toml
Code shared from the Rust Playground
/// Solves the 0/1 Knapsack problem using Dynamic Programming.
///
/// # Arguments
/// * `max_weight` - The maximum weight capacity of the knapsack.
/// * `weights` - A slice containing the weights of the available items.
/// * `values` - A slice containing the values of the available items.
///
/// # Returns
/// The maximum value that can be accommodated within the given capacity.
pub fn knapsack(max_weight: usize, weights: &[usize], values: &[usize]) -> usize {
@RandyMcMillan
RandyMcMillan / uasf_simulator.rs
Last active July 27, 2026 12:37 — forked from rust-play/Playground.toml
uasf_simulator.rs
use std::time::{SystemTime, UNIX_EPOCH};
/// Simple Xorshift PRNG to maintain a 0-dependency standard library build.
struct Prng {
state: u32,
}
impl Prng {
fn new() -> Self {
let nanos = SystemTime::now()
@RandyMcMillan
RandyMcMillan / dyn_compatible.rs
Last active July 25, 2026 14:25 — forked from rust-play/Playground.toml
Code shared from the Rust Playground
// ==========================================
// INCORRECT: Dyn-Incompatible Trait
// ==========================================
// Uncommenting this will cause a compilation error:
// "the trait `Processor` cannot be made into an object"
/*
trait Processor {
// Error 1: Uses `Self` in return position
fn duplicate(&self) -> Self;
@RandyMcMillan
RandyMcMillan / README.md
Last active July 21, 2026 17:28 — forked from ChrisCarini/embeddedPayload.sh
Embed TAR file in a shell script

README.md

@RandyMcMillan
RandyMcMillan / gist-utility
Last active July 21, 2026 15:47
gist-utility
#!/usr/bin/env bash
set -euo pipefail
INSTALL_DIR="/usr/local/bin"
SCRIPT_NAME="git-clone-gists"
CLONE_DIR="${CLONE_DIR:-gists}"
show_usage() {
cat <<EOF
Usage: $0 [install|uninstall|--help] [--force] [--user USERNAME] [filters] [github-token]
@RandyMcMillan
RandyMcMillan / rust_core.rs
Last active July 19, 2026 13:08 — forked from rust-play/playground.rs
rust_core.rs
#![allow(deprecated)]
//#![feature(cfg_select, assert_matches)]
use std::assert_matches;
use rand_0_8_6::{thread_rng as rng_legacy, Rng as RngLegacy};
use rand_0_9_4::{thread_rng as rng_latest, Rng as RngLatest};
use num_bigint::BigUint;
use chrono::Local;
@RandyMcMillan
RandyMcMillan / circle_tones.rs
Last active July 15, 2026 21:21 — forked from rust-play/playground.rs
circle_tones.rs
//// Coltrane's Circle of Tones
// Written using only the Rust Standard Library.
use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Note {
C, Db, D, Eb, E, F, Gb, G, Ab, A, Bb, B,
}
@RandyMcMillan
RandyMcMillan / .gitignore
Last active July 15, 2026 16:55 — forked from rust-play/playground.rs
red_level.rs
Cargo.lock