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
| .PHONY: test | |
| test: example.so | |
| python test.py ./$< | |
| example: example.c | |
| $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $< | |
| example.so: example.c | |
| $(CC) $(CFLAGS) $(LDFLAGS) -shared -Dtestmode -o $@ $< |
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
| /* Idea: | |
| * Use 8 spaces for indenting the body of clauses | |
| * Use 4 spaces for all other indentation | |
| * Set your editor to expand tab to 4 spaces | |
| This is highly readible while minimising effort while writing. | |
| Indentation that requires manual character-level alignment would be | |
| extremely painful (for me). | |
| */ | |
| with |
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
| class Selector: | |
| def __init__(self, *j): | |
| self.__contents = j | |
| def __getattr__(self, attr): | |
| return Selector(*(v[attr] for v in self.__contents)) | |
| def __getitem__(self, idx): | |
| if idx is Ellipsis: | |
| return Selector(*(x for v in self.__contents for x in v)) |
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
| main | |
| templates.h | |
| template_*.h | |
| *.o |
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
| --- units.asm 2023-06-18 12:02:32.313569952 +1200 | |
| +++ units_unsafe.asm 2023-06-18 12:02:32.313569952 +1200 | |
| @@ -1,7 +1,7 @@ | |
| -metres_from_feet(feet): | |
| +metres_from_feet(double): | |
| divsd xmm0, QWORD PTR .LC0[rip] | |
| ret | |
| -feet_from_metres(metres): | |
| +feet_from_metres(double): | |
| mulsd xmm0, QWORD PTR .LC0[rip] |
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 sys | |
| def foo(*args, **kwargs): | |
| argstr = list(map(repr, args)) | |
| kwargstr = [f'{key}={repr(value)}' for key, value in kwargs.items()] | |
| print("foo(", ", ".join(argstr + kwargstr), ")", sep="") | |
| def easyarg(f): | |
| opts = {} | |
| for i in range(1, len(sys.argv)): |
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
| anyp(pred, seq) := lreduce(lambda([P, x], P or pred(x)), seq, false); | |
| allp(pred, seq) := lreduce(lambda([P, x], P and pred(x)), seq, true); | |
| walklength(seq) := (length(seq)-1)/2; | |
| walkverts(seq) := makelist(seq[2*i-1], i, 1, walklength(seq)+1); | |
| walkedges(seq) := makelist(seq[2*i], i, 1, walklength(seq)); | |
| closedp(seq) := is(first(seq) = last(seq)); | |
| vertexset(G) := first(G); | |
| edgeset(G) := second(G); |
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
| CFLAGS = -ffreestanding -fno-stack-protector | |
| LDFLAGS = -nostdlib -static | |
| fullwidth-freestanding: fullwidth-freestanding.o | |
| fullwidth-freestanding.o: fullwidth-freestanding.c |
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
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <assert.h> | |
| #define ENABLE_MOVE_COUNTER | |
| struct game { | |
| uint8_t col[2][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
| CFLAGS = -Wall -Warray-bounds=2 -Wcast-align=strict -Wcast-qual -Wconversion -Wno-sign-conversion -Wdangling-else -Wdate-time -Wdouble-promotion -Wextra -Wfloat-conversion -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation=2 -Wformat=2 -Winit-self -Wjump-misses-init -Wlogical-op -Wmissing-include-dirs -Wnested-externs -Wnull-dereference -Wpacked -Wpedantic -Wredundant-decls -Wshadow -Wshift-negative-value -Wshift-overflow=2 -Wstrict-aliasing -Wstrict-overflow=2 -Wstrict-prototypes -Wstringop-overflow=4 -Wstringop-truncation -Wswitch-default -Wswitch-enum -Wuninitialized -Wunsafe-loop-optimizations -Wunused -Wuse-after-free=3 -Wwrite-strings -fanalyzer -fmax-errors=2 -pedantic-errors | |
| .PHONY: default | |
| default: test | |
| .PHONY: test | |
| test: xods | |
| ./$< < /dev/null | diff expected.log - | head -n40 | |
| xods.o: xods.c instructions.h |
NewerOlder