Skip to content

Instantly share code, notes, and snippets.

View akaralar's full-sized avatar

Ahmet Karalar akaralar

View GitHub Profile
@KhaosT
KhaosT / HDMI on Apple Vision Pro.md
Last active April 21, 2024 03:49
Guide for using Apple Vision Pro as HDMI display

Displaying HDMI sources on Apple Vision Pro

While it's possible to stream most content to Apple Vision Pro directly over the internet, having the ability to use Apple Vision Pro as an HDMI display can still be useful.

Since Apple Vision Pro does not support connecting to an HDMI input directly or using an HDMI capture card, we have to be a little creative to make this work. NDI provides the ability to stream HDMI content over a local network with really low latency, and it works great with Apple Vision Pro.

This page shows the setup I’m using.

@danielt1263
danielt1263 / SharedCache+Rx.swift
Last active June 20, 2023 10:51
I was asked to create a shared cache.
//
// SharedCache+Rx.swift
//
// Created by Daniel Tartaglia on 12 Jun 2021.
// Copyright © 2023 Daniel Tartaglia. MIT License.
//
import RxSwift
extension ObservableType {
@pudquick
pudquick / brew.md
Last active April 6, 2024 21:42
Lightly "sandboxed" homebrew on macOS

brew is a bad neighbor

This isn't a guide about locking down homebrew so that it can't touch the rest of your system security-wise.

This guide doesn't fix the inherent security issues of a package management system that will literally yell at you if you try to do something about "huh, maybe it's not great my executables are writeable by my account without requiring authorization first".

But it absolutely is a guide about shoving it into its own little corner so that you can take it or leave it as you see fit, instead of just letting the project do what it likes like completely taking over permissions and ownership of a directory that might be in use by other software on your Mac and stomping all over their contents.

By following this guide you will:

  • Never have to run sudo to forcefully change permissions of some directory to be owned by your account
@objcio-user
objcio-user / LoadPosterImageCancellable.swift
Last active April 1, 2024 08:41
Advanced Swift Sample Code
import Foundation
struct Episode: Identifiable, Codable {
var id: String
var poster_url: URL
var collection: String
// ...
static let url = URL(string: "https://talk.objc.io/episodes.json")!
}
@brennanMKE
brennanMKE / IDETemplateMacros.plist
Last active April 18, 2024 17:06
Xcode File Header Templates
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FILEHEADER</key>
<string>
// Copyright © ___YEAR___ ___ORGANIZATIONNAME___.
// All Rights Reserved.
</string>
<key>ORGANIZATIONNAME</key>
@brennanMKE
brennanMKE / README.md
Last active April 3, 2024 21:49
Create SSH Key on Mac for Xcode

Create SSH Key on Mac for Xcode

The docs for GitHub show a command to create a key with the ed25519 encryption method which is not allowed by Xcode. Even if you are not using the Source Control features in Xcode you will often need to use an account with GitHub when you are consuming Swift packages which are pulled from GitHub.

For SSH keys there are 4 algorithms.

  • 🚨 DSA: This is an older algorithm which is no longer supported and is superceded with more modern algorithms.
  • ⚠️ RSA: This algorithm was an improvement but it is now outdated and a more modern method should be used.
  • 👀 ECDSA: Another improvement which is dependent on your computer's ability to generate random numbers.
  • ✅ Ed25519: The most recommended public-key algorithm today which you should use with GitHub.
@rberaldo
rberaldo / obsidian-to-org.py
Last active September 30, 2023 23:24
Obsidian to org-roam migration kit – a completely half-baked attempt at moving from Obsidian to org-roam which nevertheless works (for me).
#!/usr/bin/python
import sys,re,os
if not os.path.isdir("out/"):
os.mkdir("out/")
md_file = sys.argv[1]
org_file = md_file[:-3] + ".org"
@IanKeen
IanKeen / ShareReplay.swift
Created June 3, 2021 19:38
Combine: ShareReplay - Shares the underlying resource and replays the last emitted value (if there was one) to new subscribers
extension Publisher {
func shareReplay() -> AnyPublisher<Output, Failure> {
let subject = CurrentValueSubject<Output?, Failure>(nil)
return map { $0 }
.multicast(subject: subject)
.autoconnect()
.compactMap { $0 }
.eraseToAnyPublisher()
}
extension Result {
public func `catch`(_ handler: () throws -> Success) -> Result<Success, Error> {
flatMapError { _ in
.init { try handler() }
}
}
public func `catch`(_ handler: (Failure) throws -> Success) -> Result<Success, Error> {
flatMapError { error in
.init { try handler(error) }