Skip to content

Instantly share code, notes, and snippets.


Tom Harrington atomicbird

View GitHub Profile

Keybase proof

I hereby claim:

  • I am atomicbird on github.
  • I am atomicbird ( on keybase.
  • I have a public key whose fingerprint is 04AD 033D D950 E0FB 263E A6CC 7013 5FE6 A156 5DE3

To claim this, I am signing this object:

View gist:53453
#include <stdlib.h>
#include <stdio.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
#include <sys/types.h>
#include <unistd.h>
// Return 1 if being debugged, 0 if not (or if debug status can't be determined).
int beingDebugged()
View gist:105321
// Define a debug-build-only NSLog wrapper. DLog printing will only happen in debug builds.
#ifdef DEBUG
#define DLog(...) NSLog(__VA_ARGS__)
#define DLog(...)
View gist:119598
(gdb) info sharedlibrary
The DYLD shared library state has been initialized from the executable's shared library information. All symbols should be present, but the addresses of some symbols may move when the program is executed, as DYLD may relocate library load addresses if necessary.
Requested State Current State
Num Basename Type Address Reason | | Source
| | | | | | | |
1 dyld - 0x8fe00000 dyld Y Y /usr/lib/dyld at 0x8fe00000 (offset 0x0) with prefix "__dyld_"
2 valgrind - 0x1000 exec Y Y /usr/local/bin/valgrind (offset 0x0)
3 libgcc_s.1.dylib - 0x96526000 dyld Y Y /usr/lib/libgcc_s.1.dylib at 0x96526000 (offset -0x69ada000)
4 libSystem.B.dylib - 0x9652e000 dyld Y Y /usr/lib/libSystem.B.dylib at 0x9652e000 (offset -0x69ad2000)
(commpage objfile is) /usr/lib/libSystem.B.dylib[LC_SEGMEN
View gist:131546
// - (id)initWithContentsOfURL:(NSURL *)url error:(NSError **)outError;
NSError *error;
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:wavURL error:&error];
// Warning: passing argument 2 of 'initWithContentsOfURL:error:' from distinct Objective-C type
View gist:151715
==35777== 18 bytes in 1 blocks are possibly lost in loss record 650 of 3,892
==35777== at 0x1075CA: malloc_zone_malloc (vg_replace_malloc.c:198)
==35777== by 0xA54BD4: _strdup_internal (in /usr/lib/libobjc.A.dylib)
==35777== by 0xA594BD: __sel_registerName (in /usr/lib/libobjc.A.dylib)
==35777== by 0x3F9319: NSKeyValueMethodForPattern (in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation)
==35777== by 0x3FB0A0: +[NSObject(NSKeyValueCodingPrivate) _createMutableSetValueGetterWithContainerClassID:key:] (in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation)
==35777== by 0x3FAE7F: _NSKeyValueMutableSetGetterForClassAndKey (in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation)
==35777== by 0x3F881E: _NSKVONotifyingEnableForInfoAndKey (in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation)
==35777== by 0x3F8407: -[NSKeyValueUnnestedProperty _isaForAutonotifying] (in /System/Library/Frameworks/Foundation.framework/
View gist:265058
// Assuming NSString *username, NSString *password, NSURLRequest *request...
NSData *authRawData = [[NSString stringWithFormat:@"%@:%@", username, password] dataUsingEncoding:NSUTF8StringEncoding];
NSString *authEncoded = [authRawData asBase64EncodedString];
[request setValue:[NSString stringWithFormat:@"Basic %@", authEncoded] forHTTPHeaderField:@"Authorization"];
View gist:321253
--- Color4.h ---
@interface Color4 : NSObject {
-(id) initWithRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha;
--- Color4.m ---
View gist:356814
kern.ostype = Darwin
kern.osrelease = 10.3.1
kern.osrevision = 199506
kern.version = Darwin Kernel Version 10.3.1: Mon Mar 15 23:15:33 PDT 2010; root:xnu-1504.2.27~18/RELEASE_ARM_S5L8930X
kern.maxvnodes = 750
kern.maxproc = 52
kern.maxfiles = 12288
kern.argmax = 262144
kern.securelevel = 0
kern.hostname = [redacted]
View gist:360696
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
opQ = [[NSOperationQueue alloc] init];
[[NSNotificationCenter defaultCenter] addObserverForName:@"CustomOperationCompleted"
object:nil queue:opQ
usingBlock:^(NSNotification *notif) {
NSNumber *theNum = [notif.userInfo objectForKey:@"NumberOfItemsProcessed"];
NSLog(@"Number of items processed: %i", [theNum intValue]);