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
static char *getPropertyType(objc_property_t property) { | |
const char *attributes = property_getAttributes(property); | |
const char *start; | |
int len = strlen(attributes); | |
if (len >= 3 && attributes[0] == 'T' && attributes[1] == '@' && attributes[2] == '"') { | |
start = attributes + 3; | |
char *end = strchr(start, '"'); | |
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
/* | |
* File: main.cpp | |
* Author: christian | |
* | |
* Created on 9 de junio de 2012, 9:07 | |
*/ | |
#include <cstdlib> | |
#include <math.h> | |
#include <stdio.h> |
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
/* | |
* File: main.cpp | |
* Author: christian | |
* | |
* Created on 21 de noviembre de 2011, 14:00 | |
*/ | |
#include <cstdlib> | |
#include <math.h> | |
#include <stdio.h> |
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
- (CGImageRef)createMaskWithImageAlpha:(CGContextRef)originalImageContext | |
{ | |
UInt8 *data = (UInt8 *)CGBitmapContextGetData(originalImageContext); | |
float width = CGBitmapContextGetBytesPerRow(originalImageContext) / 4; | |
float height = CGBitmapContextGetHeight(originalImageContext); | |
int strideLength = ROUND_UP(width * 1, 4); | |
unsigned char * alphaData = (unsigned char * )calloc(strideLength * height, 1); | |
CGContextRef alphaOnlyContext = CGBitmapContextCreate(alphaData, |
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
lines = [line.strip() for line in open('beautiful_stringstxt.txt')] | |
m = lines[0] | |
out = '' | |
for x in xrange(1, int(m)+1): | |
l = lines[x].lower() | |
dic = {} | |
line = '' | |
for i in l: | |
if i not in dic: |
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
#import <Foundation/Foundation.h> | |
@class JSONRequest; | |
@protocol JSONRequest <NSObject> | |
- (void)didReceiveJSONResponse:(id)objectResponse; | |
- (void)didNotReceiveJSONResponse:(NSError *)error; | |
@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
private static ArrayList<Point> findAroundCoordinates(Double lat, Double lon, Double range){ | |
// Number of points | |
int numberOfPoints = 32; | |
Double degreesPerPoint = 360.0 / numberOfPoints; | |
int currentAngle = 0; | |
Double x2; | |
Double y2; |
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
lines, out = [line.strip() for line in open('data.in')], '' | |
for x in xrange(1, int(lines[0])+1): | |
l = lines[x].upper() | |
import re | |
for w in l.split(' '): | |
m = re.search('^h.+o|^p.*r$', w, re.IGNORECASE) | |
l = l.replace(w, "#" * w.__len__()) if m and m.groups() > 0 else l | |
out += l + "\n" | |
with open ('data.out', 'w') as f: f.write (out) |
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/zsh | |
SESSIONNAME="script" | |
tmux has-session -t $SESSIONNAME &> /dev/null | |
if [ $? != 0 ] | |
then | |
tmux new-session -s $SESSIONNAME -n script -d | |
tmux send-keys -t $SESSIONNAME "~/bin/script" C-m | |
fi |
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
import cv2.cv as cv | |
import tesseract | |
gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE) | |
cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY) | |
api = tesseract.TessBaseAPI() | |
api.Init(".","eng",tesseract.OEM_DEFAULT) | |
api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz") | |
api.SetPageSegMode(tesseract.PSM_SINGLE_WORD) | |
tesseract.SetCvImage(gray,api) | |
print api.GetUTF8Text() |