Skip to content

Instantly share code, notes, and snippets.

View keith's full-sized avatar

Keith Smiley keith

View GitHub Profile
@keith
keith / xcode-mcp-tools.json
Created February 4, 2026 17:18
Xcode 26.3.0 RC 1 MCP tools/list response
{
"tools": [
{
"name": "XcodeRead",
"title": "Read",
"description": "Reads the contents of a file within the Xcode project organization. Returns content in cat -n format with line numbers. Supports reading up to 600 lines by default with optional offset and limit parameters for large files.",
"inputSchema": {
"type": "object",
"properties": {
"filePath": {
@keith
keith / renew-gpgkey.md
Created May 6, 2026 16:58 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@keith
keith / foo.bzl
Created April 8, 2026 19:47
An example macro for producing static and dynamic libraries for a cc_library
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_shared_library.bzl", "cc_shared_library")
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("@rules_cc//cc/common:cc_shared_library_info.bzl", "CcSharedLibraryInfo")
def _cc_library_reexporter_impl(ctx):
return [
ctx.attr.static_lib[CcInfo],
ctx.attr.dynamic_lib[CcSharedLibraryInfo],
]
@keith
keith / simctl-commands.txt
Last active January 12, 2026 12:17
All the subcommands of `xcrun simctl` (including ones that aren't listed in `simctl help`) LC_SOURCE_VERSION 776.1 (Xcode 13.0 beta 5)
addmedia
addphoto
addvideo
appinfo
boot
bootstatus
clone
create
darwinup
delete
@keith
keith / testflight.sh
Last active October 15, 2025 06:22
Upload an ipa to testflight using altool
#!/bin/bash
set -euo pipefail
xcrun altool --upload-app --type ios --file "path/to/foo.ipa" --username "$ITC_USER" --password "$ITC_PASSWORD"
@keith
keith / sudoers
Last active July 4, 2025 00:24
The default macOS 14.2.1 sudoers file
#
# Sample /etc/sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
##
# Override built-in defaults
##
@keith
keith / exclusivity.md
Last active January 11, 2025 03:47
The matrix of Xcode build settings to compiler flags for Swift memory exclusivity
  • Compiler flag: -enforce-exclusivity=<value>
  • Build setting: SWIFT_ENFORCE_EXCLUSIVE_ACCESS

Xcode 10.1 & Swift 4.2

  • Compiler default for non optimized builds if you pass no argument is the same as if you passed checked
  • Compiler default for optimized builds if you pass no argument is the same as if you passed unchecked
Configuration Compiler Flag Value Build Setting Description Build Setting Value Notes
@keith
keith / README.md
Last active January 8, 2025 18:59
A test of `@_dynamicReplacement` in Swift

Usage

  1. swiftc main.swift -emit-module-path main.swiftmodule -emit-executable -enable-private-imports -Xfrontend -enable-implicit-dynamic
  2. ./main -> prints From original bar()
  3. swiftc -emit-library inject.swift -o inject.dylib -I . -Xlinker -undefined -Xlinker suppress -Xlinker -flat_namespace -Xfrontend -disable-access-control
  4. DYLD_INSERT_LIBRARIES=inject.dylib ./main -> prints From replacement bar()

Notes

  • Passing -Xfrontend -enable-implicit-dynamic removes you from having to add dynamic to everything you want to be replacable
@keith
keith / newSite.rb
Created September 25, 2012 18:03
Quickly create a new site complete with boilerplate
#!/usr/bin/ruby
#
# Purpose:
# This script is for easily creating new websites with different boilerplates
# to minimize the amount of wasted time downloading and renaming files
#
# Installation:
# 1. Put this script somewhere permanent where you can call it from
# 2. In terminal run `chmod 755 newSite.rb` # Or whatever you name the script
@keith
keith / SpawniTerm.applescript
Last active July 22, 2022 19:37
Spawn a new iTerm window in the pwd
on run argv
tell application "iTerm"
set t to make new terminal
tell t
activate current session
launch session "Default Session"
tell the last session
write text "cd \"" & item 1 of argv & "\"; clear; pwd"
end tell
end tell