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 / swift-grab-tca-coverage.json
Last active February 3, 2025 21:14
swift-grab-tca-coverage
{"label":"Coverage","message":"12.34%","schemaVersion":1,"color":"success"}
@bradhowes
bradhowes / macOS_ISO.md
Created January 14, 2025 21:07
macOS Installer to ISO
  • Download OS from AppStore (eg macOS Sonoma) -- do not install

  • Open terminal to get shell prompt. Go to desktop:

% cd ~/Desktop
  • Create DMG container (note 1 hyphen in "-volume" and other args)
@bradhowes
bradhowes / gist:e4db684fa782f913d0454750bb103c72
Last active December 12, 2024 02:48
Using msmtp on macOS with iCloud
  • Install msmtp using brew install msmtp
  • Configure msmtp using the following:
# Set default values for all the accounts.
defaults
auth on
logfile ~/.maildir/msmtp.log
port 587
protocol smtp
@bradhowes
bradhowes / AUv3Controls-coverage.json
Last active December 23, 2024 21:28
AUv3Controls Coverage
{"label":"Coverage","message":"86.01%","schemaVersion":1,"color":"success"}
@bradhowes
bradhowes / Makefile
Created October 20, 2022 17:23
Code Coverage from Xcode via Make
# XCode scheme to build and test
SCHEME = Searching
# The sim to use when running tests
PLATFORM_IOS = iOS Simulator,name=iPhone SE (3rd generation)
# Coomand line options for xcodebuild that incorporate the above values
DEST = -project Searching.xcodeproj -scheme "$(SCHEME)" -destination platform="$(PLATFORM_IOS)"
# The pattern to use when matching lines from xcov output. The coverage total will be the average
@bradhowes
bradhowes / ghstatus.py
Last active December 19, 2023 17:26
Simple repo workflow status
#!/usr/bin/env python
import concurrent.futures
from dataclasses import dataclass
from github import Github
from termcolor import colored
from functools import partial
@dataclass
@bradhowes
bradhowes / SwiftPMBundleHandling.m
Last active March 18, 2022 12:17
Workarounds for Swift PM Bundle Handling
// When working properly, SWIFTPM_MODULE_BUNDLE is defined. At least on Xcode 13.2, this is not always the case with
// packages, especially when running tests. The code below was pulled from my SF2Lib Swift package. This package is
// used in my SoundFonts application. The workaround below handles two situations where SWIFTPM_MODULE_BUNDLE is not
// working right:
//
// 1. SWIFTPM_MODULE_BUNDLE not defined -- seems to be limited to unit tests in the SF2Lib package
// 2. SWIFTPM_MODULE_BUNDLE defined but throws exception -- seems to be limited to unit tests of a package that depends
// on SF2Lib package
//
@bradhowes
bradhowes / post-build.sh
Last active January 27, 2022 15:39
Simple script that is useful as a Build post-action to remove bogus embedded frameworks due to Swift packages.
#!/bin/bash
set -eu
echo "-- BEGIN post-build.sh"
function process # TOP EMBED
{
local TOP="${1}" EMBED="${2}"
cd "${CODESIGNING_FOLDER_PATH}/${TOP}"
@bradhowes
bradhowes / code_coverage.md
Created December 21, 2021 18:00
Github Action for Swift Code Coverage
  1. Create a Github action for your SwiftPM project.
  2. Add a step to build: swift build
  3. Add a step to run tests: swift test --enable-code-coverage
  4. Fetch coverage value (see below)
  5. Write coverage value to gist and generate badge from it

For step #4, we need to do some sleuthing and digging around into artifacts created by the Swift toolchain. First, we need to find the location of the XCTest bundle that step #3 generated and save it in an environment variable:

@bradhowes
bradhowes / Arithmetic.swift
Created November 24, 2021 22:07
Math expression parsing using Point-Free's swift-parsing library. Expands on code found in the infix-operator branch.
import Parsing
import XCTest
import Foundation
#if canImport(Darwin)
import Darwin.C
#elseif canImport(Glibc)
import Glibc
#endif