This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://github.com/ggerganov/whisper.cpp | |
CLONEDIR="${HOME}"/Developer/ | |
stty -echoctl | |
function ctrl_c() { | |
2>/dev/null "${CLONEDIR}"/whisper.cpp/main -m "${CLONEDIR}"/whisper.cpp/models/ggml-large-v3-q5_0.bin -f /tmp/rec.wav --print-colors | pbcopy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
protocol CommandExecuting { | |
func run(commandName: String, arguments: [String]) throws -> String | |
} | |
enum BashError: Error { | |
case commandNotFound(name: String) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@_spi(Internals) import ComposableArchitecture | |
struct Bound<R: Reducer, S, V:View> { | |
init(store: StoreOf<R>, _ s: KeyPath<R.State, S>, _ a: @escaping (S) -> R.Action, @ViewBuilder _ vb: @escaping (Binding<S>) -> V) { | |
_state = Binding<S>{store.state.value[keyPath: s] } set:{ store.send(a($0)) } | |
self.vb = vb | |
} | |
@Binding var state: S | |
@ViewBuilder var vb: (Binding<S>) -> V |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This source file is part of the Swift.org open source project | |
Copyright (c) 2021 Apple Inc. and the Swift project authors | |
Licensed under Apache License v2.0 with Runtime Library Exception | |
See https://swift.org/LICENSE.txt for license information | |
See https://swift.org/CONTRIBUTORS.txt for Swift project authors | |
*/ | |
// Source: https://github.com/apple/swift-docc/blob/ddf8f0a64f4f477259ae166b84d5f064ab2887c5/bin/output-diff.swift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct Locked<T>: LockedValue { | |
public init(_ value: T) { | |
let lock = Self.make(for: value) | |
withLock = { act in | |
lock.lock() | |
defer { lock.unlock() } | |
return act(&lock.unsafe_wrapped) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
extension View { | |
public func withState<Value, V: View>(_ state: Value, @ViewBuilder content: @escaping (_ state: Binding<Value>) -> V) -> some View { | |
modifier(WithStateModifier(state, content: content)) | |
} | |
} | |
public struct WithState<Value, V: View>: View { | |
public init(_ value: Value, @ViewBuilder content builder: @escaping (_ state: Binding<Value>) -> V) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Condition { | |
case new | |
case safe | |
} | |
public enum Transacting<T> { | |
case known(T) | |
case changing(known: T, tentative: T) | |
public mutating func stage(_ value: T) { | |
switch self { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Tup { | |
public struct A<A> { | |
var a: A | |
} | |
public struct B<A, B> { | |
var a: A | |
var b: B | |
} | |
public struct C<A, B, C> { | |
var a: A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
extension View { | |
/// Conditionally make a change to a view in a modifier chain | |
/// | |
/// - Parameter if: the condition required to make the change | |
/// - Parameter modify: the change to make | |
public func conditionally(if condition: Bool, @ViewBuilder _ modify: @escaping (_ content: Self) -> some View) -> some View { | |
EitherView(condition: condition, input: self, modify: modify) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
sqlite3 "${HOME}/Library/Application Support/dev.warp.Warp-Stable/warp.sqlite" -readonly -cmd 'select cwd from terminal_panes order by id desc limit 1' '.exit' |
NewerOlder