Skip to content

Instantly share code, notes, and snippets.

View Xcode_warning_settings.txt
CLANG_WARN__DUPLICATE_METHOD_MATCH
37a38
> -Wduplicate-method-match
CLANG_WARN__EXIT_TIME_DESTRUCTORS
37c37
< -Wno-exit-time-destructors
---
> -Wexit-time-destructors
View keybase.md

Keybase proof

I hereby claim:

  • I am nickdowell on github.
  • I am nickdowell (https://keybase.io/nickdowell) on keybase.
  • I have a public key ASCVNmhBpxVhpMEx_FXUvs5_LQy5W9TLiiE3gNjGFzB1lQo

To claim this, I am signing this object:

View aps_environment.m
NSString *getApsEnvironment()
{
NSString *provisioningPath = [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"];
if (!provisioningPath)
return (NSString *)nil;
// NSISOLatin1 keeps the binary wrapper from being parsed as unicode and dropped as invalid
NSScanner *scanner = [NSScanner scannerWithString:[NSString stringWithContentsOfFile:provisioningPath encoding:NSISOLatin1StringEncoding error:NULL]];
if (![scanner scanUpToString:@"<plist" intoString:nil])
return (NSString *)nil;
View ios_device_lockstate.m
#import <Foundation/Foundation.h>
#import <notify.h>
void test()
{
int notify_token;
notify_register_dispatch("com.apple.springboard.lockstate", &notify_token, dispatch_get_main_queue(), ^(int token) {
uint64_t state = UINT64_MAX;
notify_get_state(token, &state);
NSLog(@"com.apple.springboard.lockstate = %llu", state);
View ReadEntitlementsFromCodeSignature.m
#import <dlfcn.h>
#import <mach-o/dyld.h>
#import <mach-o/loader.h>
int main(int argc, char *argv[]) {
NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] executablePath]];
NSData *codeSignatureData = nil;
@nickdowell
nickdowell / auto_examples
Last active Aug 29, 2015
automount configuration examples
View auto_examples
# /etc/auto_examples
afp_vol -fstype=afp afp://user:password@server/afp_vol
smb_vol -fstype=smbfs ://user:password@server/smb_vol
#note: no password can be specified for NFS
nfs_vol server:/nfs_vol
View ParseMobileProvision.m
NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]];
const char *ptr = [data bytes], *start = NULL, *end = NULL;
for (size_t i = 0; i < [data length] - 8; i++) {
if (memcmp(ptr + i, "<plist", 6) == 0) {
start = ptr + i;
}
if (memcmp(ptr + i, "</plist>", 8) == 0) {
end = ptr + i + 8;
}
}
View update_loc_xibs.sh
#!/bin/bash
set -o errexit
set -o pipefail
langs=(de es fr pt)
for path in en.lproj/*.xib; do
git diff --quiet $path && git diff --cached --quiet $path || {
echo -n "updating localizations for $path"
View UIViewRecurse.m
void UIViewRecurse(UIView *view, void (^ apply)(UIView *subview))
{
static void (^ recurse)(UIView *subview, void (^ apply)(UIView *subview)) = nil;
if (recurse == nil)
recurse = ^(UIView *subview, void (^ apply)(UIView *subview)){
apply(subview);
for (UIView *v in subview.subviews)
recurse(v, apply);
};
recurse(view, apply);
View gist:5678403
alias bbc6music='open -a "QuickTime Player" $(curl -s http://www.bbc.co.uk/radio/listen/live/r6_aaclca.pls | grep File1= | sed s/File1=//)'