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
set(CPM_DOWNLOAD_VERSION 0.40.2) | |
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | |
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) | |
message(STATUS "Downloading CPM.cmake...") | |
file(DOWNLOAD https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake ${CPM_DOWNLOAD_LOCATION}) | |
endif() | |
include(${CPM_DOWNLOAD_LOCATION}) | |
CPMAddPackage( | |
NAME volk |
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
// ==UserScript== | |
// @name MangaLib - Auto Download and Navigate | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Automatically download content and navigate to the next page | |
// @author Geor Kasapidi | |
// @match https://mangalib.org/* | |
// @grant none | |
// ==/UserScript== |
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
static func _compile(data: Data, configuration: MLModelConfiguration = .init()) async throws -> MLModel { | |
let tmp = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) | |
try data.write(to: tmp, options: .atomic) | |
let url = try await MLModel.compileModel(at: tmp) | |
try FileManager.default.removeItem(at: tmp) | |
let model = try MLModel(contentsOf: url, configuration: configuration) | |
try FileManager.default.removeItem(at: url) | |
return model | |
} |
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 sys | |
import os | |
import clang.cindex | |
shaders_file = sys.argv[1] | |
assert(shaders_file.endswith(“.metal”)) | |
ast_file = shaders_file.rstrip(“.metal”) + “.ast” | |
os.system(f”xcrun metal -emit-ast {shaders_file}“) | |
xcode_path = os.popen(“xcode-select -p”).read().rstrip() |
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
swiftformat \ | |
--self insert \ | |
--wrapcollections before-first \ | |
--wraparguments before-first \ | |
--wrapparameters before-first \ | |
--header strip \ | |
--ifdef no-indent \ | |
--enable wrapSwitchCases \ | |
--enable organizeDeclarations \ | |
--swiftversion 5.3 . |
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
struct EnumSet<T: RawRepresentable & CaseIterable>: OptionSet where T.RawValue == Int { | |
let rawValue: T.RawValue | |
init(rawValue: T.RawValue) { | |
self.rawValue = rawValue | |
} | |
init(_ value: T) { | |
self.rawValue = 1 << value.rawValue | |
} |
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
--self insert | |
--wrapcollections after-first | |
--wraparguments after-first | |
--wrapparameters after-first | |
--header strip | |
--enable wrapSwitchCases | |
--enable organizeDeclarations |
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 STS | |
final class Registry { | |
// MARK: Internal | |
func register<T: AnyObject>(_ value: T) { | |
self.lock.execute { | |
let key = ObjectIdentifier(T.self) | |
assert(self.objects[key] == nil) | |
assert(self.factories[key] == nil) |
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 CoreVideo | |
import Alloy | |
import Foundation | |
import Accelerate | |
enum MetalCVPixelBuffer { | |
static func transform(texture input: MTLTexture, | |
transformer: @escaping (CVPixelBuffer) throws -> CVPixelBuffer, | |
cache: CVMetalTextureCache) throws -> MTLTexture { | |
guard let inputPixelBuffer = input.pixelBuffer 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
@propertyWrapper | |
public final class ThreadSafe<Root> { | |
private let lock = OSUnfairLock() | |
private var value: Root | |
public init(wrappedValue: Root) { | |
self.value = wrappedValue | |
} | |
NewerOlder