Skip to content

Instantly share code, notes, and snippets.

View hhenrichsen's full-sized avatar

Hunter Henrichsen hhenrichsen

View GitHub Profile
import {
Icon,
Line,
Rect,
Txt,
makeScene2D,
IconProps,
RectProps,
TxtProps,
} from "@motion-canvas/2d";
import {Nord} from '@hhenrichsen/motion-canvas-nord';
import {Layout, Line, Rect, Txt} from '@motion-canvas/2d';
import {makeScene2D} from '@motion-canvas/2d';
import {CodeBlock} from '@motion-canvas/2d/lib/components/CodeBlock';
import {
Reference,
Vector2,
createRef,
makeRef,
range,

Generated with:

$ ffmpeg -framerate 15 -i %06d.png -movflags faststart -pix_fmt yuv420p -vf "fps=15" output.mp4

Motion Canvas Lines/Rects Helpers

Here are a couple line/rect helpers that you can use to do fancy stuff in a bit of a more straightfoward way when determining where to draw lines using Motion Canvas.

Todo:

  • Figure out how to get this to work nicely with corner radius.
  1. Create a Motion Canvas project.
  2. Run npm install --save mathjax-full
  3. Add the script tex.ts below somewhere
  4. Do something like the following:
export default makeScene2D(function* (view) {
  const tex = texToBase64SVG('{\\color{white} x = \\sin \\left( \\frac{\\pi}{2} \\right) }');

  const image = createRef<Image>();
 view.add();

Hunter's Debug Evaluator

This is a simple little module that I use to figure out why programs are giving different output with the same input. Not a common problem, but one I've been asked enough for it to matter.

How to Use

Here's a simple file that might fail unexpectedly:

import numpy as np
from eval import save_dict, dump_saves

Hunter's Event Target System

Here is a little event system I've been working on for Python. I've been trying to make it typesafe as possible, hence the generics and depending on specific classes for event info. This system has a couple neat features:

  1. Automatic event ID creation/decorator based event creation
  2. Events call parent events
  3. Low overhead (computations on IDs are done once and saved, simple dictionary based listener structure)
[alias]
co = checkout
s = status
c = commit
unstage = restore --staged --
pf = push --force-with-lease
new-branch = !git fetch -p && git stash push --include-untracked && git checkout master && git pull && git checkout -b \"$USER-$1\" && :
current-branch = branch --show-current
new-user-branch = !git fetch -p && git stash push --include-untracked && git checkout master && git pull && git checkout -b \"$USER-$1\" && :
# oldest-ancestor from https://stackoverflow.com/a/4991675
@hhenrichsen
hhenrichsen / gx
Last active September 2, 2021 17:32
#!/bin/bash
get_id () {
PATTERN=$@
COMMIT_ID=$(gx l | grep "$PATTERN" | grep -v "fixup!" | cut -f1 -d' ' | head -n1)
echo "$COMMIT_ID"
shift
}
amend_all () {