Skip to content

Instantly share code, notes, and snippets.

View justinmeiners's full-sized avatar

Justin Meiners justinmeiners

View GitHub Profile

The axiom of choice says that for an infinite set of disjoint nonempty sets, we can find a set with one element from each. In others we can choose an element.

The axiom of choice is needed only when there is no clear way to choose. For example if the disjoint sets were integers, we could always explicitly pick the smallest, but for sets of sets, there isn't a clear way to pick.

Finite Set proof

Axiom of Choice = Cartesian Product

It postulates the existence of a set which is not uniquely determined, of which we know only some properties.

@justinmeiners
justinmeiners / btree.inl
Created June 15, 2019 17:23 — forked from pervognsen/btree.inl
Experiments in lightweight C templates
// Here is btree.inl, which is the thing you would write yourself.
// Unlike C++ templates, the granularity of these lightweight templates is at the
// module level rather than the function or class level. You can think of it like
// ML functors (parameterized modules) except that there isn't any static checking
// of signatures (in that respect, it's like C++ templates). In my view, this style
// of parameterized generative modules is generally the better conceptual framework.
// This is a completely valid C file even prior to preprocessing, so during library
// development you can just include this file directly. That is a big win for testing
@justinmeiners
justinmeiners / curl.md
Created June 3, 2019 19:41 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

The page should be designed like a series of filters. Each function inputs a DOM tree, and returns a modified DOM tree. Filters can be chained together to produce the final results. Different filters can be chosen conditionally at each stage.

1. DOM stripping.

This phase is a removal of elements which are not relevant to text. Certain tags, can be completely blacklisted. These include:

  • <button>
  • <input>
  • <script>
  • <canvas>
  • ``
@justinmeiners
justinmeiners / mccarthy.lisp
Created February 16, 2019 17:56
Mirror from Paul Graham's site. (I don't want to keep hunting down that link.)
; The Lisp defined in McCarthy's 1960 paper, translated into CL.
; Assumes only quote, atom, eq, cons, car, cdr, cond.
; Bug reports to [email protected].
(defun null. (x)
(eq x '()))
(defun and. (x y)
(cond (x (cond (y 't) ('t '())))
('t '())))
@justinmeiners
justinmeiners / forth.md
Last active February 11, 2022 15:09
Notes on the Forth programming language.
@justinmeiners
justinmeiners / jonesforth.f.txt
Last active October 1, 2021 22:14
How to write a Forth compiler. Mirror of Jonesforth (I did not write this.)
\ -*- text -*-
\ A sometimes minimal FORTH compiler and tutorial for Linux / i386 systems. -*- asm -*-
\ By Richard W.M. Jones <[email protected]> http://annexia.org/forth
\ This is PUBLIC DOMAIN (see public domain release statement below).
\ $Id: jonesforth.f,v 1.17 2007/10/12 20:07:44 rich Exp $
\
\ The first part of this tutorial is in jonesforth.S. Get if from http://annexia.org/forth
\
\ PUBLIC DOMAIN ----------------------------------------------------------------------
\
@justinmeiners
justinmeiners / factorial.cpp
Created February 5, 2019 05:18
The template meta-programming "Hello World".
#include <iostream>
template<int N>
struct Factorial {
enum {
value = N * Factorial<N - 1>::value,
};
};
template <>