Skip to content

Instantly share code, notes, and snippets.

View sgraham's full-sized avatar

Scott Graham sgraham

View GitHub Profile
@sgraham
sgraham / a.cpp
Last active December 12, 2023 20:34
reproducible rnd matching pico8's generation (build with `cl /std:c++17 a.cpp`)
#include "fix32.h"
#include <optional>
template<typename T> using opt = std::optional<T>;
struct { uint32_t a, b; } g_prng = {0};
static void update_prng()
{
auto &prng = g_prng;
@sgraham
sgraham / hydro-on.yaml
Created September 12, 2023 23:17
google home automation for hydro pump on
# ------------------------------------------------------------------------------------------ #
# Lines starting with “#” are comments and will be ignored by the automation.
# Indentation determines hierarchy within the script.
# Visit g.co/home/script-editor-docs for full documentation.
# ------------------------------------------------------------------------------------------ #
metadata:
name: Hydro pump on # Choose a short name that summarizes important starters and actions, like “Sunset lights”.
description: Turns hydroponic pump on every 30 minutes
Running: C:\Program Files\LLVM\bin\clang -c -std=c99 -Werror -o C:\Users\sgraham\AppData\Local\Temp\tmp5ferr6bx\closures.o -target x86_64-pc-windows-msvc -D_CRT_SECURE_NO_WARNINGS -Wno-override-module -g -O0 -DPIQUE_REFCOUNT_LOG_ENABLE -Wno-deprecated-declarations c:\src\pique\runtime\closures.c
Running: C:\Program Files\LLVM\bin\clang -c -std=c99 -Werror -o C:\Users\sgraham\AppData\Local\Temp\tmp5ferr6bx\closures.o -target x86_64-pc-windows-msvc -D_CRT_SECURE_NO_WARNINGS -Wno-override-module -g -O0 -DPIQUE_REFCOUNT_LOG_ENABLE -Wno-deprecated-declarations c:\src\pique\runtime\closures.c
Running: C:\Program Files\LLVM\bin\clang -c -std=c99 -Werror -o C:\Users\sgraham\AppData\Local\Temp\tmp5ferr6bx\closures.o -target x86_64-pc-windows-msvc -D_CRT_SECURE_NO_WARNINGS -Wno-override-module -g -O0 -DPIQUE_REFCOUNT_LOG_ENABLE -Wno-deprecated-declarations c:\src\pique\runtime\closures.c
Running: C:\Program Files\LLVM\bin\clang -c -std=c99 -Werror -o C:\Users\sgraham\AppData\Local\Temp\tmp5ferr6bx\closures.o -target x8
(pique) c:\src\pique\tmp>dir *.ll
Volume in drive C has no label.
Volume Serial Number is A620-41DC
Directory of c:\src\pique\tmp
2023-02-09 11:25 PM 43,550 comparison.ll
2023-02-09 11:25 PM 213,017 control.ll
2023-02-09 11:25 PM 50,781 destructuring.ll
2023-02-09 11:25 PM 1,472,384 functional.ll
(pique) c:\src\pique\tests\end_to_end_tests>python examples_test.py ExamplesCompilerTest.test_hello_world
Running: c:\src\pique\Scripts\python.exe c:\src\pique\src\compiler.py --source c:\src\pique\examples --artifacts C:\Users\sgraham\AppData\Local\Temp\tmpp3k864dk --verbose hello_world -- -g -O0
Loading module: 'hello_world'
Loading module: 'prelude'
Loading module: 'comparison'
Loading module: 'control'
Loading module: 'lists'
Loading module: 'types'
Loading module: 'destructuring'
Loading module: 'io'
c:\src\pique>dir "C:\Program Files\LLVM\bin\*.exe" /s/b
C:\Program Files\LLVM\bin\clang++.exe
C:\Program Files\LLVM\bin\clang-apply-replacements.exe
C:\Program Files\LLVM\bin\clang-change-namespace.exe
C:\Program Files\LLVM\bin\clang-check.exe
C:\Program Files\LLVM\bin\clang-cl.exe
C:\Program Files\LLVM\bin\clang-cpp.exe
C:\Program Files\LLVM\bin\clang-doc.exe
C:\Program Files\LLVM\bin\clang-extdef-mapping.exe
C:\Program Files\LLVM\bin\clang-format.exe
(pique) c:\src\pique>python scripts\run_win.py scripts\run_tests.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/base_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/lexer_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/parser_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/scope_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/translator_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/evaluator_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/expander_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/modules_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/tracing_test.py
(pique) c:\src\pique>python scripts\run_win.py scripts\run_tests.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/base_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/lexer_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/parser_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/scope_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/translator_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/evaluator_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/expander_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/modules_test.py
#### Running: c:\src\pique\Scripts\python.exe ./tests/src_tests/tracing_test.py
@sgraham
sgraham / rt.sh
Last active November 20, 2020 19:23
#!/bin/sh
set -e
echo $1
rm -f YYY.gn
/work/gn/out/gn format -q $1
/work/gn/out/gn format --dump-tree=json $1 >XXX.json
/work/gn/out/gn format -q --read-tree=json YYY.gn <XXX.json
diff $1 YYY.gn
#!/usr/bin/env python3
import json
import sys
def find_all(data, typ, val):
result = []
def rec(root):