Skip to content

Instantly share code, notes, and snippets.

View hexclover's full-sized avatar

hexclover hexclover

View GitHub Profile
@hexclover
hexclover / nju-course-to-ics.py
Last active December 1, 2023 06:24
NJU course schedule => iCalendar: A quick and dirty script to convert JSON data downloaded from NJU ehall containing course schedule to ICalendar file (.ics).
#!/usr/bin/env python3
import json
import uuid
import datetime as dt
from dataclasses import dataclass
firstDayOfTerm = dt.date(year=2023, month=9, day=4)
lessonStartTime = list(map(dt.time.fromisoformat, ['08:00','09:00','10:10','11:10','14:00','15:00','16:10','17:10','18:30', '19:30','20:40','21:30']))
lessonDuration = dt.timedelta(minutes=50)
@hexclover
hexclover / church.cpp
Created August 5, 2022 09:29
Church numerals in C++ template (including subtraction)
#define testNum(num, val) \
do { \
static_assert(FromChurch<num>::get == (val)); \
static_assert(FromChurch<Pred::template Ap<num>::V>::get == \
((val) > 0 ? (val)-1 : 0)); \
} while (0)
#define testOp(op, a, b, exp) \
do { \
static_assert( \
FromChurch<op::template Ap<a>::V::template Ap<b>::V>::get == \