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
| rpm -Uvh http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm | |
| yum install postgresql92 postgresql92-server postgresql92-contrib postgis2_92 postgis2_92-utils | |
| chkconfig postgresql-9.2 on | |
| service postgresql-9.2 initdb | |
| service postgresql-9.2 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
| #import <Foundation/Foundation.h> | |
| @interface NSString (Concatenation) | |
| - (NSString *):(NSString *)a; | |
| - (NSString *):(NSString *)a :(NSString *)b; | |
| - (NSString *):(NSString *)a :(NSString *)b :(NSString *)c; | |
| - (NSString *):(NSString *)a :(NSString *)b :(NSString *)c :(NSString *)d; | |
| - (NSString *)concat:(NSString *)strings, ...; |
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
| #if defined _cplusplus | |
| extern "C" { | |
| #endif | |
| void your_c_function() | |
| { | |
| ... | |
| } | |
| #if defined _cplusplus | |
| } | |
| #endif |
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 | |
| # build the environment | |
| mkdir tessenv; cd tessenv | |
| TROOT=`pwd` | |
| mkdir $TROOT/stockfonts; mkdir $TROOT/build; mkdir $TROOT/build/eng | |
| echo "Environment built" | |
| # Get the stock english fonts from Google (old, but they work) | |
| cd $TROOT/stockfonts | |
| GET http://tesseract-ocr.googlecode.com/files/boxtiff-2.01.eng.tar.gz > boxtiff-2.01.eng.tar.gz |
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
| <% [:notice, :error, :alert].each do |level| %> | |
| <% unless flash[level].blank? %> | |
| <div class="alert <%= flash_class(level) %>"> | |
| <button type="button" class="close" data-dismiss="alert">×</button> | |
| <span><%= flash[level] %></span> | |
| </div> | |
| <% end %> | |
| <% 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
| 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() |
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
| 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
| 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
| #import <Foundation/Foundation.h> | |
| @class JSONRequest; | |
| @protocol JSONRequest <NSObject> | |
| - (void)didReceiveJSONResponse:(id)objectResponse; | |
| - (void)didNotReceiveJSONResponse:(NSError *)error; | |
| @end |