Skip to content

Instantly share code, notes, and snippets.

View Parcly-Taxel's full-sized avatar

Jeremy Tan Jie Rui Parcly-Taxel

View GitHub Profile
@Parcly-Taxel
Parcly-Taxel / turing.cpp
Last active September 24, 2021 02:18
Turing machine for PSE #110567
#include <deque>
#include <cstdio>
#include <numeric>
using namespace std;
const int L = -1;
const int R = 1;
int rules[6][2][3] = {{{1,L,1},{1,L,0}},
@Parcly-Taxel
Parcly-Taxel / peano.v
Created April 15, 2020 07:45
A mechanisation of Peano arithmetic theorems in Coq
Inductive nat : Set :=
| O : nat
| S : nat -> nat.
Theorem zero_no_succ: forall n, S n <> O.
Proof. intros. unfold not. intro H0. inversion H0. Qed.
Theorem succ_eq_succ: forall m n, S m = S n -> m = n.
Proof. intros. inversion H. reflexivity. Qed.
@Parcly-Taxel
Parcly-Taxel / oneplus.py
Last active February 3, 2022 21:34
1+ and 0-1+2 interpreters
#!/usr/bin/env python3
# 1+ interpreter with : not printing newline
# as discussed at https://codegolf.stackexchange.com/q/209529/110698
# Parcly Taxel, 2022
# https://gist.github.com/Parcly-Taxel/0bc9ed77c2f6fe0e4ec976d3121e340a
import sys
from collections import deque
s, sd = deque(), {}
@Parcly-Taxel
Parcly-Taxel / paths.py
Created November 25, 2019 13:48
Kinross and Shinjuku sample code
# From Kinross
# Bézier curves, elliptical arcs, lines, ellipses and paths
import numpy as np
from functools import lru_cache
from cmath import rect, polar
from .matrices import mt
from .algebra import ccquad, fproot
from .regexes import pcomm_re, number_re, sf, ssf
from .bernpol import berneval, bernmul, bernraise, bernder
from .bernpol import bernroots, bernvdm, x_conic
@Parcly-Taxel
Parcly-Taxel / phyllo.py
Created August 23, 2019 08:18
Phyllotaxis convex hulls
#!/usr/bin/env python3.7
import numpy as np
N = 1024
rng = np.arange(N) + 1
theta = rng * np.pi * (3 - np.sqrt(5))
r = 5 * np.sqrt(rng)
pts = r * (np.cos(theta) + 1j * np.sin(theta))
with open("phyllo.svg", 'w') as f: