Skip to content

Instantly share code, notes, and snippets.

View brianmichel's full-sized avatar
🎯
Focusing

Brian Michel brianmichel

🎯
Focusing
View GitHub Profile
@brianmichel
brianmichel / output.txt
Created March 2, 2024 16:21
Code that tries to reconstruct WritableKeyPaths from AnyKeyPath using _openExistential
Original WritableKeyPath is \MyFeatureFlags.fontOptions
Got specialization: CaseIterable
Reconstructed WritableKeyPath is \MyFeatureFlags.fontOptions
Got specialization: Base
@brianmichel
brianmichel / Test-HostConnectivity.ps1
Last active December 26, 2023 22:59
Test DNS resolution and SSL connectivity to a given host.
<#
.SYNOPSIS
Runs various networking tests to help debug connectivity issues to a specific host.
.PARAMETER Uri
The Uri that should be used as the remote host. This should be something like 'www.arc.net' which will be used
to test by DNS and SSL connectivity as needed.
.PARAMETER TestDns
Whether or not to test DNS resolution to the provided Uri
@brianmichel
brianmichel / chartd.swift
Created May 12, 2023 12:45
Generate a chartd chart with Swift
import Foundation
let b62 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
func encode(data: [Double], min: Double, max: Double) -> String {
let r = max - min
var bs = [Character](repeating: b62.first!, count: data.count)
if r == 0 {
for i in 0..<data.count {
bs[i] = b62.first!
@brianmichel
brianmichel / AudioTap.m
Last active February 19, 2023 20:36
Objective-C Audio Tap
#import "AudioTap.h"
@interface AudioTap ()
@property (nonatomic, nullable) AudioStreamBasicDescription const *audioDescription;
@property (nonatomic, nullable) MTAudioProcessingTapRef tapReference;
@property (nonatomic, weak) AVPlayer *audioPlayer;
@end
@implementation AudioTap
@brianmichel
brianmichel / goodbye.swift
Created December 16, 2022 23:46
Say goodbye to your meet tabs
#!/usr/bin/env swift
import AppKit
import Foundation
import ScriptingBridge
@objc public protocol SBObjectProtocol: NSObjectProtocol {
func get() -> Any!
}
@objc public protocol SBApplicationProtocol: SBObjectProtocol {
@brianmichel
brianmichel / weird-safari-animation.vue
Created November 6, 2022 15:04
A strange Safari animation
<template>
<div class="media-container" :style="dimensions">
<img :src="'/media/' + photo.name + '_preview.jpg'" />
</div>
</template>
<script lang="js">
import { defineComponent } from "vue";
export default defineComponent({
@brianmichel
brianmichel / github-scroll.css
Created November 1, 2022 22:47
CSS Boost To Make GitHub's Left Column Scrollable
.dashboard-sidebar {
overflow: scroll !important;
}
@brianmichel
brianmichel / timerfires2
Created September 26, 2022 13:56
An updated version of the timerfires command that works on macOS 12+
#!/bin/sh
# timerfires
FORMAT='"%8d %5d %-16s %-16s "'
CURRENTTIME='(walltimestamp - starttime) / 1000000'
specifiers=0
opt_pid=0; pid=0
@brianmichel
brianmichel / sparkle-marconio-test.patch
Created February 4, 2022 22:01
A patch for a new test to exercise the Appcast parsing behavior in Sparkle for my failing updater.
diff --git a/Tests/SUAppcastTest.swift b/Tests/SUAppcastTest.swift
index a1e921db..336e959b 100644
--- a/Tests/SUAppcastTest.swift
+++ b/Tests/SUAppcastTest.swift
@@ -11,6 +11,27 @@ import Sparkle
class SUAppcastTest: XCTestCase {
+ func testBrokenAppcast() {
+ let testURL = Bundle(for: SUAppcastTest.self).url(forResource: "marconio-broken-appcast", withExtension: "xml")!
@brianmichel
brianmichel / NSExtensionContext+Loading.swift
Created June 5, 2021 12:25
Publisher-ify NSExtensionContext item loading
import Combine
import Foundation
extension NSExtensionContext {
enum Errors: Error {
/// An error passed when there is no error, and no item is returned.
case unableToLoadItem
}
/**