Skip to content

Instantly share code, notes, and snippets.

View ldct's full-sized avatar

Li Xuanji ldct

View GitHub Profile
@ldct
ldct / det.lean
Last active January 4, 2026 15:03
det.lean
import Mathlib
def E₆ : Matrix (Fin 6) (Fin 6) ℤ :=
!![ 2, 0, -1, 0, 0, 0;
0, 2, 0, -1, 0, 0;
-1, 0, 2, -1, 0, 0;
0, -1, -1, 2, -1, 0;
0, 0, 0, -1, 2, -1;
0, 0, 0, 0, -1, 2]
@ldct
ldct / bt.lean
Created January 4, 2026 04:47
bt.lean
/-
This file was edited by Aristotle.
Lean version: leanprover/lean4:v4.24.0
Mathlib version: f897ebcf72cd16f89ab4577d0c826cd14afaafc7
This project request had uuid: b78c420c-a6ac-4943-aaee-2bdbd23df478
The following was proved by Aristotle:
- lemma idlem (g : SO n) : (@cpoly n g).roots.count 1 = n → g = 1
@ldct
ldct / test.swift
Created October 24, 2025 20:21
async vs publisher
import Combine
public extension Publisher where Output: Sendable, Failure == Never {
func next(_: isolated (any Actor)? = #isolation) async -> Output {
var scopedCancellables = Set<AnyCancellable>()
return await withUnsafeContinuation { continuation in
self.first().sink { value in
continuation.resume(returning: value)
scopedCancellables.removeAll()
}.store(in: &scopedCancellables)
@ldct
ldct / published-struct.swift
Created October 24, 2025 19:54
Swift playgrounds
//: A UIKit based Playground for presenting user interface
import Combine
struct ViewState {
var a: Int
var b: Int
}
class MyClass {
@ldct
ldct / compact-wide.txt
Created August 24, 2024 02:44
layout examples
x Y Z
x as small as possible
Y and Z same width
@ldct
ldct / demo.txt
Last active June 8, 2024 15:59
teoria wrapper demo
➜ deno run teoria.ts Eb7add11
[ "eb", "g", "bb", "db", "ab" ]
func sum(a: Int?, b: Int?) -> Int? {
a.flatMap({ unwrappedA in
b.flatMap({ unwrappedB in
.some(unwrappedA + unwrappedB)
})
})
}
func sum(_ a: [Int], _ b: [Int]) -> [Int] {
class SuperClass {
public var customInt: Int? {
didSet {
print("super")
}
}
}
class ChildClass: SuperClass {
override public var customInt: Int? {
Ariana Grande, Taylor Swift, Jonas Brothers, Katy Perry, My Chemical Romance, Beyonce, Rihanna, Lizzo, BTS, Charli Damelio, Shakira, Miley Cyrus, Selena Gomez, Nick Jonas, Demi Lovato, Billie Eilish, Justin Beiber, Joji, Arctic Monkeys, Lana Del Rey, Drake, Eminem, Maddona, Camilla Cabello, Little Mix, Shawn Mendes, Fifth Harmony, Eminem, One Direction, Adele, Avicii, Bruno Mars, Charli XCX, Britney Spears, BlackPink, Kacey Musgraves, Calvin Harris, Nicki Minaj, Cardi B, Chris Brown, Michael Jackson, Charlie Puth, Coldplay, DJ Khaled, The Chainsmokers, Doja Cat, Dua Lipa, Ed Sheeran, Lady Gaga, Ellie Goulding, Harry Styles, Zayn Mallik, Niall Horan, Loius Tomlinson, Liam Payne, Justin Timberlake, Iggy Azealea, Jay Z, Jessie, Jason Derulo, Melanie Martinez, Khalid, Kanye West, Kesha, Meghan Trainor, Macklemore, Pink, Pitbull, Post Malone, Rita Ora, Sia, Sam Smith, Usher, Travis Scott, Troye Sivan, Conan Gray, The Weekend, The Vamps, Zedd, 5SOS, Mxmtoon.
#!/usr/bin/env python3
from collections import deque
T = int(input())
def ans(maze):
N = len(maze)
M = len(maze[0])