Skip to content

Instantly share code, notes, and snippets.

View bionicles's full-sized avatar

bion howard bionicles

View GitHub Profile
@bionicles
bionicles / enhanced-println-dbg-RFC-2024.md
Created July 20, 2024 16:45
Enhanced Variable Printing in println! and dbg! Macros - Iteration 2
  • Title: Enhanced Variable Printing in println! and dbg! Macros
  • Author(s): bionicles with help from Mistral Au Large & codestral
  • Iteration: 2
  • Status: Draft

Abstract: This RFC proposes a new shorthand syntax for Rust's println! and dbg! macros, inspired by Python's f-string {x=} syntax. The goal is to reduce redundancy and improve ergonomics when printing variables and their values, especially for long or nested identifiers. This RFC aims to enhance both println! and dbg! macros to provide a more flexible and convenient way to print variables and their values.

Motivation: The discussion revealed that using Rust's println! and dbg! macros to print variables and their values can be redundant and time-consuming, particularly with long or nested identifiers. The proposed shorthand syntax addresses this issue, making it more convenient to print variables and their values without sacrificing readability.

@bionicles
bionicles / .bash_profile
Last active June 14, 2024 16:01
Selected Bash Functions, Revision 1
# BEGIN APACHE-2.0 OR MIT SEGMENT
# edit your bashrc and bash_profile with vs code
alias eb="code ${HOME}/.bash_profile $HOME ${HOME}/.bashrc "
# source bash_profile (i.e. reload these functions) without losing conda or cwd
function sb {
local cur_dir=$(pwd)
local cur_env=${CONDA_DEFAULT_ENV:-$MY_DEFAULT_ENV}
source ~/.bash_profile
cd $cur_dir
@bionicles
bionicles / vaccine.py
Created December 21, 2020 02:55
second-order expected value of covid vaccine
def compute_value_of_vaccine(
number_of_people_you_would_infect=1.1, # rt.live
value_of_a_human_life=10000000, # your life is worth ten million bucks
vaccine_efficacy=0.95, # the vaccine is 95% effective
covid_death_rate=0.01, # 1% of infected people die
):
expected_cost_of_death = value_of_a_human_life * covid_death_rate
expected_cost_of_family_death = (
expected_cost_of_death * number_of_people_you_would_infect