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 / preserve_asm.rs
Last active October 31, 2026 18:05 — forked from rust-play/Playground.toml
preserve_asm.rs
//! ============================================================================
//! Verbose & Advanced Example: Safe Cross-Architecture Volatile Assembly
//! Macro That Will Not Be Compiled Out (Fixed I/O Return)
//! ============================================================================
//!
//! Instructions to run:
//! 1. Create a new binary project: `cargo new asm_test && cd asm_test`
//! 2. Replace the contents of `src/main.rs` with this code.
//! 3. Run with release optimizations to verify it isn't stripped:
//! `cargo run --release`
@RandyMcMillan
RandyMcMillan / index.html
Last active October 26, 2026 19:24 — forked from Gummibeer/index.html
Tailwind Admin Dashboard Template
This file has been truncated, but you can view the full file.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Tailwind Admin Dashboard</title>
<style>
@RandyMcMillan
RandyMcMillan / k_congruent_0_mod_2.rs
Last active October 25, 2026 08:13 — forked from rust-play/Playground.toml
Code shared from the Rust Playground
fn main() {
println!("=== Z_2 Modular Arithmetic Verification ===");
println!("Equation: (k - 1) / (1 - k) == 1 (mod 2)\n");
// Explicitly annotate k as a signed integer (i32)
for k in 0..4_i32 {
let k_z2 = k % 2;
let num = (k - 1).rem_euclid(2);
let den = (1 - k).rem_euclid(2);
@RandyMcMillan
RandyMcMillan / secp_colorplot.rs
Last active October 16, 2026 05:12 — forked from rust-play/Playground.toml
secp_colorplot.rs
// ============================================================================
// secp256k1 Simulation & Color Mapping Script
// ============================================================================
/// Helper to convert an RGB hex string (e.g., "#FF5733") into (R, G, B) u8 values.
fn hex_to_rgb(hex: &str) -> (u8, u8, u8) {
let hex = hex.trim_start_matches('#');
let r = u8::from_str_radix(&hex[0..2], 16).unwrap_or(0);
let g = u8::from_str_radix(&hex[2..4], 16).unwrap_or(0);
let b = u8::from_str_radix(&hex[4..6], 16).unwrap_or(0);
@RandyMcMillan
RandyMcMillan / handwired.rs
Last active October 15, 2026 12:58 — forked from rust-play/Playground.toml
handwired.rs
/// Handwired Compilation Example in Rust (Expanded & Warning-Free)
/// Demonstrates converting state, conditionals, and loops into
/// pure floating-point math, matrix operations, and ReLU.
/// Includes random length and random value generation.
#[derive(Debug, Clone)]
struct ProgramResult {
acc: f64,
status: f64,
step_count: f64,
@RandyMcMillan
RandyMcMillan / handwired_program.rs
Last active October 15, 2026 12:49 — forked from rust-play/Playground.toml
handwired_program.rs
/// Handwired Compilation Example in Rust
/// Demonstrates converting state, conditionals, and loops into
/// pure floating-point math, matrix operations, and ReLU.
/// Includes random length and random value generation.
#[derive(Debug)]
struct ProgramResult {
acc: f64,
status: f64,
}
@RandyMcMillan
RandyMcMillan / loopback.rs
Last active October 14, 2026 22:31 — forked from rust-play/Playground.toml
loopback.rs
/// Computes a structural loopback or skip-pointer hop based on trailing zeros.
fn loopback(block: usize) -> Option<usize> {
let x = block.trailing_zeros();
if x > 1 && block > 0 {
Some(block - (1 << (x - 1)))
} else {
None
}
}
@RandyMcMillan
RandyMcMillan / secp256_markov_chain.rs
Last active October 10, 2026 02:47 — forked from rust-play/Playground.toml
secp256_markov_chain.rs
// Simple PRNG for reproducibility
struct SimpleRng {
state: u64,
}
impl SimpleRng {
fn new(seed: u64) -> Self {
Self { state: seed }
}
fn next_f64(&mut self) -> f64 {
@RandyMcMillan
RandyMcMillan / secp_markov_chain.rs
Last active October 10, 2026 02:49 — forked from rust-play/Playground.toml
secp_markov_chain.rs
// Simple Linear Congruential Generator (LCG) for reproducible seeding
// mirroring np.random.seed(42) without external dependencies.
struct SimpleRng {
state: u64,
}
impl SimpleRng {
fn new(seed: u64) -> Self {
Self { state: seed }
}
@RandyMcMillan
RandyMcMillan / integer_multiplication.rs
Last active October 8, 2026 19:23 — forked from rust-play/Playground.toml
integer_multiplication.rs
use num_complex::Complex64;
use std::f64::consts::PI;
/// 1. Schoolbook Multiplication - O(n^2)
/// Base-10 arbitrary-precision multiplication for direct comparison.
pub fn multiply_schoolbook(a: &[u8], b: &[u8]) -> Vec<u8> {
let mut result = vec![0u8; a.len() + b.len()];
for (i, &da) in a.iter().rev().enumerate() {
let mut carry = 0u64;