Skip to content

Instantly share code, notes, and snippets.

View Zeta611's full-sized avatar
🎯
Focusing

Jay Lee Zeta611

🎯
Focusing
View GitHub Profile
@Zeta611
Zeta611 / .latexmkrc
Created April 21, 2024 18:14
[.latexmkrc] latexmk recipe for LuaLaTeX + shell-escape
$pdf_mode = 4;
set_tex_cmds('%O --shell-escape %S');
@Zeta611
Zeta611 / mkdoc.sh
Created March 21, 2024 14:44
[mkdoc.sh] Make a LaTeX document #automation
#!/bin/bash
name="$1"
if [ -z "$name" ]; then
echo "Usage: $0 <name>"
exit 1
fi
mkdir "$name"
@Zeta611
Zeta611 / decrypt_pdfs.sh
Created April 20, 2023 14:09
[Decrypt PDFs] #automation
#!/bin/bash
# Check if qpdf is installed
if ! command -v qpdf >/dev/null; then
echo "qpdf not found. Please install qpdf and try again."
exit 1
fi
# Check if enough arguments are supplied
if [ "$#" -lt 3 ]; then
@Zeta611
Zeta611 / merge_pdfs.sh
Created April 20, 2023 13:53
[Merge PDFs] #automation
#!/bin/bash
# Check if qpdf is installed
if ! command -v qpdf >/dev/null; then
echo "qpdf not found. Please install qpdf and try again."
exit 1
fi
# Check if enough arguments are supplied
if [ "$#" -lt 3 ]; then
@Zeta611
Zeta611 / isbn.py
Last active February 15, 2023 04:46
[Real World Web Scraping] I used this script to find and parse missing ISBNs to help a librarian. Fixed 700+ books, took 3 hours to write. #automation #demo
from bs4 import BeautifulSoup
import re
import requests
import webbrowser
registrationNumbers = [
"HHA000010715",
"HHA000010711",
"HHA000001827",
@Zeta611
Zeta611 / Zcombinator.swift
Created August 9, 2022 12:53
[Fixed-point combinator in Swift] Fixed-point combinator (Z combinator) in Swift. Y combinator is not available, as Swift is a strict language. #demo
struct Fix<T> {
let x: (Fix<T>) -> T
}
func fix<T, U>(f: @escaping (@escaping (T) -> U) -> ((T) -> U)) -> (T) -> U {
{ _fix in
f { (_fix.x(_fix))($0) }
}(
Fix { _fix in
f { (_fix.x(_fix))($0) }
@Zeta611
Zeta611 / z_combinator.ml
Created August 9, 2022 12:55
[Fixed-point combinator in OCaml] Fixed-point combinator (Z combinator) in OCaml. Y combinator is not available, as OCaml is a strict language. #demo
type 'a fix = Fix of ('a fix -> 'a)
let fix f =
(fun (Fix x as fix) -> f (fun z -> x fix z))
(Fix (fun (Fix x as fix) -> f (fun z -> x fix z)))
let factorial = fix @@ fun f n -> if n <= 0 then 1 else n * f (n - 1)
@Zeta611
Zeta611 / List.swift
Last active August 9, 2022 12:51
[List] Demonstration of a recursive data type in Swift #algorithm #demo
precedencegroup ListOperationPrecedence {
associativity: right
higherThan: MultiplicationPrecedence
}
infix operator ++: ListOperationPrecedence
infix operator |*: ListOperationPrecedence
indirect enum List<T> {
case `nil`
@Zeta611
Zeta611 / String+disjointedHangul.swift
Last active July 11, 2022 12:45
[String+disjointedHangul] Extends `disjointedHangul` method to `String` #extension #iOS
//
// String+disjointedHangul.swift
//
// Created by Jay Lee on 08/03/2019.
// Copyright © 2019 Jay Lee <jaeho.lee@snu.ac.kr>
// This work is free. You can redistribute it and/or modify it under the
// terms of the Do What The Fuck You Want To Public License, Version 2,
// as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
//
@Zeta611
Zeta611 / ViewController.swift
Last active April 4, 2022 05:10
[ViewController Template] #iOS #template
//
// ViewController.swift
//
// Created by Jay Lee on 08/23/2019.
// Copyright © 2019 Jay Lee <jaeho.lee@snu.ac.kr>
// This work is free. You can redistribute it and/or modify it under the
// terms of the Do What The Fuck You Want To Public License, Version 2,
// as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
//