Skip to content

Instantly share code, notes, and snippets.

Brennan Stehling brennanMKE

View GitHub Profile
brennanMKE / Convert.swift
Last active Jun 19, 2020
Symbolication Troubleshooting
View Convert.swift
// Convert the UUID of the binary image to a 32 character string seperated in groups of 8-4-4-4-12
// (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX). Note that all letters must be uppercased.
import Foundation
func convert(uuid: String) -> String? {
guard uuid.count == 32 else {
return nil
brennanMKE / DayPicker.swift
Created May 21, 2020
DayPicker for SwiftUI
View DayPicker.swift
import PlaygroundSupport
import SwiftUI
let DatePickerMaxDaysBack = 30
struct DayPicker: View {
@State var value: Int = DatePickerMaxDaysBack
let dateChanged: (Date) -> Void
brennanMKE /
Created May 17, 2020
Links shell configuration files to a Dropbox folder

Link Shell Files with Dropbox

Keeping shell configuration files in sync with Dropbox so each of my Macs has the same paths, aliases and other settings is easily done by symlinking files to a common folder in Dropbox. If a symlink is already in place it unlinks it so that it can be linked again. Then if the Dropbox exists it creates the symlink. If a file is at that path it won't change anything. You will first need to copy the contents of the folder to the path under the Dropbox path.

View Playground.swift
import Foundation
enum TerrainType: CustomStringConvertible {
case land
case sea
case markedLand
case markedSea
var description: String {
brennanMKE /
Last active Apr 25, 2020
LLDB customization with additional commands

LLDB Custom Commands

[LLDB] can be customized with ~/.lldbinit to run commands and to load more commands from shell and python scripts. One option is [Chisel] which provides several commands which can be used to debug an software running in Xcode.

It is critical that LLDB can process the commands in ~/.lldbinit successfully as a failure can cause the debugger to fail or run in an undefined way. The configuration listed in this Gist prints a message at the start and end so that when the debugger is run it is clear if any errors are shown in the Xcode console they are related to LLDB.

View Playground.swift
import Foundation
let mildCutoff = 80.9 / 100.0
let severeCutoff = 94.7 / 100.0
let cardiovascularPoints = 10.5
let diabetesPoints = 7.3
let respiratoryDiseasePoints = 6.3
let highBloodPressurePoints = 6.0
let cancerPoints = 5.6
brennanMKE /
Last active May 17, 2020
Import and sort video files from SD Card

Importing and Sorting Video Files

A reliable and easy way to import lots of video files with a high capacity SD Card makes it a lot easier to manage lots of recordings. These 2 scripts will import and sort the files. The variables for the paths should be customized at the start of the scripts.

Then simply open your shell to the directory where these script are placed and run the combined commands below.

sh &&
brennanMKE /
Last active Apr 8, 2020
Kaly Unity Settings for VESC

Kaly Unity Settings

Firmware (Original)

23.42 Unity

Firmware (Latest)

23.46 Unity

brennanMKE /
Created Nov 6, 2019
Copy Swift Header

Copy Swift Header

When a static lbirary built in Xcode with Swift source files it does not copy the generated header to the products directory. This script can be used to copy this header file so that it can be used by a dependency when the pre-compiled static library is used.

View DispatchSpinlock.swift
import Foundation
public class DispatchSpinlock: Spinlock {
private let sleepInterval: TimeInterval
private var isDone: Bool = false
private var timeout: DispatchTime = .distantFuture
private var isTimedOut: Bool {
let timedOut = >= timeout
return timedOut
You can’t perform that action at this time.