Skip to content

Instantly share code, notes, and snippets.

@rvill
rvill / LD_Library_Path
Last active August 29, 2015 14:04
set LD library path
export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}
#path to bin directory with libANN_char.so, Approximate Nearest Neighbor library
export LD_LIBRARY_PATH=./bin/
@rvill
rvill / mapbox.framework
Created July 31, 2014 19:11
Create independent project with mapbox.framework sdk
#Not mentioned after following mapbox.com/mapbox- ios-sdk, go to Targets > Build Settings > Search Paths > User Header Search Paths
$(SCROOT)/path/to/mapbox.framework
#select 'recursive'
@rvill
rvill / HTTPheaderObjC
Created August 5, 2014 17:09
Set HTTP headers in objective c
NSURL *theURL = [NSURL URLWithString:@"yourURL"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:theURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:20.0f];
//Specify method of request(Get or Post)
[theRequest setHTTPMethod:@"GET"];
//Pass some default parameter(like content-type etc.)
[theRequest setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[theRequest setValue:@"application/json; charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
@rvill
rvill / mount_root
Created September 12, 2014 01:06
mount / on linux recovery
mount -o remount, rw /
@rvill
rvill / nvidia drivers on linux
Created September 12, 2014 01:58
run ./nvidiaxxx.run with no check flag
Add the --no-x-check flag in terminal:
sudo ./NVIDIAxxxx.run --no-x-check
@rvill
rvill / regex flickr url id in python
Last active August 29, 2015 14:08
Grab image id from flickr URL with regular expression in python
url = 'https://farm4.staticflickr.com/3943/15386021170_c2607cb639_z.jpg'
#\d+ match digits; \D+ match a non-digit which is "/" after the 1st 4 digits; (d\+) get the last set of digits, in group(6)
re.search(r'^(https://)?(farm4\.)?(staticflickr\.com/)?(\d+)?(\D+)(\d+)',url).group(6)
#returns 15386021170
@rvill
rvill / mount cmd
Created November 13, 2014 17:11
usb pen drive unrecognized by ubuntu 14.04
sudo mount /dev/sdb1 /mnt
@rvill
rvill / compile opencv g++
Created November 19, 2014 01:15
compile opencv g++
g++ -o test_1 test_1.cpp `pkg-config opencv --cflags --libs`
@rvill
rvill / opencv - flags
Created November 24, 2014 03:43
opencv - check for parameter names
>>> import cv2
>>> flags = [i for i in dir(cv2) if i.startswith('COLOR_')]
>>> print flags
@rvill
rvill / UDID
Created January 16, 2015 04:05
get iOS device UDID without xcode or itunes, using linux cmd line
lsusb -v 2> /dev/null | grep -e "Apple Inc" -A 2