This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun flesh-to-stone-weight (human-weight) | |
"Calculate how much a human of HUMAN-WEIGHT pounds would weigh if they were | |
converted into granite." | |
(interactive "nHuman weight in pounds: ") | |
(let* ((human-density 63.1) ; lb/ft^3 | |
(granite-density 168) ; lb/ft^3 | |
(granite-weight (* (/ human-weight human-density) granite-density))) | |
(message "A human of %f pounds would weigh %f pounds | |
if converted to granite." | |
human-weight granite-weight))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun height-mass (start-height start-mass end-height build-ratio) | |
"How much does your giant weigh? | |
Calculate from START-HEIGHT, START-MASS, and END-HEIGHT multiplied by | |
BUILD-RATIO the END-MASS. BUILD-RATIO is a factor to express the difference | |
in build between different creatures. (The factor for a dwarf might be 2.25, | |
225% heavier than normal.) | |
Formula: end-mass = start-mass * (end-height / start-height)^3 | |
See: | |
https://en.wikipedia.org/wiki/Square%E2%80%93cube_law | |
https://www.enworld.org/threads/how-much-does-my-giant-weight.106631/post-1846443" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
incf () { | |
# Construct a filename from PREFIX, "_YYYY-MM-DD", optionally _N (where N | |
# is 1 or greater) if the filename already exists, and optionally SUFFIX. | |
# Example: "incf file .tar.gz" results in "file_2021-07-07.tar.gz", or | |
# "file_2021-07-07_N.tar.gz" if "file_2021-07-07.tar.gz" already exists, | |
# where N is 1 or greater. | |
local prefix suffix fileprefix i testname sep1 sep2 | |
prefix="$1" | |
suffix="$2" | |
sep1="_" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; look at https://github.com/ndw/xmlunicode for xmlunicode.el | |
;; xmlunicode-character-list.el. xmlunicode.el provides the | |
;; "smart-unicode-*" functions. | |
(load-library "unichars") | |
(load-library "xmlunicode") | |
(defun tkb-describe-character (before) | |
"Describe the character after point (before if a prefix was specified) | |
if it is a unicode character." | |
(interactive "P") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; O is an args:option | |
(define (usage-line o) | |
(define (pad-docstring docstring) | |
(string-append (string-pad "" (+ (args:width) (args:indent))) | |
docstring "\n")) | |
(let* ((option-string (commify o)) | |
(docstrings (args:option-docstring o)) | |
(first-docstring (if (string? docstrings) docstrings (car docstrings))) | |
(rest-docstrings (if (string? docstrings) '() (cdr docstrings))) | |
(s (string-append |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; -*- geiser-scheme-implementation: chicken -*- | |
;;;; Look at https://wiki.call-cc.org/man/5/Module%20(chicken%20condition)#system-conditions | |
;;;; for a list of the CHICKEN Scheme system exceptions. | |
;;;; The original of the example I changed for the gist is in the | |
;;;; documentation of the module (chicken conditions), which I changed | |
;;;; to use procedures from the egg condition-utils to find out more | |
;;;; detail about the error. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(loop for f from -20 to 220 | |
do (let ((c (* (/ 5 9) (- f 32))) | |
(k (+ 273.15 (* (/ 5 9) (- f 32))))) | |
(format t "~6,2f℉ ~6,2f℃ ~6,2fK~%" f c k))) | |
(loop for f from -20 to 220 | |
for c = (* (/ 5 9) (- f 32)) | |
for k = (+ 273.15 (* (/ 5 9) (- f 32))) | |
do (format t "~6,2f℉ ~6,2f℃ ~6,2fK~%" f c k)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COMPILER Oberon2 | |
CHARACTERS | |
letter = 'A' .. 'Z' + 'a' .. 'z'. | |
digit = "0123456789". | |
hexDigit = digit + 'A' .. 'F'. | |
sqChar = ANY - '"'. | |
dqChar = ANY - "'". | |
TOKENS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COMPILER Oberon2_app_b | |
CHARACTERS | |
letter = 'A' .. 'Z' + 'a' .. 'z'. | |
digit = "0123456789". | |
hexDigit = digit + 'A' .. 'F'. | |
sqChar = ANY - '"'. | |
dqChar = ANY - "'". | |
TOKENS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# sort-versions -- Sort semantic versions, with things like .rc1, .rc2, .rc11 ending up in the right places. | |
REVERSE='' | |
let errors=0 | |
while getopts "?hr" opt | |
do | |
case "$opt" in | |
(\?|h) let errors++ ;; |
OlderNewer