The intent is to define terse, standards-supported names for AWS regions.
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
;; Guy Steele's "FOO" language, as found on the ll1.mit.edu mailing list. | |
;; ---------------------------------------------------------------------- | |
;; [He said..] | |
;; If you speak Common Lisp, you might find the following | |
;; bit of code illuminating. (If you speak Scheme but | |
;; not Common Lisp, then just delete or ignore all occurrences | |
;; of the strings "funcall " and "#'"). |
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
(ql:quickload "cl-ppcre") | |
(ql:quickload "anaphora") | |
(defpackage :ini-parser | |
(:use :common-lisp :anaphora) | |
(:export :read-config-from-file)) | |
(in-package :ini-parser) | |
(defparameter +empty-line+ (format nil "~%")) |
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
#!/bin/bash | |
# usage: diffpdf.sh file_1.pdf file_2.pdf | |
# requirements: | |
# - ImageMagick | |
# - Poppler's pdftoppm and pdfinfo tools (works with 0.18.4 and 0.41.0, | |
# fails with 0.42.0) | |
# (could be replaced with Ghostscript if speed is | |
# not important - see commented commands below) |
Not all random values are created equal - for security-related code, you need a specific kind of random value.
A summary of this article, if you don't want to read the entire thing:
- Don't use
Math.random()
. There are extremely few cases whereMath.random()
is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case. - Don't use
crypto.getRandomBytes
directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable. - If you want to generate random tokens or API keys: Use
uuid
, specifically theuuid.v4()
method. Avoidnode-uuid
- it's not the same package, and doesn't produce reliably secure random values. - If you want to generate random numbers in a range: Use
random-number-csprng
.
You should seriously consider reading the entire article, though - it's
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
;; A tetris game -- partial implementation, part 4 | |
;; Copyright (c) 2020 Alex Harsányi (AlexHarsanyi@gmail.com) | |
;; Permission is hereby granted, free of charge, to any person obtaining a | |
;; copy of this software and associated documentation files (the "Software"), | |
;; to deal in the Software without restriction, including without limitation | |
;; the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
;; and/or sell copies of the Software, and to permit persons to whom the | |
;; Software is furnished to do so, subject to the following conditions: |
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
;; A space invaders game in Racket | |
;; Copyright (c) 2020 Alex Harsányi (AlexHarsanyi@gmail.com) | |
;; Permission is hereby granted, free of charge, to any person obtaining a | |
;; copy of this software and associated documentation files (the "Software"), | |
;; to deal in the Software without restriction, including without limitation | |
;; the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
;; and/or sell copies of the Software, and to permit persons to whom the | |
;; Software is furnished to do so, subject to the following conditions: |
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++ ;; |