Skip to content

Instantly share code, notes, and snippets.

View zoeyfyi's full-sized avatar

Zoey Sheffield zoeyfyi

View GitHub Profile
@zoeyfyi
zoeyfyi / Main.hs
Created November 22, 2022 07:12
Agda JSON backend
module Main (main) where
import Agda.Compiler.Backend (Backend (..), Backend' (..), Recompile (Recompile), callBackend, setTCLens)
import Agda.Compiler.Common (IsMain (..))
import Agda.Interaction.BasicOps (atTopLevel)
import Agda.Interaction.FindFile (SourceFile (..))
import Agda.Interaction.Imports (CheckResult (..), Mode (..), parseSource, typeCheckMain)
import Agda.Interaction.Options qualified as A (defaultOptions)
import Agda.Syntax.Abstract.Name qualified as A (ModuleName, QName (..))
import Agda.Syntax.Internal qualified as A (Name (..))
@zoeyfyi
zoeyfyi / rtrancl.thy
Created September 22, 2020 18:10
A collection of Isabelle/HOL proofs that I cant throw away but are almost certainly useless
lemma foobafafgw:
assumes "∀ x. p x x"
and "⋀ x y. (x, y) ∈ r ⟹ p x y"
and "⋀ x y z. p x y ⟹ p y z ⟹ p x z"
shows "(a, b) ∈ r⇧* ⟹ p a b"
proof (induct rule: rtrancl_induct)
case base
then show ?case
using assms(1) by blast
next
@zoeyfyi
zoeyfyi / format-jsonc.js
Created September 6, 2020 11:35
Format jsonc for Boop
/**
{
"api":1,
"name":"Format jsonc",
"description":"Cleans and format jsonc documents.",
"author":"Ben",
"icon":"broom",
"tags":"json,prettify,clean,indent"
}
**/
@zoeyfyi
zoeyfyi / modal_mu.v
Created April 5, 2020 00:28 — forked from qnighy/modal_mu.v
Modal mu calculus in Coq
Require Import Coq.Classes.SetoidClass.
Program Instance Iff1Setoid{A:Type} : Setoid (A->Prop) := {|
equiv := fun P Q => forall x, P x <-> Q x
|}.
Next Obligation.
split.
- intros P x; reflexivity.
- intros P Q H x; symmetry; exact (H x).
- intros P Q R H0 H1 x; transitivity (Q x); [exact (H0 x)|exact (H1 x)].
import sys
from copy import copy
n = 5
moves = [(1, 2), (1, -2), (-1, 2), (-1, -2), (2, 1), (2, -1), (-2, 1), (-2, -1)]
def intersect(p1, p2, p3, p4):
# Going back on self
if p1 == p4 and p2 == p3:
return True
import re
def get_imports(source):
imports = []
i = 0
while i < len(source)-1:
print i
# Find the next import
i = source.find("#import", i, len(source))
if i == -1:
import os
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams, LTRect, LTLine, LTTextBoxHorizontal
from pdfminer.pdfpage import PDFPage
from cStringIO import StringIO
from pdfminer.converter import PDFPageAggregator
from wand.image import Image
#include <llvm-c/Core.h>
#include <llvm-c/ExecutionEngine.h>
#include <llvm-c/Target.h>
#include <llvm-c/Analysis.h>
#include <llvm-c/BitWriter.h>
#define TEST_TYPE(name, src, expectedType) TEST(IrgenTest, name){ \
Parser *parser = NewParser((char *)src, Lex((char *)src)); \
Exp *e = ParseType(parser); \
Irgen *irgen = NewIrgen(); \
year = 2017
rpi = 0.02
inflation = 0.027778
maintance = 8570
start_fee = 9250
def loan(target, maint=maintance):
return (start_fee * (1 + inflation) ** (target - year)) + maint