Skip to content

Instantly share code, notes, and snippets.

(* a + b (mod m) *)
let addmod a b m =
assert (0 <= a && 0 <= b);
let a = a mod m in
let b = b mod m in
if a < m - b then
(* Case A: a + b < m *)
a + b
else
(* Case B: a + b >= m
@camlspotter
camlspotter / bluesky.sh
Created July 4, 2023 02:39
Access BlueSky
# You need
#
# - curl
# - jq
# Your handle, ex xxxx.bsky.social or your custom handle like dailambda.jp.
# No '@' mark.
HANDLE=hogehoge.bsky.social
# Your App password: Settings > App password > Add App password
@camlspotter
camlspotter / bsky_lexicon.ml
Created July 12, 2023 02:34
BlueSky Lexicon type defs in OCaml
type unknown
type blob
type cid_link
type 'a nullable = 'a option
type actor_adultContentPref = {
enabled: bool }