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 -re -i <input> -f mpegts udp://<hostname>:<port>?pkt_size=188&buffer_size=65535 |
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
set theNextOrCurrentEvent to (do shell script "/usr/local/bin/icalBuddy -ic \"Calendar\" -eep \"*\" -nc -b \"\" -n -li 1 eventsToday") |
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
// AppDelegate is a Singleton | |
YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate]; |
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
// From: http://mobile.tutsplus.com/tutorials/iphone/ios-sdk_nsnotificationcenter/ | |
// Add Methods to post and handle notifications | |
@interface ViewController () | |
- (void)postNotificationWithString:(NSString *)orientation; | |
- (void)useNotificationWithString:(NSNotification*)notification; | |
@end | |
/** | |
* Register for notifications. |
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
// Add the UIGestureRecognizer to the UITableView in viewDidLoad: | |
-(void)didSwipe:(UIGestureRecognizer *)gestureRecognizer { | |
if (gestureRecognizer.state == UIGestureRecognizerStateEnded) { | |
CGPoint swipeLocation = [gestureRecognizer locationInView:self.tableView]; | |
NSIndexPath *swipedIndexPath = [self.tableView indexPathForRowAtPoint:swipeLocation]; | |
UITableViewCell* swipedCell = [self.tableView cellForRowAtIndexPath:swipedIndexPath]; | |
// ... | |
} |
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
# From: http://osxdaily.com/2010/05/07/create-an-instant-web-server-via-terminal-command-line/ | |
python -m SimpleHTTPServer | |
# With port | |
python -m SimpleHTTPServer 8000 |
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
//http://stackoverflow.com/questions/8528726/does-ios-5-support-blur-coreimage-fiters | |
@interface UIImage (ImageBlur) | |
- (UIImage *)imageWithGaussianBlur9; | |
@end | |
@implementation UIImage (ImageBlur) | |
- (UIImage *)imageWithGaussianBlur9 { | |
float weight[5] = {0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162}; | |
// Blur horizontally |
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
#!/usr/bin/env python | |
# place in /etc/periodic/daily to run nightly (or hourly if set up): | |
# | |
# sudo cp -f timemachine.py /etc/periodic/daily/667.timemachine | |
# sudo cp -f timemachine.py /etc/periodic/hourly/667.timemachine | |
import re | |
import datetime | |
import time |
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
CREATE SEQUENCE <field_seq>; | |
ALTER TABLE <table> | |
ALTER COLUMN <field> TYPE SMALLINT USING <field>::integer | |
, ALTER COLUMN <field> SET NOT NULL | |
, ALTER COLUMN <field> SET DEFAULT nextval('<field_seq>'); | |
ALTER SEQUENCE <field_seq> | |
OWNED BY <table>.<field>; |