Skip to content

Instantly share code, notes, and snippets.

View lygaret's full-sized avatar

Jonathan Raphaelson lygaret

View GitHub Profile
lygaret / psf.zig
Created September 16, 2022 03:27
PSF (PC Screen Font) comptime loader in zig
const std = @import("std");
/// PSF font-file loading, into an easy to render format
/// {buildFont} takes a path to a font file, and returns a struct wrapping that
/// font with the ability to easily get an iterator of pixels over charactors
/// @see
const PSF1_MAGIC: [2]u8 = .{ 0x36, 0x04 };
lygaret / .yardopts
Last active June 9, 2022 07:57
gem - method hooks
-m markdown
--default-return void
lygaret / .yardopts
Last active June 9, 2022 08:02
gem - string-inquirer
-m markdown
--default-return void
lygaret / reloader.rb
Last active November 27, 2021 07:36
override `Kernel.require` to track loaded files, and allow reloading
require 'pp'
class Reloader
def initialize
# normalized path => mtime
@mtimecache =
# normalized path => load path
# this will only lookup once, storing _nil_ in the cache if not found
lygaret / memo.ts
Created November 24, 2020 23:13
typescript dynamic memoization (rspec let)
type MemoProps<T> = { [P in keyof T]: (this: T) => T[P] }
export const MemoProto = {
clone: function () {
return this.define({});
define: function define<T>(this: T & {}, props: MemoProps<T>): MemoState<T> {
// share the prototype, so we can nest but still destroy
const update = Object.create(this);

Hey Friendly @here,

Watching the uprisings across the country this week, and feeling a deep intertwined uncomfort at my own privilege and comfortable position, I am looking for ways to contribute that aren't simply idle cheerleading and amplification [1], and that reach further than simple bail fund donations [2].

[1]: which is perfectly fine, of course, but Twitter isn't action [2]: which, if you can, do:

One piece of advice I've seen handed around is that it's my job, as a relatively rich white person, as a person who is allowed to systemically ignore issues of justice in the world around me, to educate myself and those around me on "what's going on", and that I can't expect POC to do that work for me.

So, I'd like to invite whomever would like to join to read some books I've seen mentioned, starting with:

lygaret / clustering.rb
Created July 13, 2017 15:59
ruby module for kmeans clustering (1d)
# Methods for clustering data
module Clustering
# k-means clustering for 1d data
# pass a block to project from an element into a number
def self.kmeans_1d(data, k: 2, &projection)
return [data] if k == 1
if data.to_a.uniq(&projection).length < 2
return [data].concat((k - 1).times.collect { [] })
lygaret / PKGBUILD
Created February 21, 2017 19:22
PKGBUILD for installing npm2arch from @MazeChaZer's updated dependencies branch
pkgname=nodejs-npm2arch-updated-deps-git # All lowercase
pkgdesc="Convert NPM package to a PKGBUILD for ArchLinux, patched for recent dependencies."
depends=('nodejs' 'npm' )

Keybase proof

I hereby claim:

  • I am lygaret on github.
  • I am lygaret ( on keybase.
  • I have a public key ASCH_bCflDF9Q17IZVv7ox1t0p56et_SBdQSk5MQ-tFOYgo

To claim this, I am signing this object: