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
#!/bin/bash | |
watch -n 10 'curl https://data.mtgox.com/api/2/BTCUSD/money/ticker | tee data/ticker.$(date +"%Y-%m-%d_%R:%S.%N").json | python -mjson.tool; for f in data/*.json; do gzip $f; done;' |
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
UIImageOrientation imageOrientation; | |
if (UserDefaults.usingFrontCamera) { | |
switch (curDeviceOrientation) { | |
case UIDeviceOrientationLandscapeLeft: | |
imageOrientation = UIImageOrientationDown; | |
break; | |
case UIDeviceOrientationLandscapeRight: | |
imageOrientation = UIImageOrientationUp; | |
break; | |
case UIDeviceOrientationPortraitUpsideDown: |
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
UIDeviceOrientation curDeviceOrientation = [[UIDevice currentDevice] orientation]; | |
enum { | |
PHOTOS_EXIF_0ROW_TOP_0COL_LEFT = 1, // 1 = 0th row is at the top, and 0th column is on the left (THE DEFAULT). | |
PHOTOS_EXIF_0ROW_TOP_0COL_RIGHT = 2, // 2 = 0th row is at the top, and 0th column is on the right. | |
PHOTOS_EXIF_0ROW_BOTTOM_0COL_RIGHT = 3, // 3 = 0th row is at the bottom, and 0th column is on the right. | |
PHOTOS_EXIF_0ROW_BOTTOM_0COL_LEFT = 4, // 4 = 0th row is at the bottom, and 0th column is on the left. | |
PHOTOS_EXIF_0ROW_LEFT_0COL_TOP = 5, // 5 = 0th row is on the left, and 0th column is the top. | |
PHOTOS_EXIF_0ROW_RIGHT_0COL_TOP = 6, // 6 = 0th row is on the right, and 0th column is the top. | |
PHOTOS_EXIF_0ROW_RIGHT_0COL_BOTTOM = 7, // 7 = 0th row is on the right, and 0th column is the bottom. |
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
NSString* jsonPath = [[NSBundle mainBundle] pathForResource:@"arr_fb" ofType:@"json"]; | |
NSData* jsonData = [NSData dataWithContentsOfFile:jsonPath]; | |
JSONDecoder* decoder = [[JSONDecoder alloc] initWithParseOptions:JKParseOptionNone]; | |
NSDictionary* json = [decoder objectWithData:jsonData]; | |
NSArray* shape = [json objectForKey:@"shape"]; | |
NSUInteger fbn_ = [[shape objectAtIndex:0] intValue]; |
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
import os | |
from os import path | |
__location__ = path.realpath(path.join(os.getcwd(), path.dirname(__file__))) |
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
import time | |
import gc | |
import numpy as np | |
def theano_memory_hack(func_exp, local_vars, | |
input_exps=('input',), | |
msize_best=None, | |
msize_start=1024, msize_factor=2, | |
verbose=False): |
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
url = "http://www.youtube.com/watch?v=pkCTAeLsX7E" | |
import os | |
import sysfrom sys import stderr | |
import tempfile | |
import commandsfrom os import path | |
from sys import stdout | |
from subprocess import Popen, PIPE, STDOUT | |
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
import cv2 | |
import cv2.cv as cv | |
def detect(img, cascade_fn='haarcascades/haarcascade_frontalface_alt.xml', | |
scaleFactor=1.3, minNeighbors=4, minSize=(20, 20), | |
flags=cv.CV_HAAR_SCALE_IMAGE): | |
cascade = cv2.CascadeClassifier(cascade_fn) | |
rects = cascade.detectMultiScale(img, scaleFactor=scaleFactor, |
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
In [12]: l = ['a', 'a', 'c', 'c', 'c', 'b'] | |
In [13]: u = np.unique(l) | |
In [14]: u | |
Out[14]: | |
array(['a', 'b', 'c'], | |
dtype='|S1') | |
In [15]: np.searchsorted(u, l) |
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
*.so | |
_demo.cpp | |
build |
NewerOlder