View update_loc_xibs.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 ParseMobileProvision.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 auto_examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /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 ReadEntitlementsFromCodeSignature.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
View ios_device_lockstate.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <notify.h> | |
void test() | |
{ | |
int notify_token; | |
notify_register_dispatch("com.apple.springboard.lockstate", ¬ify_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 gist:2236186
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CoreFoundation/CoreFoundation.h> | |
#include <dlfcn.h> | |
static CFBundleRef GetPluginBundle() | |
{ | |
static CFBundleRef bundle; | |
if (bundle) { | |
return bundle; | |
} |
View gist:4492320
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSMutableDictionary *queryParameters = [NSMutableDictionary dictionary]; | |
for (NSString *string in [[URL query] componentsSeparatedByString:@"&"]) { | |
NSArray *array = [string componentsSeparatedByString:@"="]; | |
if ([array count] == 2) | |
[queryParameters setObject:[array objectAtIndex:1] forKey:[array objectAtIndex:0]]; | |
} |
View coremidi_virtual_source.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <CoreMIDI/CoreMIDI.h> | |
char buffer[1024]; | |
MIDIClientRef client = 0; | |
MIDIEndpointRef endpoint = 0; | |
MIDIPacketList *packetList = (void *)buffer; | |
MIDIPacket *packet = 0; | |
MIDIPortRef port = 0; |
View gist:5336704
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -loglevel verbose -i input.mkv -acodec copy -vcodec copy output.mp4 |
View gist:5678403
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias bbc6music='open -a "QuickTime Player" $(curl -s http://www.bbc.co.uk/radio/listen/live/r6_aaclca.pls | grep File1= | sed s/File1=//)' |
OlderNewer