Skip to content

Instantly share code, notes, and snippets.

View ApprenticeofEnder's full-sized avatar

Robert Babaev ApprenticeofEnder

View GitHub Profile

Bash Logging Module

A flexible, reusable logging module for Bash scripts that provides standardized logging functionality with various configuration options.

Features

  • Standard syslog log levels (DEBUG, INFO, WARN, ERROR, CRITICAL, etc.)
  • Console output with color-coding by severity
  • Configurable stdout/stderr output stream split
  • Optional file output
@ApprenticeofEnder
ApprenticeofEnder / .envrc
Last active December 13, 2025 21:25
Devenv + SecretSpec + Direnv Repro
#!/usr/bin/env bash
export DIRENV_WARN_TIMEOUT=20s
op signin
eval "$(devenv direnvrc)"
# `use devenv` supports the same options as the `devenv shell` command.
#
@ApprenticeofEnder
ApprenticeofEnder / irr.py
Created March 5, 2022 22:05
IRR Calculator (Finance)
def calculate_irr(initial_investment, payments):
min_irr = 0
max_irr = 0.50
irr = 0
while True:
result = initial_investment
mid_irr = (min_irr + max_irr) / 2
for index, payment in enumerate(payments):
result += payment / ((1 + mid_irr) ** (index + 1))
if abs(result) < 0.005: