Skip to content

Instantly share code, notes, and snippets.

View bradhowes's full-sized avatar
🏠
Working from home

Brad Howes bradhowes

🏠
Working from home
View GitHub Profile
@bradhowes
bradhowes / AUParameterTree+SwiftUI.playground
Last active January 14, 2021 00:32
Swift playground that integrates a @published attribute and a AUParameter instance, allowing changes in either to affect the other.
import SwiftUI
import AVFoundation
import PlaygroundSupport
class Model: ObservableObject {
@Published var value: Double = 5.0 // sole source of truth
}
class ParamTree {
static let address: AUParameterAddress = 123
@bradhowes
bradhowes / async_remarkable.js
Last active April 11, 2020 15:50
Enable async render operations on Remarkable
// Snippets from my build.js script for my static site generator. Shows how I handle async render operations
// during the Remarkable render operation.
//
const md = new Remarkable("full", markdownOptions).use(katexPlugin).use(require("./consoleFence.js"));
// My own custom codeFence processing for static highlighting using Prism.
md.renderer.rules.fence = require("./codeFence.js");
md.renderer.rules.fence_custom.graph = require("./graphFence.js");
md.renderer.promises = {};
md.renderer.addPromise = (key, promise) => {
@bradhowes
bradhowes / bump-version.sh
Last active December 6, 2023 07:51
Bash script to increase build number and optionally marketing version of Xcode targets using Apple's `agvtool`
#!/bin/bash
#
# Script to bump the build number and optionally the marketing version found
# in *.info files.
#
# Usage: bump-version.sh [ARG]
#
# Without ARG, just increment the build number. When ARG is present, it indicates
# which part of the marketing version to increment:
#
#!/bin/bash
#
# Custom mapping for Apple MacBookPro 2017 keyboard.
#
# - Map §/± (SECTION) to `/~ (BACKQUOTE) to match US keyboard
# - Map CAPS LOCK (LOCK) to SHIFT (L_SHIFT) to locking
# - Map right CMD (R_CMD) to CAPS LOCK to enable locking if really wanted
# - Map `/~ to (BACKQUOTE) to SHIFT (L_SHIFT) to make SHIFT-^ easier
#
# To run at startup:
@bradhowes
bradhowes / noPlay.py
Last active July 24, 2017 17:58
Locate albums in iTunes with a low aggregate play count (Python 2)
import plistlib, sys
from pprint import pprint
delimiter = '~'
def scan(srcRoot, playLimit):
albumMap = {}
for trackId, attributes in srcRoot['Tracks'].iteritems():
albumName = attributes.get('Album')
artistName = attributes.get('Album Artist')
@bradhowes
bradhowes / mattermost3.py
Created June 8, 2017 12:51
Simple Python 3 Performance Test Script
import asyncio
import websockets
import json
import pickle
import sys
import multiprocessing
import random
import time
from collections import deque