Skip to content

Instantly share code, notes, and snippets.

View username0x0a's full-sized avatar
🐡
πŸ™‰ πŸ™ˆ πŸ™Š

Michal Zelinka username0x0a

🐡
πŸ™‰ πŸ™ˆ πŸ™Š
View GitHub Profile
@chriseidhof
chriseidhof / boilerplate.swift
Last active April 17, 2025 11:08
QuickMacApp
// Run any SwiftUI view as a Mac app.
import Cocoa
import SwiftUI
NSApplication.shared.run {
VStack {
Text("Hello, World")
.padding()
.background(Capsule().fill(Color.blue))
@rmcdongit
rmcdongit / macOS_SytemPrefs.md
Last active May 7, 2025 12:57
Apple System Preferences URL Schemes

macOS 10.15 System Preference Panes

Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.

To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:

tell application "System Preferences"
	set CurrentPane to the id of the current pane
	set the clipboard to CurrentPane
@maximkrouk
maximkrouk / !Builder.swift
Last active May 15, 2022 08:36
Functional generic builder
// NOTE: Depends on Modifications.swift
// NOTE: Depends on BuildBlocks.swift
// NOTE: Depends on FunctionalKeyPath https://gist.github.com/maximkrouk/6287fb56321a21e8180d5fe044e642e4
import Foundation
@dynamicMemberLookup
public struct Builder<Object> {
private var _build: () -> Object
public func build() -> Object { _build() }
@dsabanin
dsabanin / enable-xcode-debug-menu.sh
Last active November 7, 2022 16:17
Enable internal Xcode debug menu in Xcode 11
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -bool YES
sudo mkdir -p /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode
sudo touch /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode/AppleInternal.plist
# Don't forget to restart Xcode
@implementation UIImage (ResourceProxyHack)
+ (UIImage *)_iconForResourceProxy:(id)proxy format:(int)format {
// HACK: proxy seems garbage so we always show PDF for now.
let cgImage = [_bridge imageForFileType:@"pdf"];
// HACK: We use mainScreen here but could have multiple screens.
let image = [UIImage imageWithCGImage:cgImage scale:UIScreen.mainScreen.scale orientation:UIImageOrientationUp];
return image;
}
@xcodereleases
xcodereleases / main.m
Last active June 15, 2020 04:29
Extract beta information from a local copy of Xcode
#import <Cocoa/Cocoa.h>
@protocol FilePath <NSObject>
+ (instancetype)filePathForPathString:(NSString *)path;
@end
@protocol NamedVersion <NSObject>
- (NSString *)name;
@end
@FWEugene
FWEugene / SwiftConcurrency.md
Created January 10, 2019 17:37
All about concurrency

Threads

Foundation offers a Thread class, internally based on pthread, that can be used to create new threads and execute closures.

// Detaches a new thread and uses the specified selector as the thread entry point.
Thread.detachNewThreadSelector(selector: Selector>, toTarget: Any, with: Any)

// Subclass
class MyThread: Thread {
@aykevl
aykevl / fire.py
Last active January 29, 2024 17:17
FastLED animations for MicroPython, see: https://forum.micropython.org/viewtopic.php?f=15&t=3749
import machine
import pixels
import array
import urandom
import time
# Source:
# https://github.com/FastLED/FastLED/blob/master/examples/Fire2012WithPalette/Fire2012WithPalette.ino
heatColors = array.array('L', [0x000000,
@insidegui
insidegui / gist:a18124c0c573a4eb656f5c485ea7dae4
Last active February 9, 2025 18:03
Unofficial documentation for the iCloud Apple device image URL format
https://statici.icloud.com/fmipmobile/deviceImages-9.0/iPhone/iPhone9,4-2-3-0/online-infobox__3x.png
A B C D E F G
A: deviceImages version seems to determine the format of the image specifier (C, D, E, F)
B: device marketing name
C: device model identifier
D: color cover glass (front color)
1 - Black
2 - White
E: device enclosure color (back color)
#!/bin/sh
# default commands for osx to make it nicer to work with
##########################
# General UI?UX settings #
##########################
# Set hostname (hex of MVB9APPS)
sudo scutil --set ComputerName "0x4d56423941505053"
sudo scutil --set HostName "0x4d56423941505053"