Skip to content

Instantly share code, notes, and snippets.

View mattstevens's full-sized avatar

Matt Stevens mattstevens

View GitHub Profile
@mattstevens
mattstevens / gist:9712783
Last active August 29, 2015 13:57
Preference Panes and Garbage Collection
- On 10.6 and 10.7 System Preferences's 64-bit image requires GC. If the user opens a preference pane
that does not support GC System Preferences will restart as a 32-bit process, provided that the
preference pane has a 32-bit image.
- On 10.8+ System Preferences's 64-bit image supports GC but does not require it, and by default it
launches with GC disabled. If the user opens a preference pane that requires GC System Preferences
relaunches with GC enabled, but still as a 64-bit process.
So if your deployment target is <= 10.7 you'll get the best user experience by building with
GCC_ENABLE_OBJC_GC = supported, as the preference pane will run on all platforms without requiring a
@mattstevens
mattstevens / interlink.rb
Created September 12, 2009 17:20
A modified version of the wikiwords filter for Webby
@mattstevens
mattstevens / com.alloysoft.DroboKeepAlive.plist
Created November 2, 2009 04:38
Launch agent to prevent Drobo spin down on OS X
<?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>Label</key>
<string>com.alloysoft.DroboKeepAlive</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/touch</string>
<string>/Volumes/Drobo/.keepalive</string>
@mattstevens
mattstevens / localpath.rb
Created December 9, 2009 17:17
Webby filter to create paths readable by the file system for CHM and Mac help bundles
module Webby
class Renderer
attr_reader :page
end
module Filters
# To use add localpath to the end of the list of filters in the layout.
# Converts all links starting with '/' to use relative paths and appends
# 'index.html' to all links both starting and ending with '/'.
@mattstevens
mattstevens / SITEFILE
Created December 9, 2009 21:43
Webby helper to convert links to absolute URLs
# Define the base URL in the sitefile
SITE.base = 'http://yourdomain.com'
#!/usr/bin/env node
var sys = require('sys'),
path = require('path'),
fs = require('fs'),
pcap = require('pcap'), pcap_session,
tcp_tracker = new pcap.TCP_tracker();
var device = undefined;
var filter = "";
@mattstevens
mattstevens / HD
Created May 22, 2011 21:23
Xbench results upgrading a 2010 MacBook Pro's stock HD with an SSD
System Info
Xbench Version 1.3
System Version 10.6.7 (10J869)
Physical RAM 8192 MB
Model MacBookPro6,2
Drive Type TOSHIBA MK5055GSXF
Disk Test 20.07
Sequential 80.14
Uncached Write 74.35 45.65 MB/sec [4K blocks]
Uncached Write 74.26 42.01 MB/sec [256K blocks]
#import <Foundation/Foundation.h>
#import <Security/Security.h>
static const char *public_key = "-----BEGIN DSA PUBLIC KEY-----\n"
"MIHxMIGoBgcqhkjOOAQBMIGcAkEAvPM8vp7lHRrWFhpso2I/Wrq1qV8TSl7/YITH\n"
"7cHsINCP/xrZZpTlx14pKNkKwEEf3t3bdkKY97NQKRJ+cIRyawIVAMDJQP8l7EVy\n"
"fcqtVnJjJupPIccxAkBhLjwIRUNerlWb0kW357ABc4+65XB90lQIdcwVLGqRsx9A\n"
"wKoeeMUEyVdQhjJMnclvYJU+xqnl2AP9224QOGGLA0QAAkEAkFQyL1jGMfEjer1O\n"
"QjBq7knMY8zHEUVNRbPXBNS5QenFg07rgMUFL/Bj6/876pWvubwpDAcXkiK+SR3A\n"
"FRF/VA==\n"
@mattstevens
mattstevens / gist:3540222
Created August 30, 2012 20:34
NSDate for next minute
NSDate *now = [NSDate date];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *nowComponents = [calendar components:NSSecondCalendarUnit fromDate:now];
NSDateComponents *offsetComponents = [[NSDateComponents alloc] init];
[offsetComponents setMinute:1];
[offsetComponents setSecond:-[nowComponents second]];
NSDate *nextMinute = [calendar dateByAddingComponents:offsetComponents toDate:now options:0];
NSTimeInterval interval = [nextMinute timeIntervalSinceDate:now];
@mattstevens
mattstevens / gist:eb758f55cb2898b670a5
Created November 8, 2015 17:25
Filter breakpoint on frame module
(lldb) b NSLog
Breakpoint 2: 2 locations.
(lldb) breakpoint command add -s python -o "return (frame.GetThread().GetFrameAtIndex(1).GetModule().GetFileSpec().GetFilename() == 'UIKit')"