Skip to content

Instantly share code, notes, and snippets.

View keith's full-sized avatar

Keith Smiley keith

View GitHub Profile
import re
import __builtin__
from itertools import islice
# See https://sourceware.org/gdb/current/onlinedocs/gdb/Convenience-Funs.html
# breakpoint command add -F '_caller_is("theCaller")'
# breakpoint command add -F 'not _caller_is("theCaller")'
def _caller_is(name):
def check(frame, loc, _):
@DerekSelander
DerekSelander / dsresign
Last active April 16, 2023 02:26
Resign iOS .app directories, expects app dir, provisioning profile, [optional] new name for iOS app
#!/bin/bash
# MIT License
#
# Copyright (c) 2018 Derek Selander (@LOLgrep)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@jpsim
jpsim / swift_dev_linux.md
Created December 14, 2017 18:18
Build & run a subset of Swift tests on Linux

Build & run a subset of Swift tests on Linux

# Spin up a beefy Digital Ocean droplet
doctl compute droplet create swift-dev --size m-224gb --image ubuntu-16-10-x64 --region sfo2 --ssh-keys XXXXXXX
doctl compute ssh swift-dev
# Install dependencies
apt-get update
apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev autoconf libtool systemtap-sdt-dev tzdata
# Clone & build Swift
As of iOS 11/macOS High Sierra, and only including ones in Foundation and CoreFoundation
Strings:
_NSCFString - a CFStringRef or CFMutableStringRef. This is the most common type of string object currently.
- May have 8 bit (ASCII) or 16 bit (UTF-16) backing store
_NSCFConstantString - a compile time constant CFStringRef, like you'd get with @"foo"
- May also be generated by dynamic string creation if matches a string in a pre-baked table of common strings called the StringROM
NSBigMutableString - an NSString backed by a CFStorage (https://github.com/opensource-apple/CF/blob/master/CFStorage.h) for faster handling of very large strings
NSCheapMutableString - a very limited NSMutableString that allows for zero-copy initialization. Used in NSFileManager for temporarily wrapping stack buffers.
@mikeash
mikeash / xcode.sh
Created September 15, 2017 17:07
Convince Xcode 9 not to smooth its source code font
#!/bin/bash
# Exit the script immediately on error
set -e
# We'll work in /tmp
cd /tmp
# Clone mach_override unless we already have it
if [ ! -d mach_override ]; then
@romainl
romainl / vanilla-linter.md
Last active May 6, 2024 01:48
Linting your code, the vanilla way

Linting your code, the vanilla way

You may want a linter plugin to lint your code in Vim but you probably don't need it. At least try the built-in way before jumping on the plugin bandwagon.

Defining makeprg

autocmd FileType <filetype> setlocal makeprg=<external command>

This autocommand tells Vim to use <external command> when invoking :make % in a <filetype> buffer. You can add as many similar lines as needed for other languages.

@danielmartin
danielmartin / xcode-unofficial-theme-support.md
Last active February 6, 2022 14:00
Xcode unofficial theme support

Xcode unofficial (and undocumented) theme support

Most people is familiar with Xcode theme support for the text editor. You simply open Preferences, Fonts & Colors and duplicate an existing theme (or create a new one from scratch). Xcode editor themes have the .dvtcolortheme extension.

However, there's some support for themeing Xcode itself (fonts, gradients, colors). Xcode loads the default theme from /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Default.dvttheme.

.dvttheme files are simply XML files that conform to an undocumented schema. If you want to modify any of the settings in Default.dvttheme, instead of modifying the bundle resource file you can instruct Xcode to load your custom .dvttheme from wherever you want:

@soffes
soffes / Rakefile
Last active January 16, 2023 16:37
Programmatically build and sign a Developer ID macOS app
TEAM_ID = 'XXXXXXXXXX'
APP_NAME = 'My App'
SCHEME_NAME = APP_NAME
desc 'Create a beta build'
task :build do
# Ensure clean git state
unless system 'git diff-index --quiet HEAD --'
abort 'Failed. You have uncommitted changes.'
end
@ddunbar
ddunbar / xcbuild-debugging-tricks.md
Last active April 13, 2024 15:41
Xcode new build system debugging tricks

New Build System Tricks

Command Line

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole  # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]
@steipete
steipete / SpringboardDestroyer.swift
Last active October 23, 2019 19:45
SpringboardDestroyer. Too many background tasks make Frontboard very sad. See http://openradar.appspot.com/32482871
let badwork = { (queue: DispatchQueue) in
queue.async {
let app = UIApplication.shared
for index in 0..<100000 {
let name = "Yolo \(index)"
let identifier = app.beginBackgroundTask(withName: name, expirationHandler: {
print("Expired")
});