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
odseq.txt |
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
def draw_square(cx, cy, r, l, theta): | |
pushMatrix() | |
quarter_turns, theta = divmod(theta, HALF_PI) | |
translate(cx, cy) | |
rotate(quarter_turns * HALF_PI) | |
critical_theta = atan(l * 1.0 / (2 * r + l)) | |
if theta <= critical_theta: | |
x = r + l / 2.0 | |
y = (r + l / 2.0) * tan(theta) | |
elif theta >= HALF_PI - critical_theta: |
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
some_data = [ | |
(1, 2, 3), | |
(4, 5, 6), | |
(7, 8, 9), | |
(100, 255, 0)] | |
def dump_data(data, filename): | |
with open(filename, "w") as data_file: | |
for tup in data: | |
print(" ".join(map(str, tup)), file=data_file) |
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
# TODO: this still doesn't quite account correctly for the case where you have a | |
# small exponent, which doesn't quite catch the periodic part of the | |
# powers | |
# e.g. the powers of 5 mod 10^5 go | |
# [1, 5, 25, 125, 625, 3125, ..., 40625] (...3125) | |
# so the power tower [5, 2] mod 10^5 wil incorrectly be stated as 65625. | |
def last_digit_of_power_tower(tower, base=10): | |
""" | |
Find the last digit of a power tower in some base (ie reduce a power tower |
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 | |
# https://unix.stackexchange.com/a/527714/347199 | |
mkfifo mypipe | |
trap 'rm -f mypipe' EXIT | |
printf '%d\n%d\n' 0 1 >mypipe & | |
python3 -c ' |
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
.PHONY: bash | |
SHELL = bash | |
APPARIX_ENV = APPARIXRC=$(CURDIR)/apparixrc APPARIXEXPAND=$(CURDIR)/apparixexpand | |
BASH_ENV = INPUTRC=inputrc | |
all: bash | |
apparixrc: | |
$(APPARIX_ENV) bash -c "source bourne-apparish; apparix-init" |
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
import Data.List | |
import qualified Data.ByteString.Char8 as B | |
main :: IO () | |
main = do | |
stdin <- B.getContents | |
B.putStrLn $ (B.intercalate (B.pack "\n") | |
. map (B.intercalate (B.pack "\t")) | |
. transpose . map (B.split '\t') | |
. B.split '\n') stdin |
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
# because I want to time things | |
SHELL=bash | |
.PHONY: clean run destroy gist all | |
.FORCE: | |
DATAGEN_PYTHON = pypy3 # python3 | |
TRANSPOSE_PYTHON = python3 |
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
Making the integers from 0-99 using the digits (2, 0, 1, 9) and various | |
mathematical operators, including the binary operators: | |
- addition | |
- subtraction | |
- multiplication | |
- division | |
- exponentiation | |
the unary operators: | |
- factorial |
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
........................................................................................................................................................... | |
........................................................................................................................................................... | |
........................................................................................................................................................... | |
........................................................................................................................................................... | |
.........ccccccccccccccccccccccccccc::;;,''................................................................................................................ | |
.........ooooooooooooooooooooooooooooooooooooolc:,......................................................................................................... | |
.........oooooooooooooooooooooooooooooooooooooooooool:,................................. |
NewerOlder