This file contains hidden or 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
ack(x, y) = | |
(x == 0) ? (y + 1) : | |
(y == 0) ? ack(x - 1, 1) : | |
ack(x - 1, ack(x, y - 1)); | |
X | |
| 0 1 2 3 4 5 6 7 8 9 | |
--+-------------------------------------- | |
Y 0 | 1 2 3 | |
1 | 2 3 5 | |
2 | 3 4 7 |
This file contains hidden or 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
corpus = """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vitae suscipit lectus. Nam faucibus non risus iaculis mattis. Suspendisse ligula massa, porta nec euismod vel, gravida non nisi. Mauris sit amet pulvinar odio, in pharetra dolor. Curabitur non nisi eu nisi cursus elementum nec eget diam. Praesent aliquet vehicula enim eu malesuada. Fusce euismod dolor nec lorem ultricies, ut maximus neque luctus. Maecenas sed augue pretium, condimentum elit eu, feugiat diam. | |
Nam at est nulla. Vestibulum ac lacus dolor. Morbi ultricies metus diam, et maximus justo rutrum interdum. Suspendisse non metus vitae nulla condimentum eleifend eu a ante. Aenean a ex dui. Sed tempus turpis eu ipsum facilisis, eu ultrices enim condimentum. Vestibulum vehicula est sem, at accumsan leo cursus ac. Pellentesque neque sem, posuere vitae mi eget, convallis convallis augue. Duis vestibulum cursus purus facilisis lacinia. Praesent blandit felis urna, eget suscipit diam rhoncus et. Nam lorem libero, luctus rhoncus posue |
This file contains hidden or 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
''' | |
data-driven variable length encoder :) | |
(started as a toy program to encode / decode morse code; | |
extended to cover any variable-length encodings, and works provided that all | |
encodings are 1-1, ie. bidirectionally unambiguous, which this encoder assumes | |
but does not check for) | |
''' | |
from utils import fmt_or, ignore_errors |
This file contains hidden or 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
/// fast sphere collision checks w/ 128-bit SIMD | |
/// (d pseudocode; all these intrinsics -should- exist, however, | |
/// and ofc neon_check_sphere_collision could just be written | |
/// in armv8 assembly or whatever) | |
float dist2 (vec3 a, vec3 b) { | |
return (a - b).dot; | |
} | |
float dot (vec3 a) { | |
return a.x + a.y + a.z; |
This file contains hidden or 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
loading shader from ./CelShader.shadergraph | |
Shader CelShader | |
8 properties: | |
12412bf8-f58a-4b6f-8bc7-646cc224bb3a | |
name: Color | |
ref name: Color_F30DBC55 | |
type: UnityEditor.ShaderGraph.Internal.ColorShaderProperty | |
04e2ae53-6ac2-4fad-9c9b-da81279a109b | |
name: MainTex | |
ref name: Texture2D_B604EE98 |
This file contains hidden or 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
import os | |
import sys | |
if __name__ == '__main__': | |
if len(sys.argv) > 1: | |
os.chdir(sys.argv[1]) | |
target_dir = './Assets' | |
dir_meta_files = set([ |
This file contains hidden or 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
num is pub type where | |
// static properties (ie. <numtype>.zero, etc) | |
zero: pub value num | |
one: pub value num | |
min: pub value option<num> | |
max: pub value option<num> | |
inf: optional pub value option<num> | |
nan: optional pub value | |
This file contains hidden or 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
/// Our reduce 'function' (eval-one-step) | |
/// reduce :: AST -> State -> { Result :: AST, State :: State } | |
template <typename AST, typename State> | |
struct reduce; | |
/// class AST where | |
/// print :: IO () | |
/// reduce :: AST -> State -> { Result :: AST, State :: State } | |
/// |
This file contains hidden or 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
# https://en.wikipedia.org/wiki/Bailey–Borwein–Plouffe_formula | |
# generalize term summation | |
P = lambda terms: lambda k: 1 / 16 ** k * sum([ | |
a / (8 * k + b) for a, b in terms | |
]) | |
# bbp function (for one term, at k) | |
bbp = P(((4, 1), (-2, 4), (-1, 5), (-1, 6))) |
This file contains hidden or 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
# https://en.wikipedia.org/wiki/Bailey–Borwein–Plouffe_formula#BBP_compared_to_other_methods_of_computing_π | |
# generalize term summation | |
P = lambda terms: lambda k: 1 / 16 ** k * sum([ | |
a / (8 * k + b) for a, b in terms | |
]) | |
# bbp function (for one term, at k) | |
bbp = P(((4, 1), (-2, 4), (-1, 5), (-1, 6))) |
NewerOlder