Skip to content

Instantly share code, notes, and snippets.

@JiboStore
JiboStore / clean_ds_store.sh
Created December 19, 2012 07:30
clean all .DS_Store files recursively
find . -name '*.DS_Store' -type f -delete
@JiboStore
JiboStore / gist:4489778
Created January 9, 2013 01:25
Remove all .DS_Store recursively
alias rmdsstores='find ./ -type f | grep .DS_Store | xargs rm'
@JiboStore
JiboStore / gist:5693636
Created June 2, 2013 13:21
Thuzi / facebook-node-sdk error log: #issue41
access_token = CAAB2dKc4ZCMEBAAn2vCajKjEJUK5DGQ2urcUIij2wtLbvg6fmbUmEQW4YKxj5QZAemDyx8yLXKyLlZBcZBAeUMIhFUzmul8G45k5h0hBZCu3R07tCZC4QZBQRElACOKYh48CDUodIA4P7t4HITHvwgZC
{ error:
{ message: 'An unknown error has occurred.',
type: 'OAuthException',
code: 1 } }
JSON Stringify: {"error":{"message":"An unknown error has occurred.","type":"OAuthException","code":1}}
POST /announce 500 452ms - 486
{ meal: 'http://nodescrumptious.azurewebsites.net/meals/cheeseburger',
place: '361771023937832',
tags: '510683132',
@JiboStore
JiboStore / Facebook SDK Android Graph API Request
Created June 7, 2013 02:43
Facebook SDK Android Graph API Request
Bundle params = new Bundle();
params.putString( "fields", "fields=id,username,name,first_name,last_name,picture" );
final Request request = new Request( Session.getActiveSession(), "me", params, HttpMethod.GET, new Request.Callback() {
@Override
public void onCompleted(Response response) {
Log.d( "FacebookConnect", "FacebookConnect > retrieveUserData responds: " + response.toString() );
Log.d( "FacebookConnect", "FacebookConnect > retrieveUserData graphObject: " + response.getGraphObject() );
Log.d( "FacebookConnect", "FacebookConnect > retrieveUserData graphObjectList: " + response.getGraphObjectList() );
}
@JiboStore
JiboStore / openssl_genrsa
Created April 22, 2014 05:29
GENERATE PUBLIC/PRIVATE KEY PAIR:
GENERATE PUBLIC/PRIVATE KEY PAIR:
For PHP:
openssl genrsa > drmsign.pem
openssl rsa -in drmsign.pem -pubout > drmsign.pub
Then convert to DER (required by Java):
http://codeartisan.blogspot.sg/2009/05/public-key-cryptography-in-java.html
openssl pkcs8 -topk8 -inform PEM -outform DER -in drmsign.pem -out drmsign.der -nocrypt
openssl rsa -in drmsign.pem -pubout -outform DER -out drmsign_pub.der
@JiboStore
JiboStore / gist:dfe0fdfbd8f7de6f0af7
Created July 15, 2015 09:42
that'll auto serialise all your changed prefabs (ie write to disk) anytime you play or build
using UnityEditor;
using UnityEditor.Callbacks;
public class AutoSerialiseAssets : Editor {
[PostProcessScene(-2)]
public static void OnPostprocessScene() {
EditorApplication.SaveAssets();
}
}
git diff --no-prefix --ignore-space-at-eol | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" > changes.patch
Getting Apple's receipt in iOS 8 onwards:
NSURL *receiptUrl = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receiptData = [NSData dataWithContentsOfURL:receiptUrl];
// receiptData = [GTMBase64 encodeData:receiptData];
// NSString *receiptString = [[NSString alloc] initWithData:receiptData encoding:NSUTF8StringEncoding];
NSString *receiptString = [receiptData base64EncodedStringWithOptions:0];
NSString *appleJson = [NSString stringWithFormat:@"{ \"receipt-data\" : \"%@\" }", receiptString];
NSLog(@"%@", appleJson);
The receipt:
for DIRECTORY in */;
do
pushd "${DIRECTORY}"
echo "${DIRECTORY}" >> ../git-remote.txt
echo "===================================================================" >> ../git-remote.txt
git remote -v >> ../git-remote.txt
echo "-------------------------------------------------------------------" >> ../git-remote.txt
git log -1 >> ../git-remote.txt
popd
done