This file contains hidden or 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 whisperx | |
| import torch | |
| from pydub import AudioSegment | |
| import os | |
| import time | |
| script_start_time = time.perf_counter() | |
| LANGUAGE_CODE = "en" | |
| HF_TOKEN="YOUR_TOKEN_HERE" |
This file contains hidden or 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
| // MARK: - Atomic | |
| @propertyWrapper struct Atomic<T> { | |
| private let lock = UnfairLock() | |
| private var value: T | |
| var wrappedValue: T { | |
| get { | |
| lock.lock() | |
| defer { |
This file contains hidden or 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 Foundation | |
| struct Post: Decodable { | |
| let id: String | |
| let title: String | |
| let body: String | |
| } | |
| struct GraphQLResult<T: Decodable>: Decodable { | |
| let object: T? |
This file contains hidden or 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
| // | |
| // ContentView.swift | |
| // MetalSwiftUI | |
| // | |
| // Created by Zach Eriksen on 9/8/20. | |
| // Copyright © 2020 oneleif. All rights reserved. | |
| // | |
| // Inspired [MetalUI](https://github.com/0xLeif/MetalUI) | |
| import SwiftUI |
This file contains hidden or 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
| // Based on this StackOverflow answer: https://stackoverflow.com/a/61273595/4239752 | |
| import Foundation | |
| import Combine | |
| extension Publisher { | |
| /// collects elements from the source sequence until the boundary sequence fires. Then it emits the elements as an array and begins collecting again. | |
| func buffer<T: Publisher, U>(_ boundary: T) -> AnyPublisher<[Output], Failure> where T.Output == U { | |
| let subject = PassthroughSubject<[Output], Failure>() |
This file contains hidden or 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
| // The SwiftUI Lab | |
| // Website: https://swiftui-lab.com | |
| // Article: https://swiftui-lab.com/alignment-guides | |
| import SwiftUI | |
| class Model: ObservableObject { | |
| @Published var minimumContainer = true | |
| @Published var extendedTouchBar = false | |
| @Published var twoPhases = true |
This file contains hidden or 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 Realm | |
| import RealmSwift | |
| class RealmManager { | |
| static let shared = RealmManager() | |
| private func getRealm() -> Realm { | |
| if let _ = NSClassFromString("XCTest") { | |
| return try! Realm(configuration: Realm.Configuration(fileURL: nil, inMemoryIdentifier: "test", encryptionKey: nil, readOnly: false, schemaVersion: 0, migrationBlock: nil, objectTypes: nil)) | |
| } else { |
This file contains hidden or 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 Foundation | |
| /** | |
| Extension to save/load a JSON object by filename. (".json" extension is assumed and automatically added.) | |
| */ | |
| extension JSONSerialization { | |
| static func loadJSON(withFilename filename: String) throws -> Any? { | |
| let fm = FileManager.default |