- download RASPBIAN from http://www.raspberrypi.org/downloads/. Download with torrent. Direct download usually fails (without any warning in Chrome! File size will be differ if download fails in the middle but there's no size to check in the download website!).
- And it's a good idea to check SHA1 of the zip file first. (e.g.
openssl sha1 2014-01-07-wheezy-raspbian.zip
) - format SD card as FAT-32
- run
df -h
, find disk location. e.g./dev/disk2s4", add r and remove s4 "/dev/rdisk2
- write the image file into SD card with command
sudo dd bs=1m if=2014-01-07-wheezy-raspbian.img of=/dev/rdisk2
https://www.andrewmunsell.com/blog/getting-started-raspberry-pi-install-raspbian - plug in HDMI before turn on RPi or else display will not work. If forgot, do NOT pull the power to restart right away. Wait for some time (about 3 min) for RPi to finish setting up its keys and stuff. Otherwise you will
This file contains hidden or 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
+ (NSString*)levelName { | |
if ([self isSubclassOfClass:[FGRoom class]]) { | |
return @"Room"; | |
} | |
} |
This file contains hidden or 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
@interface FGEntityLine : NSObject | |
@property (readonly, nonatomic) NSUInteger companyId; | |
@property (readonly, nonatomic) NSUInteger brandId; | |
@property (readonly, nonatomic) NSUInteger propertyId; | |
/** Returns YES if all identifiers are equal. */ | |
- (BOOL)isEqualToEntityLine:(FGEntityLine *)line; | |
@end |
This file contains hidden or 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
// using block in interface property, use "copy" | |
@property (copy, nonatomic) void (^simpleBlock)(void); | |
@property (copy, nonatomic) BOOL (^blockWithParamter)(NSString *input); | |
// block variable declaration | |
void (^addButton)(SEL, NSString *) = ^(SEL action, NSString *imageName) { | |
}; | |
// block typedef shorthand | |
typedef BOOL (^FailureHandler)(NSError *error); |
This file contains hidden or 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
+ (void)errTest2:(NSError**)error { | |
// Use error object ONLY IF it is provided, otherwise it will CRASH!!! | |
if (error != NULL) { | |
NSLog(@"Creating error object..."); | |
*error = [NSError errorWithDomain:...]; | |
} | |
else { | |
NSLog(@"No error object provided, skip error object creation."); | |
} | |
} |
This is how you connect PS3 controller to Mac OSX, PC, etc. when previously connected to a PS3. You will need a Mini USB cable. Overcome your laziness, get up of your chair, and go get one!
A big misconception is that keep holding PS button will reset the controller's pairing. It DOES NOT! From my testings, the controller keeps paring with the last machine it was CONNECTED VIA A USB CABLE.
Here are the steps:
This file contains hidden or 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 | |
# TestFlight-upload.sh | |
# https://gist.github.com/hlung/7818585 | |
# | |
# By Thongchai Kolyutsakul @hlungx | |
# Version: v1.0.3 - 27 Oct 2014 | |
# | |
# Requirement: Shenzhen (https://github.com/nomad/shenzhen) | |
# |
This file contains hidden or 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/python | |
# fix-xcode-sdk | |
# Rob Napier <[email protected]> | |
# Forked by Thongchai Kolyutsakul <[email protected]> | |
# (https://gist.github.com/hlung/6806651) | |
# Script to link in all your old SDKs every time you upgrade Xcode | |
# Create a directory called /SDKs (or modify source_path). | |
# Under it, put all the platform directories: |
This file contains hidden or 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
#pragma mark - GCDAsyncSocketDelegate | |
- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port { | |
[self secureSocket:sock]; | |
} | |
// We are connecting to server with self-signed certificate and don't include the certificate | |
// (public key .pem) in the client. So we skip all the cert checking. To actually check, see | |
// http://stackoverflow.com/questions/9874932/ssl-identity-certificate-to-run-an-https-server-on-ios | |
- (void)secureSocket:(GCDAsyncSocket *)sock { | |
// It has been changed in CocoaAsyncSocket v7.4, some old option keys are now unavailable and will throw exception. | |
// Use GCDAsyncSocketManuallyEvaluateTrust and evaluate in -socket:didReceiveTrust: delegate instead. |
This file contains hidden or 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
/** Converts NSData to a hexadecimal string. */ | |
@interface NSData (NSData_hexadecimalString) | |
/** Changes NSData object to a hex string. | |
@returns hexadecimal string of NSData. Empty string if data is empty.*/ | |
- (NSString *)hexadecimalString; | |
@end | |
@implementation NSData (NSData_hexadecimalString) |