Skip to content

Instantly share code, notes, and snippets.

# This is a GNU Make file specifically designed for building PDF books from a directory of images.
# It can process multiple images concurrently with `make --jobs=8`.
#
# Every book is different and has different processing requirements,
# and it often makes sense copying this file and adapting it for an individual book.
# Adapting usually involves modifying in non-trivial ways the targets for the individual pages.
#
# The script builds a PDF file with a table of contents and an OCR layer.
# I used to build DjVu files instead because of their better image compression, but I learned that
# it's better to provide a PDF myself than to let people use bad converters.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@v--
v-- / party_mode.ipynb
Last active August 26, 2022 10:17
Achieve full runtime nondeterminism by randomly selecting which function to run
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@v--
v-- / distributions.ipynb
Last active January 30, 2022 20:37
Distributions meme
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@v--
v-- / pointer_arithmetic.d
Last active June 26, 2020 22:20
I saw a joke tweet some time ago about encoding natural numbers in levels of pointer indirection and doing arithmetic with them. This is different from what is usually called pointer arithmetic, however it is arithmetic and it involves pointers. I decided to implement addition and multiplication.
/+ dub.sdl:
name "pointer_arithmetic"
+/
import std.traits : isPointer, PointerTarget;
template IndirectionCounter(T)
{
static if (isPointer!T)
enum IndirectionCounter = 1 + IndirectionCounter!(PointerTarget!T);