Skip to content

Instantly share code, notes, and snippets.

View menjaraz's full-sized avatar

Menjanahary menjaraz

View GitHub Profile
@menjaraz
menjaraz / scenario.md
Last active June 18, 2026 19:45
EPCIS Scenario

Seed Data

The seed mechanism loads a realistic pharmaceutical supply chain scenario into a running EPCIS 2.0 app instance. It is designed for local development and manual exploration — not for test suites (tests create their own data).

Quick start

make docker-up   # start the full stack (DB + app)
make seed        # load seed data (safe to run multiple times)
@menjaraz
menjaraz / README.md
Last active June 16, 2026 04:16
Rust asynchronous retry logic using tokio_retry with ExponentialBackoff, jitter, and conditional error handling (RetryIf).

Async Retry Logic in Rust with tokio-retry

This Gist demonstrates a production-ready pattern for executing asynchronous operations with exponential backoff, jitter, and conditional error handling using the tokio-retry crate.

It specifically showcases how to handle shared state safely across retry boundaries using thread-safe atomics.

🚀 Key Features Demonstrated

  • Exponential Backoff with Jitter: Automatically increases delays between retries to prevent overwhelming downstream services, adding randomness (jitter) to avoid the thundering herd problem.
  • Conditional Retries (RetryIf): Inspects the returned error to differentiate between transient failures (which should be retried) and fatal errors (which should abort immediately).
@menjaraz
menjaraz / README.md
Last active June 6, 2026 15:09
Z₇₁ Cyclic Dynamical System with Nontrivial 1-Cocycle Invariant

Minimal 71-State Cyclic System with Additive Cocycle Invariant

This repository contains a minimal deterministic dynamical system over the cyclic group Z₇₁ with a nontrivial additive edge-weight function (cocycle).

It produces two global invariants:

  • Period = 71
  • Drift = 118

System Overview

@menjaraz
menjaraz / saturation.rs
Created May 11, 2026 16:35
Saturation Attack Simulation
use std::error::Error;
use std::fmt;
/// Represents a defense system with interceptors.
#[derive(Debug, Clone)]
pub struct DefenseSystem {
pub interceptors: usize,
pub interceptor_success_rate: f64,
}
@menjaraz
menjaraz / log.txt
Created January 15, 2026 05:41
"tick-sim" log excerpt
2026-01-15T05:25:52.360670Z  INFO tick_sim: simulation_started command="Press Ctrl+C to stop"
2026-01-15T05:25:52.360882Z  INFO market_maker{config=Config { simulation: SimulationConfig { run_duration_ms: None }, agents: AgentsConfig { market_maker: MarketMakerConfig { center_price: 100.0, initial_levels: 5, initial_quantity: 100, spread: 0.1, tick_size: 0.05, standard_quantity: 100, latency_ms: (1, 5) }, noise_trader: NoiseTraderConfig { submit_interval_ms: 500, quantity_range: (10, 50), aggressive_prices: (99.95, 100.05) } }, market: MarketConfig { price_precision: 2 } } agent_id="market_maker"}: tick_sim::agents: market_maker_started
2026-01-15T05:25:52.360877Z  INFO run{event_rx=Receiver { chan: Rx { inner: Chan { tx: Tx { block_tail: 0x1f11d801c40, tail_position: 0 }, semaphore: Semaphore { semaphore: Semaphore {
unit AsyncThread;
interface
uses
{Delphi}
System.SysUtils
{Project}
;
@menjaraz
menjaraz / collatz.py
Last active October 7, 2024 08:09
Python Collatz Generator function
def generate_collatz(n):
"""
Generator function to generate the Collatz sequence.
Args:
n (int): The starting number for the sequence.
Yields:
int: The next number in the sequence.
"""
@menjaraz
menjaraz / main.dart
Created September 28, 2024 17:49
OEIS A014445 - Even Fibonacci numbers; or, Fibonacci(3*n).
/// OEIS A014445 - Even Fibonacci numbers; or, Fibonacci(3*n).
/// https://oeis.org/A014445
/// https://oeis.org/A014445/list
void main() => print(evenFibonacci().take(26));
Iterable<int> evenFibonacci() sync* {
int a = 0, b = 2;
while (true) {
@menjaraz
menjaraz / main.dart
Last active September 28, 2024 17:33
Project Euler Problem 10 - Summation of Primes
// Summation of Primes
// https://projecteuler.net/problem=10
void main() {
final timer = Stopwatch()..start();
final answer = summationOfPrimesBelow(2000000);
timer.stop();
@menjaraz
menjaraz / app.d
Created September 28, 2024 17:20
Prime Generator in Dlang
import std.stdio;
import std.range;
import std.algorithm;
auto primeGenerator() {
int num = 2;
return generate(() {
while (true) {
if (isPrime(num)) {