Skip to content

Instantly share code, notes, and snippets.

View singingwolfboy's full-sized avatar
Available for contract work

David Baumgold singingwolfboy

Available for contract work
View GitHub Profile
@singingwolfboy
singingwolfboy / audiveris.rb
Last active April 29, 2023 11:36
Work-in-progress Homebrew formula for installing Audiveris
class Audiveris < Formula
desc "Optical Music Recognition"
homepage "https://audiveris.github.io/audiveris/"
url "https://github.com/Audiveris/audiveris.git",
# tag: "development",
revision: "f29f417386e3d9c68b3a4103cfaf48239769ac58"
version "5.3-beta"
license "AGPL-3.0"
depends_on "gradle" => :build
@singingwolfboy
singingwolfboy / error.log
Last active February 16, 2023 13:03
Failing build for torchaudio
[ 43%] Building CXX object torchaudio/csrc/CMakeFiles/_torchaudio_ffmpeg.dir/ffmpeg/pybind/pybind.cpp.o
cd /tmp/torchaudio-20230216-95817-nuezt6/build/torchaudio/csrc && /opt/homebrew/Library/Homebrew/shims/mac/super/clang++ -DUSE_C10D_GLOO -DUSE_DISTRIBUTED -DUSE_RPC -DUSE_TENSORPIPE -D_torchaudio_ffmpeg_EXPORTS -I/tmp/torchaudio-20230216-95817-nuezt6 -isystem /opt/homebrew/include/torch/csrc/api/include -Wall -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -fPIC -std=gnu++14 -MD -MT torchaudio/csrc/CMakeFiles/_torchaudio_ffmpeg.dir/ffmpeg/pybind/pybind.cpp.o -MF CMakeFiles/_torchaudio_ffmpeg.dir/ffmpeg/pybind/pybind.cpp.o.d -o CMakeFiles/_torchaudio_ffmpeg.dir/ffmpeg/pybind/pybind.cpp.o -c /tmp/torchaudio-20230216-95817-nuezt6/torchaudio/csrc/ffmpeg/pybind/pybind.cpp
In file included from /tmp/torchaudio-20230216-95817-nuezt6/torchaudio/csrc/ffmpeg/pybind/pybind.cpp:1:
In file included from /opt/homebrew/include/pybind11/stl.h:12:
In file included from /opt/homebrew
@singingwolfboy
singingwolfboy / PgTypesLibphonenumberPlugin.ts
Last active February 14, 2020 17:55
A plugin for Postgraphile that provides support for the "phone_number" type from pg_libphonenumber: https://github.com/blm768/pg-libphonenumber Note that this support requires installing libphonenumber-js on the Postgraphile server: https://github.com/catamphetamine/libphonenumber-js
import { Plugin, Build, ScopeGraphQLScalarType } from "graphile-build";
import { PhoneNumber, parsePhoneNumber } from "libphonenumber-js";
declare module "graphile-build" {
interface ScopeGraphQLScalarType {
isPhoneNumberScalar: boolean;
}
}
export default (function PgTypesLibphonenumberPlugin(builder) {
{
"title": "JSONPgSmartTags",
"type": "object",
"properties": {
"version": {
"type": "number",
"minimum": 1
},
"config": {
"type": "object",
@singingwolfboy
singingwolfboy / 1-schema.sql
Last active September 22, 2019 14:28
I want to create a `@relationTargetColumn` smart comment, for making relationships that target only a single column in a table instead of an entire object. Ideally, other columns on the relationship should appear in the edge data. This is an example of what I want to create, but I'm not sure what's the best way to get started...
drop schema if exists sh cascade;
create schema sh;
create table sh.hero (
id serial primary key,
species text
);
create table sh.hero_name (
id serial primary key,
@singingwolfboy
singingwolfboy / PgEnhancedManyToManyRelationPlugin.js
Created August 27, 2019 11:12
Based on https://github.com/graphile-contrib/pg-many-to-many, but generates two connections/edges per many-to-many relation so that values on the junction table can be exposed on the connection edges. Not fully functional.
// Given a `leftTable`, trace through the foreign key relations
// and identify a `junctionTable` and `rightTable`.
// Returns a list of data objects for these many-to-many relations.
function manyToManyRelations(leftTable, build) {
const {
pgIntrospectionResultsByKind: introspectionResultsByKind,
pgOmit: omit,
} = build;
return leftTable.foreignConstraints
@singingwolfboy
singingwolfboy / PgManyToManyRelationArgConditionPlugin.js
Created July 23, 2019 14:52
I'm trying to build a PostGraphile plugin that works with the PgManyToManyRelationPlugin (https://github.com/graphile-contrib/pg-many-to-many) but adds a `condition` argument, inspired by the built-in PgConnectionArgCondition plugin, that allows filtering the junction table. I think I'm almost there, but the structure of the query in PgManyToMan…
const flatten = require("lodash/flatten");
module.exports = (function PgManyToManyRelationArgCondition(builder) {
builder.hook(
"init",
(_, build) => {
const {
newWithHooks,
pgIntrospectionResultsByKind: introspectionResultsByKind,
pgGetGqlInputTypeByTypeIdAndModifier,
@singingwolfboy
singingwolfboy / pg-libphonenumber.rb
Created July 15, 2019 17:43
[pg-libphonenumber](https://github.com/blm768/pg-libphonenumber) formula for [Homebrew](https://brew.sh/). Still needs a released version before it can be merged to [homebrew-core](https://github.com/Homebrew/homebrew-core).
class PgLibphonenumber < Formula
desc "libphonenumber extension for Postgres"
homepage "https://github.com/blm768/pg-libphonenumber"
url "https://github.com/blm768/pg-libphonenumber/archive/master.zip"
version "0.1.0"
sha256 "5b29e96e96eba790e856e0624724a548bba82dfd0a3dc314eafd2ac3ace92e0f"
depends_on "libphonenumber"
depends_on "postgresql"
def install
@singingwolfboy
singingwolfboy / test_pytest_failure.py
Last active July 3, 2019 07:43
Minimal test case for Pytest 5 failure with Flask.
import flask
def test_pytest_failure():
"""
This test passes on Pytest 4, but throws an error on Pytest 5.
"""
app = flask.Flask(__name__)
$ git clone git@github.com:alex3165/react-mapbox-gl.git
Cloning into 'react-mapbox-gl'...
remote: Counting objects: 4617, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 4617 (delta 1), reused 4 (delta 1), pack-reused 4607
Receiving objects: 100% (4617/4617), 12.55 MiB | 4.60 MiB/s, done.
Resolving deltas: 100% (3062/3062), done.
$ cd react-mapbox-gl/example
$ npm install