Skip to content

Instantly share code, notes, and snippets.

@v--
v-- / build-scanned-books.fish
Last active Feb 4, 2022
build-scanned-books.fish
View build-scanned-books.fish
#!/usr/bin/env fish
# This is a fish shell script for building DjVu and PDF books from a directory of images.
# Every book is different and has different processing requirements,
# and it often makes sense copying this script and adapting it for an individual book.
# Adapting usually involves modifying in non-trivial ways the process-page subroutine or the DjVu and PDF build steps.
#
# The script builds a DjVu file with a table of contents and an OCR layer.
# The DjVu file is then also converted to PDF because people tend to like PDFs more.
# You can also create PDFs directly, but this usually results in much much larger files.
View vaccine_efficiency_bulgaria.ipynb
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 Jan 1, 2022
Achieve full runtime nondeterminism by randomly selecting which function to run
View party_mode.ipynb
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 Jan 30, 2022
Distributions meme
View distributions.ipynb
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 Jun 26, 2020
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.
View pointer_arithmetic.d
/+ dub.sdl:
name "pointer_arithmetic"
+/
import std.traits : isPointer, PointerTarget;
template IndirectionCounter(T)
{
static if (isPointer!T)
enum IndirectionCounter = 1 + IndirectionCounter!(PointerTarget!T);