Skip to content

Instantly share code, notes, and snippets.

View gist:07628e5bd7ddf40bdad7c757d7ea7142
Lemma 2: ("Real Induction") Let A be a subset of real numbers.
If
(0) α ∈ A
(1) ∀x ∈ A. ∃y. [x,y) ⊆ A
(2) ∀xy. [x, y) ⊆ A ⇒ y ∈ A
then [α,∞) ⊆ A.
Proof:
Suppose towards a contradiction that [α,∞) ∖ A is nonempty. Set β = inf ([α,∞) ∖ A).
(1) means we can't have β ∈ A, because it would collide with the infimum.
@jcreedcmu
jcreedcmu / self-modify.ts
Created March 17, 2023 22:35
Snippet of typescript that modifies itself in an emacs buffer
View self-modify.ts
/***
* A little bit of research into what would be needed for a "direct manipulation" toy in emacs.
* - NodeJS allows replacing `Error.prepareStackStrace` with a custom handler that can obtain
* first-class stack trace data.
* - An arbitrary function call (see below, `knob(1429)` for example) can obtain a stack
* trace and inspect it to find out where in the file the actual call to knob(1429) took place.
* - Since we're in typescript, we can also find the sourcemap and use it to map this into
* a location into the original `.ts` file.
* - We can shell out to emacsclient to evaluate arbitrary elisp
* - It can in turn go to the appropriate place in the active buffer viewing the `.ts` file,
@jcreedcmu
jcreedcmu / b.cc
Last active December 28, 2022 16:49
minimal sdl2/opengl example
View b.cc
// g++ -I/usr/local/include/SDL2 -I/usr/include/GL b.cc -lSDL2 -lGL -lGLU -o b
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <gl.h>
static SDL_Window *window;
static SDL_Renderer *renderer;
#define width 640
@jcreedcmu
jcreedcmu / collab.js
Created November 30, 2022 23:34
collabradoodle renderer
View collab.js
const W = 52;
const H = 30;
const MAX_ITER = 1000;
function iters(cr, ci) {
let zi = 0;
let zr = 0;
for (let i = 0; i < MAX_ITER; i++) {
[zr, zi] = [zr * zr - zi * zi + cr, 2 * zr * zi + ci];
if (zr * zr + zi * zi > 16.0) return i;
View gist:74ffc069723cf7622a043596cd4c2bc4
5403 Friendship Avenue.
Henry Wright Fisher loĝis ĉi tie en 1912.
Sr. Fisher naskiĝis en Youghal, Ireland, Januaro 31, 1861, la filo de
Abram kaj Sara (Wright) Fisher. Li alvenis al Usono je 1874, kaj post
dekkvar jaroj, ricevis diplomon pri mekanika inĝenierarto de la
universitato Cornell. Post diplomiĝo, li ligiĝis kun la entrepreno
Bergman & Co. kaj la C. & C. Motor Company, kaj poste eniris la
servicon de Standard Underground Cable Company, fariĝinte ĝia
@jcreedcmu
jcreedcmu / delimiters.txt
Created June 20, 2022 19:57
unicode left/right pairs
View delimiters.txt
# # I ran the following perl script on the file
# # https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt:
#
# #!/usr/bin/perl
#
# use charnames();
# use utf8;
# use open qw( :std :encoding(UTF-8) );
# use File::Basename;
#
@jcreedcmu
jcreedcmu / penrose.ts
Created May 9, 2022 22:40
penrose tiles
View penrose.ts
import { Point, rot90, rotate, vdiv, vdot, vplus, vscale } from './point';
const NARROW_COLOR = '#ffffff';
const WIDE_COLOR = '#7777ff';
const BG_COLOR = WIDE_COLOR; // '#dff';
const LINE_WIDTH = 0.25;
const width = 1024;
const height = 768;
const OFF_MIN = -9;
View curves
# GIMP 'Curves' settings
(time 0)
(linear no)
(channel value)
(curve
(curve-type smooth)
(n-points 17)
(points 34 0.000000 0.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 1.000000 1.000000)
(n-samples 256)
View 4ct.js
function prodf(xs, ys, f) {
const rv = [];
for (let i = 0; i < xs.length; i++) {
for (let j = 0; j < ys.length; j++) {
rv.push(f(xs[i], ys[j]));
}
}
return rv;
}
@jcreedcmu
jcreedcmu / imaginary-book-club.md
Created March 13, 2022 15:55
Imaginary Book Club
View imaginary-book-club.md

Welcome to imaginary book club! I hope everyone finished the reading this week. No? Fine, we'll just wing it. At least there's snacks.

There is a deck of cards. Each has a question on it. Play starts with a random player and proceeds in a circle, with each player drawing a card and answering the question. The first two are always:

  • What is the book's title?
  • What is the book's genre?