Skip to content

Instantly share code, notes, and snippets.

Avatar

Jay LaPorte ironwallaby

View GitHub Profile
View toki_pona.md

I found these Toki Pona snippets while going through old diaries. What do they mean?

  • 5 May 2011: kulupu pi waso pimeja li toki. ona li toki e seme? jan sona sewi li sona ala, taso ni li pona.
  • 6 May 2011: "ali nasin li nasa a. jan li kama jo e seme tan pali mute?"
  • 10 May 2011: "jan lili li musi e supa musi. tenpo li sama e ni. jan lili li jo e ma pi jan lawa."
  • 15 May 2011: jan pi tenpo pini li sona e sona walo. jan pi tenpo ni li sona e sona alasa. ante tan seme?
  • 16 May 2011: "o sona e nasin mije. taso o pali e nasin meli. o jo e ma ali. sina pali e ni la sina jo e ken sama jan lili."
  • 31 May 2011: "o toki e jan ike la jan ike li kama."
  • 31 May 2011: ala li kama e wan. wan li kama e tu. tu li kama e ali. ala li sama e ali tan ni.
  • 2 Jun 2011: a! ali li musi lon tenpo suno ni. luka kasi li tawa musi li kalama musi poka mi.
View incremental_linear_regression.js
// This class implements an incremental 2D linear regression.
// You feed it x and y values, and it'll fit a line to it.
class Regression {
constructor() {
this.n = 0;
this.x = 0;
this.y = 0;
this.xx = 0;
this.xy = 0;
}
View ghg_emissions_of_beverage_containers.md

On the Greenhouse Gas Emissions of Beverage Containers

The EPA makes data available on the lifecycle greenhouse gas emissions of various industrial products, including those used for containing beverages. I have collected the relevant ones below:

Material Type Emissions
Aluminum¹ Virgin 10.97 MTCO₂E/sh tn
PET Virgin 2.26 MTCO₂E/sh tn
Aluminum¹ Recycled 2.08 MTCO₂E/sh tn
PET Recycled 1.01 MTCO₂E/sh tn
View cubic_spline_interpolation.js
// Given four points [ax,ay], [bx,by], [cx,cy], [dx,dy], such that
// ax < bx < cx < dx, draw a cubic spline along them. Now, given some
// x such that bx <= x <= cx, what is the corresponding y such that
// [x,y] is on the spline?
function interpolate(ax, ay, bx, by, cx, cy, dx, dy, x) {
const t = (x - bx) / (cx - bx);
const h_00 = 2 * t * t * t - 3 * t * t + 1;
const h_10 = t * t * t - 2 * t * t + t;
const h_01 = -2 * t * t * t + 3 * t * t;
const h_11 = t * t * t - t * t;
View crochet_stitches.md

properties of crochet stitches

I couldn't find a precise measure of the properties of various crochet stitches, so I started recording them myself. These are taken from my own hand, using worsted weight cotton yarn. I imagine that different hands and different yarns will produce slightly different results.

stitch width height weight time speed
sc 6.9 mm 6.0 mm ? 3.5 s 11.8 mm^2/s
hdc 6.9 mm 7.2 mm ? 4.0 s 12.4 mm^2/s
dc ? ? ? ? ?
  • most square: hdc
View carbon_neutrality.md

I own about 25 acres of property, of which about 22 acres is cleared land. I wanted to how much of it I would need to reforest in order to offset my carbon footprint.

The average carbon footprint of a New Yorker (in 2014, the latest data I was able to find) is 8.61 metric tons per year. (I probably use less than average, given that I aggressively buy local, don’t commute, don't fly, etc., but let’s assume I’m average.) The average carbon sequestration of a maple-beech climax forest (like the one that existed where my house is a century ago) is [1760 pounds of CO2 per acre per year after 25 years][2]—less before that, more after that, but let’s assume that over the rest of my life it’ll all average out to that 25-year value. (I certainly hope I never need to move again, and I probably have 50 years or so left in me.)

That suggests I can offset the carbon of [(22 acres) (1760 lb / acre / yr) (1 yr / 8.61 t) ≅ 2][3] New Yorkers with what I have.

View maple_wine_and_traditional_mead.txt
Date: Fri, 16 Oct 92 18:03:25 EDT
From: john@rsi.com (John Gorman)
Subject: Maple Wine and Traditional Mead
The question was asked: what would a mead made with pure maple
syrup taste like? Now on my sixth batch, I can say "like ambrosia."
The maple syrup grading system was invented when maple syrup was
competing with cane sugar, so bland lite was considered Grade A.
For brewing, Grade B Dark is better, and much cheaper. It can be
View simplest_fraction.js
// Find the simplest fraction to represent a number within a given range.
// http://blog.plover.com/math/age-fraction-2.html
// https://en.wikipedia.org/wiki/Stern%E2%80%93Brocot_tree
function simplest_fraction(min, max) {
let ln = 0;
let ld = 1;
let rn = 1;
let rd = 0;
View cofliq.md

cofliq

i am still experimenting with this but it is quite good

ingredients

  • 2 c. water
  • ¾ c. instant coffee
  • 3 c. sugar
You can’t perform that action at this time.