Skip to content

Instantly share code, notes, and snippets.

View ssteinbach's full-sized avatar
😀
hello

Stephan Steinbach ssteinbach

😀
hello
View GitHub Profile
@ssteinbach
ssteinbach / gifify.py
Last active September 22, 2018 22:16
Gifify: quick python script to turn movies into gifs with ffmpeg
#!/usr/bin/env python
"""Use ffmpeg to turn a movie into a .gif."""
import os
import argparse
import subprocess
def parse_args():
""" parse arguments out of sys.argv """

Goals:

  • terminal-based development environment
  • running on big sur
  • use tmux + neovim for most development things,
  • mostly developing in C++, python, lua and DSLs (quadplay, glsl, etc)
  • trade brew for conda:
    • conda runs on linux, mac and windows (although I haven't tried it on windows)
    • conda installs into user space, so its easier to trash/reset without impacting system paths (brew installs into /usr/local and I believe symlinks into system directories)
    • you can create multiple isolated environments... useful for dealing with conflicting dependencies and for testing
  • encapsulates both python and C++ in its environments
@ssteinbach
ssteinbach / pkg_resources_alternatives.md
Last active April 5, 2021 23:29
pkg_resources alternatives

PKG-Resource Entry Points: Problems/Alternatives

Introduction

This gist summarizes some issues with using the python pkg_resources module, in particular its entry_points functionality for python plugin support, specifically in the context of how the OpenTimelineIO project uses it.

Background

The setuptools module is the older system for packaging and installing python code. The pkg_resource module from setuptools can be used to look up information about packages that have been installed.

@ssteinbach
ssteinbach / itb_enemies_first_area.md
Last active April 6, 2021 05:32
Enemy Design in Into the Breach's First Area

Enemy Design in Into the Breach's First Area

Introduction

Into the breach is an elegant tactical roguelike game. On a roughly 8x8 grid, a turn based battle takes place where a player team with about 3 units takes on a number of enemies, in an effort to defend the buildings in the area for about 5 turns.

Each player unit is given one action and one move, and the move must occur

@ssteinbach
ssteinbach / test_zig_lldb.md
Last active September 30, 2021 05:26
How to run `test` blocks in zig in a debugger

How to run test blocks in zig in a debugger

Test Code

For example, you can try this code:

pub fn test_fn() void {
    var thing: i32 = 3;
@ssteinbach
ssteinbach / zigmem.md
Last active October 21, 2022 16:25
Zig Memory Mental Model

Zig Memory Mental Model

From conversation w/ @spex_guy, who kindly explained the details below.

Types & Memory:

  • A type defines a range of memory, and may contain pointers to other ranges.
  • All copies of any type are shallow, copying only the immediate range of the type, and not anything it points to.
  • *T is a value of only eight bytes, so copying it does not copy the memory it points to.
  • [N]T: contiguous buffer of type T and compile time known length N.
  • [N]T is equivalent to extern struct { v0: T, v1: T, ..., vN: T }, so it will copy all values by value.
@ssteinbach
ssteinbach / OTIO_Upgrading_Downgrading.md
Last active August 1, 2022 18:06
Schema downgrading system proposal for https://opentimeline.io

OTIO Schema Downgrading Proposal

Problem Statement

OTIO has a schema upgrading system, which allows newer versions of OTIO to read files from older versions of the library. There is no way to create files that are compliant with older versions of the library, however.

The goal is to build a system into OTIO that allows interoperability both forwards and backwards in version numbers.

@ssteinbach
ssteinbach / adapter_arg_discovery.md
Last active September 28, 2022 17:17
Discovering OTIO Adapter Arguments

Discovering OTIO Adapter Arguments

Overview

The otioconvert program that ships with OpenTimelineIO has a handy feature that lets you pass arguments to adapters:

> otioconvert --help
...
 -a ADAPTER_ARG, --adapter-arg ADAPTER_ARG
@ssteinbach
ssteinbach / zig_array_struct.md
Last active October 3, 2022 21:06
Zig - struct with array slice member to be initialized later

Zig: Struct with Array Slice field

One pattern that seems to fall out of my brain when I return to Zig is having a struct with one array field that I want to assign to later. For example:

const StateData = struct {
  // I realize this is wrong, this is what my brain always wants to try first
  order: []burger=undefined,
};
@ssteinbach
ssteinbach / zig_test_package.md
Last active October 21, 2022 16:27
Testing zig files in packages/subdirectories

Testing Zig Files in Packages/Subdirectories

Given a zig file file_with_test.zig in a subdirectory:

.
├── example_package
│   └── file_with_test.zig
└── outer_thing.zig