Skip to content

Instantly share code, notes, and snippets.

View pkutaj's full-sized avatar

pavol kutaj pkutaj

View GitHub Profile
@pkutaj
pkutaj / tmpivkicoa8.scheme
Created August 19, 2026 07:35
Explaining iteration vs recursion through peano addition snippet
(define (add x y)
(if (= x 0) y (add (- x 1) (+ y 1))))
@pkutaj
pkutaj / tmpmux55t0e.scheme
Created August 19, 2026 07:35
Explaining iteration vs recursion through peano addition snippet
(define (add_r x y)
(if (= x 0) y (+ 1 (add_r (- x 1) y))))
@pkutaj
pkutaj / tmplw3rg39k.txt
Created August 19, 2026 07:35
Explaining iteration vs recursion through peano addition snippet
3 4 |
2 5 | time dimension of the process — CPU
1 6 |
0 7 V
7
----> space dimension of the process — RAM
@pkutaj
pkutaj / tmp6c22o45m.txt
Created August 19, 2026 07:35
Explaining iteration vs recursion through peano addition snippet
| + 1 (add_r 2 4) -
| + 1 (+ 1 (add_r 1 4)) ---
| + 1 (+ 1 (+ 1 (add_r 0 4))) ------> space complexity
| + 1 (+ 1 (+ 1 4)) ---
| + 1 (+ 1 5) -
| + 1 6
V 7
@pkutaj
pkutaj / tmp7i7qhiuz.sh
Created August 18, 2026 07:03
Explaining OOM Kill in Linux snippet
# check current badness adjustment for a PID
cat /proc/<pid>/oom_score_adj
# make a process nearly immune to the OOM killer
# (requires CAP_SYS_RESOURCE / root)
echo -900 > /proc/<pid>/oom_score_adj
# make a process the preferred victim — useful for a
# deliberately sacrificial "canary" process
echo 1000 > /proc/<pid>/oom_score_adj
@pkutaj
pkutaj / tmp2tu2xyzz.scheme
Created August 11, 2026 13:52
The Substitution Model snippet
(define sq (lambda (n) (* n n)))
(assert (= (sq 5) 25)) ;PASS
@pkutaj
pkutaj / tmpj2f1j5_w.scheme
Created August 11, 2026 13:51
The Substitution Model snippet
(define sqs (lambda (x y) (+ (sq x) (sq y))))
(assert (= (sqs 2 3) 13)); PASS
@pkutaj
pkutaj / tmpc3py1h7_.scheme
Created August 11, 2026 13:51
The Substitution Model snippet
;👇 eval operator
(sqs 2 3)
;👉 (lambda (x y) (+ (sq x) (sq y)))
@pkutaj
pkutaj / tmpnzo_4t2k.scheme
Created August 11, 2026 13:51
The Substitution Model snippet
;👇👇 eval operands
(sqs 2 3)
; 👉 2
; 👉 3
@pkutaj
pkutaj / tmppxf28luy.scheme
Created August 11, 2026 13:51
The Substitution Model snippet
;👇 body of the procedure ;👇 arguments
;(+ (sq x) (sq y))) ; 2 3
;applied 👉 (+ (sq 2) (sq 3))