Skip to content

Instantly share code, notes, and snippets.

-- The meta-circular interpreter from section 5 of Reynolds's Definitional
-- Interpreters for Higher Order Programming Languages
-- (http://www.cs.uml.edu/~giam/91.531/Textbooks/definterp.pdf)
data EXP
= CONST Const
| VAR Var
| APPL Appl
| LAMBDA Lambda
| COND Cond
@reinh
reinh / i_am_me.txt
Last active March 12, 2023 08:00
I Am Me by Virginia Satir
I Am Me
In all the world, there is no one else exactly like me
Everything that comes out of me is authentically me
Because I alone chose it – I own everything about me
My body, my feelings, my mouth, my voice, all my actions,
Whether they be to others or to myself – I own my fantasies,
My dreams, my hopes, my fears – I own all my triumphs and
Successes, all my failures and mistakes Because I own all of
Me, I can become intimately acquainted with me – by so doing
#!/bin/sh -x
# git name-rev is fail
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
git checkout master
git merge ${CURRENT}
git push origin master
git checkout ${CURRENT}
#!/bin/sh -x
# git name-rev is fail
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
git checkout master
git pull origin master
git checkout ${CURRENT}
git rebase master
@reinh
reinh / README.md
Last active February 25, 2020 23:25
Resilience Engineering quotes

Resilience Engineering quotes

Collected by @reinh.

The Safety Anarchist by Sidney Dekker

Dekker, S. (2017). The Safety Anarchist: Relying on Human Expertise and Innovation, Reducing Bureaucracy and Compliance. United Kingdom: CRC Press.

@reinh
reinh / set-window-title.zsh
Created February 24, 2020 19:51
Set iTerm2 window title to relative PWD (~/foo)
function set-window-title {
echo -ne "\e]1;$(dirs)\a"
}
set-window-title
add-zsh-hook precmd set-window-title
@reinh
reinh / apology.
Created October 22, 2019 18:58 — forked from unclebob/apology.
Apology to Women Programmers. [Originally by Robert Martin, saved here for posterity by @reinh]
Today I gave a keynote at ACCU in Oxford. In the midst of it I made two (count them) two statements that I should have known better than to make. I was describing the late '70s, and the way we felt about the C language at the time. My slide said something like: "C was for real men." Emily Bache, whom I know and hold in high regard, spoke up and said "What about women?". And I said something like: "We didn't allow women in those days." It was a dumb crack, and should either not have been said, or should have been followed up with a statement to the effect that that was wrong headed.
The second mistake I made was while describing Cobol. I mentioned Adm. Grace Hopper. I said something like "May she rest in peace." I don't know that any of the words were actually demeaning, but the tone was not as respectful as it should have been to an Admiral in the United State Navy, and one who was so instrumental in our industry; despite what I feel about Cobol.
I am a 59 year old programmer who was brought up
# roll 2d6+3
function roll {
local match total
local -a rolls
if ! [[ "$1" =~ '([0-9]+)d([0-9]+)(\+[0-9]+)?' ]]; then
echo "usage: roll 2d6+3" 1>&2
return 1
fi
Priority Queues
═══════════════
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
INSERT DEL-MIN MIN DEC-KEY DELETE MERGE
binary log n log n 1 log n log n n
binomial 1 log n 1 log n log n log n
Fibonacci 1 log n† 1 1† log n† log n
Pairing 1† log n† 1† 1† log n† 1†
Brodal-Okasaki 1 log n 1 1 log n 1
class Proc
%i[! ~].each do |op|
define_method(op) { ->(x) { call(x).send(op)} }
end
%i[+ - * / ^ & |].each do |op|
define_method(op) { |other| ->(x) { call(x).send op, other.call(x) } }
end
end