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
; 99 bottles of beer in 835 instructions | |
; Author: Mike Tryczak (aka primo) | |
; | |
; Complete lyrics version | |
; byte sequence | |
; \n _ _ _ _ d \n comma space d o t l T | |
>++++++++++>> | |
>->+>----->--->---->+>++>++>++ | |
>+[+++++[>++++++++++++++<-]<+] |
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/perl -p | |
# bf2c.pl | |
# a primitive brainfuck to C transpiler | |
# | |
# usage: perl bf2c.pl program.bf | gcc -O2 -o program -xc - | |
BEGIN { | |
%w = qw( |
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
#72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33 | |
nop | |
push 3 | |
dup | |
add | |
dup | |
mul | |
dup | |
dup |
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
module builtin | |
[static] | |
fn is_atty(fd int) int | |
fn vcalloc(n int) byteptr | |
fn v_realloc(b byteptr, n int) byteptr | |
fn v_calloc(n int) byteptr | |
fn utf8_getchar() int |
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
(use spork/test) | |
(use spork/misc) | |
(use spork/math) | |
(def- small-primes | |
"primes less than 212" | |
[2 3 5 7 11 13 17 19 23 29 31 37 | |
41 43 47 53 59 61 67 71 73 79 83 89 | |
97 101 103 107 109 113 127 131 137 139 149 151 | |
157 163 167 173 179 181 191 193 197 199 211]) |
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
(defmacro timeit | |
``Similar to `loop`, but outputs performance statistics after completion.`` | |
[head & body] | |
(with-syms [clk cnt elp run] | |
~(do | |
(var ,cnt 0) | |
(def ,clk (os/clock)) | |
(loop ,head (++ ,cnt) ,;body) | |
(def ,elp (- (os/clock) ,clk)) | |
(def ,run (/ ,elp ,cnt)) |
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
/* | |
* Copyright (c) 2023 Calvin Rose | |
* | |
* 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
(use spork/test) | |
(use spork/math) | |
(def pseudoprimes | |
[1373653 | |
1530787 | |
1987021 | |
2284453 | |
3116107 | |
5173601 |