Skip to content

Instantly share code, notes, and snippets.

@fsteffenhagen
fsteffenhagen / sum_filesize.sh
Last active February 13, 2025 11:01
sum human readable file sizes with numfmt and awk
# Input: list of rows with format: "<filesize> filename", e.g.
# filesizes.txt
#######################
# 1000K file1.txt
# 200M file2.txt
# 2G file3.txt
#
# Output:
cat filesizes.txt | numfmt --from=iec | awk 'BEGIN {sum=0} {sum=sum+$1} END {printf "%.0f\n", sum}'
@jblanche
jblanche / lemonde-cleaner.js
Created December 30, 2012 16:43
Le monde cleaner
[].forEach.call(
document.querySelectorAll('a.lien_interne'), function(el){
el.outerHTML = el.innerText;
}
);
@takikawa
takikawa / gist:4090648
Created November 16, 2012 20:32
Coroutines
#lang racket
;; asymmetric full coroutines from "Revisiting Coroutines"
(provide (contract-out
[create (-> procedure? coroutine?)]
[resume (->* (coroutine?) () #:rest (listof any/c) any)]
[yield (-> any/c any)]
[status (-> coroutine? (or/c 'running 'done 'suspended))]))