Skip to content

Instantly share code, notes, and snippets.

View jrk's full-sized avatar

Jonathan Ragan-Kelley jrk

View GitHub Profile
@jrk
jrk / .gitignore
Last active August 29, 2015 14:01
Halide Mac build test
lesson_01
lesson_01.dSYM

Keybase proof

I hereby claim:

  • I am jrk on github.
  • I am jrk (https://keybase.io/jrk) on keybase.
  • I have a public key whose fingerprint is F289 7F25 58F7 4987 2540 FB05 A7CB CFB8 7DC2 BDB2

To claim this, I am signing this object:

@jrk
jrk / whats_wrong_with_tex.md
Last active November 21, 2022 03:04
What's wrong with TeX

(Prompted by a thread on HackerNews, which quickly transitioned into debating the merits of LaTeX as a markup language and typesetting system: https://news.ycombinator.com/item?id=7278907.)

[TikZ] is a perfect example of TeX's missed potential: it is an outstandingly well designed DSL for diagram creation, embedded in an insane macro language. The moment you try to do anything nontrivial that exploits the programmatic (rather than purely declarative) nature of TikZ you immediately run into wall after wall trying to express basic programming concepts in the host language, TeX.

For example, two common patterns I have seen frequently arise as perfect uses for a programmatic diagram description:

  • using computed coordinates and transforms to construct complex paths and diagram layouts from the composition of basic geometric reasoning;

  • using abstraction to tersely encapsulate common visual components, both for simple iteration over many similar components, or for higher-order encapsulation of

@jrk
jrk / words_changed.py
Created February 20, 2014 21:52
Count words changed in plain text by parsing color codes in git diff --color-words output
#!/usr/bin/env python
import sys, re
import datetime
from subprocess import Popen, PIPE
rev_cmd = 'git rev-list -n1 --before="%s" master'
diff_cmd = 'git diff --color-words $(%s) -- *.md' % rev_cmd # FIXME: hard coded to markdown files
def count_changed(stream):
@jrk
jrk / .gitignore
Last active August 29, 2015 13:56
Halide multi-pipeline CUDA initialization bug
hl
process
initialize_halide.o
visualize_halide.o
initialize_halide.h
visualize_halide.h
@jrk
jrk / ulimit_out_of_memory.cpp
Created February 17, 2014 22:07
Halide test for error behavior when ulimits prevent sufficient memory allocation
// NOTE: these setrlimit APIs are not implemented in OS X. This should only actually catch failure on Linux.
// TODO: also test overflow on output, intermediate allocations
#include <Halide.h>
#include <stdio.h>
#include <sys/resource.h>
using namespace Halide;
size_t memory_limit_bytes = 1024*1024*128; // 128MB - plenty for Halide, not enough for buffers
@jrk
jrk / README.md
Created October 24, 2013 16:26
A trivial Keynote '13 document `Index` tree

An example of a Keynote '13 Index tree, unpacked from a document bundle.

  • The document uses the default black template
  • It has two slides:
    • Slide 1 is a simple Title format slide, with title line "My title" and secondary line "My author"
  • Slide 2 is a simple bullet slide with headline "Some heading", a single bullet "Some bullet", and presenter notes "These are presenter notes." (in the default note style, which uses Avenir regular/black as the font)
Sampling process 8459 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Simplenote (pid 8459) every 1 millisecond
Process: Simplenote [8459]
Path: /Applications/Simplenote.app/Contents/MacOS/Simplenote
Load Address: 0x1019e5000
Identifier: com.automattic.SimplenoteMac
Version: 1.0.1 (20)
Code Type: X86-64 (Native)
Parent Process: launchd [133]
#define AUTOTUNE_N 1024,1024
#include <Halide.h>
using namespace Halide;
int main(int argc, char **argv) {
ImageParam in_img(UInt(16), 2);
Func blur_x("blur_x"), blur_y("blur_y");
Var x("x"), y("y"), xi("xi"), yi("yi");