Skip to content

Instantly share code, notes, and snippets.

@snown
snown / gist:1045269
Created June 24, 2011 17:37
Start up and shutdown FlexRAID with computer
# flexraid - start/stop FlexRAID 2.0
#
# This service starts up the FlexRaid process so that RAIDing of Data drives can resume
description "FlexRAID 2.0"
author "Logan Holmes"
start on runlevel [2345]
stop on runlevel [06]
@snown
snown / gist:1251355
Created September 29, 2011 17:32
TextExpander AppleScript Snippet for next or previous X day of the week
(*
AppleScript for use in a TextExpander snippet to print out the date of the next Monday (or whatever day of the week you define) in the format of "Monday 13 April 2011"
Maintained at https://gist.github.com/1251355
*)
(* Set Weekday and Month names in your language of choice here (for example, French) *)
set day_names to {"dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"}
set month_names to {"janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"}
@snown
snown / gist:1368381
Created November 15, 2011 21:20
Bad selector
2011-11-15 13:04:12.310 DropKey[23151:244f] -[NSKeyValueObservationInfo dropKeyFileReaderNotification:]: unrecognized selector sent to instance 0x1001a3f40
2011-11-15 13:04:12.310 DropKey[23151:6713] -[WRACryptoOperation start] [Line 47]
2011-11-15 13:04:12.312 DropKey[23151:244f] An uncaught exception was raised
2011-11-15 13:04:12.322 DropKey[23151:1b6f] -[WRACryptoOperationEncrypting main] [Line 97]
2011-11-15 13:04:12.323 DropKey[23151:244f] -[NSKeyValueObservationInfo dropKeyFileReaderNotification:]: unrecognized selector sent to instance 0x1001a3f40
2011-11-15 13:04:12.325 DropKey[23151:244f] (
0 CoreFoundation 0x00007fff8c9e7286 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff94fded5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff8ca734ce -[NSObject doesNotRecognizeSelector:] + 190
3 CoreFoundation 0x00007fff8c9d4133 ___forwarding___ + 371
@snown
snown / gist:1411457
Created November 30, 2011 22:34
Derive and Construct a new NSBezierPath
- (void)resetDerivedPathDictionary:(NSMutableDictionary *)aDerivedPathDictionary {
if ([aDerivedPathDictionary count] > 0) {
[aDerivedPathDictionary removeAllObjects];
}
[aDerivedPathDictionary setObject:[NSMutableArray array] forKey:WRADerivedPathInstructionsKey];
}
- (void)addLast:(NSInteger)numberOfElements elementsFromBezierPath:(NSBezierPath *)aBezierPath toDerivedPathDictionary:(NSMutableDictionary *)aDerivedPathDictionary atIndex:(NSUInteger)index {
NSLog(@"%s [Line %d]", __PRETTY_FUNCTION__, __LINE__);
@snown
snown / gist:2220524
Created March 27, 2012 21:33
TextExpander AppleScript Snippet to produce Bacon Ipsum filler text
# Requires "JSON Helper" app. Available for free in the Mac App Store: http://itunes.apple.com/us/app/json-helper-for-applescript/id453114608?mt=12
set numberOfParagraphs to 2
tell application "JSON Helper"
set baconIpsum to fetch JSON from "http://baconipsum.com/api/?type=all-meat&start-with-lorem=1&paras=" & numberOfParagraphs
set resultString to ""
repeat with i from 1 to (count of items in baconIpsum)
@snown
snown / sickbeard.log
Created July 9, 2013 19:06
Log file after updating Sickbeard to commit [fb37d332b333b43e7bcae46b619ae6b7ef94e266](https://github.com/midgetspy/Sick-Beard/commit/fb37d332b333b43e7bcae46b619ae6b7ef94e266) Launch now hangs on "INFO::MAIN :: [3/4] Updating history to reflect the correct action..."
Jul-09 11:27:12 INFO MAIN :: Checking database structure...
Jul-09 11:27:12 DEBUG MAIN :: Checking Initial Schema database upgrade
Jul-09 11:27:12 DEBUG MAIN :: sickbeard.db: SELECT 1 FROM sqlite_master WHERE name = ?; with args ('tv_shows',)
Jul-09 11:27:12 DEBUG MAIN :: InitialSchema upgrade not required
Jul-09 11:27:12 DEBUG MAIN :: Checking Add Tvr Id database upgrade
Jul-09 11:27:12 DEBUG MAIN :: AddTvrId upgrade not required
Jul-09 11:27:12 DEBUG MAIN :: Checking Add Tvr Name database upgrade
Jul-09 11:27:12 DEBUG MAIN :: AddTvrName upgrade not required
Jul-09 11:27:12 DEBUG MAIN :: Checking Add Airdate Index database upgrade
Jul-09 11:27:12 DEBUG MAIN :: sickbeard.db: SELECT 1 FROM sqlite_master WHERE name = ?; with args ('idx_tv_episodes_showid_airdate',)
@snown
snown / du-sorted
Created February 10, 2014 22:00
A quick (and possibly inefficient) shell script to output the `du` command sorted by human readable file size.
#!/usr/bin/env bash
du -sk "$@" | sort -nr | cut -f2 | sed 's/.*/\"&\"/' | tr "\\n" " " | xargs du -sh
@snown
snown / UIGestureRecognizer+NSStringFunctions.h
Created February 18, 2014 17:29
A UIGestureRecognizer Category to generate NSStrings for use with NSLog
#import <UIKit/UIKit.h>
@interface UIGestureRecognizer (NSStringFunctions)
/**
* Returns a string formatted to display the pertenent name of the
* `UIGestureRecognizerState`
*
* Often this just returns the text of the variable name after
* "UIGestureRecognizerState". For Example, `UIGestureRecognizerStatePossible`

Keybase proof

I hereby claim:

  • I am snown on github.
  • I am logan (https://keybase.io/logan) on keybase.
  • I have a public key whose fingerprint is 82AF 6207 4B8F E5D5 EC87 F8E3 8FF8 576D 0053 32A7

To claim this, I am signing this object:

@snown
snown / Interceptor.m
Created March 31, 2014 21:21
Non functional sample code
@implementation Interceptor
+ (IMP)instanceMethodForSelector:(SEL)aSelector {
NSLog(@"instanceMethodForSelector:");
IMP result = [super instanceMethodForSelector:aSelector];
NSLog(@"+[super instanceMethodForSelector:%@] = %p", NSStringFromSelector(aSelector), result);
return result;
}