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
var crypto = require('crypto') | |
, rrange = 4294967296; | |
/** | |
* Return an integer, pseudo-random number in the range [0, 2^32). | |
*/ | |
var nextInt = function() { | |
return crypto.randomBytes(4).readUInt32BE(0); | |
}; |
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
while read requirement; do conda install --no-update-deps --yes $requirement || pip install $requirement; done < requirements.txt |
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
- (CGImageRef)createMaskFromAlphaChannel:(UIImage *)image | |
{ | |
size_t width = image.size.width; | |
size_t height = image.size.height; | |
NSMutableData *data = [NSMutableData dataWithLength:width*height]; | |
CGContextRef context = CGBitmapContextCreate( | |
[data mutableBytes], width, height, 8, width, NULL, kCGImageAlphaOnly); |
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
void qt_dispatch_sync_to_main_queue(dispatch_block_t aBlock) { | |
if ([NSThread isMainThread]) { | |
aBlock(); | |
} else { | |
dispatch_sync(dispatch_get_main_queue(), aBlock); | |
} | |
} |