Skip to content

Instantly share code, notes, and snippets.

View ssahu's full-sized avatar

Sarthak Sahu ssahu

  • San Francisco, CA
View GitHub Profile

Installing opencv fails, even though $ brew doctor doesn't have any complaints:

$ brew install opencv
==> Downloading https://github.com/Itseez/opencv/archive/2.4.7.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/opencv-2.4.7.1.tar.gz
==> Patching
patching file cmake/OpenCVFindOpenNI.cmake
Warning: Formula#python is deprecated and will go away shortly.
Error: undefined method `incdir' for #<PythonDependency: "python" []>
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@ssahu
ssahu / fb_profile_img.sh
Created June 13, 2015 00:03
Download fb-profile-images
#!/bin/bash
# This script downloads the profile images of facebook profile ids from 1 to 10
# change the start and end ids and use it - does not require any login
for i in {1..10}; do wget http://graph.facebook.com/picture?id=$i&width=10000 -O $i.jpg; done
@ssahu
ssahu / 6986.lines.json
Last active August 29, 2015 14:24
6986.lines.json
{"lines":[{"pid":[0],"image":67522,"s":[366.1640625,1093.109375],"e":[653.8359375,377.515625]},{"pid":[0],"image":67522,"s":[398.8359375,1061.234375],"e":[631.5234375,487.484375]},{"pid":[0],"image":67522,"s":[688.1015625,367.953125],"e":[1061.8359375,916.203125]},{"pid":[0],"image":67522,"s":[698.4609375,420.546875],"e":[1036.3359375,918.59375]},{"pid":[0],"image":67522,"s":[467.3671875,1022.1875],"e":[668.9765625000001,525.734375]},{"pid":[0],"image":67522,"s":[428.3203125000001,1161.6406250000002],"e":[425.1328125000001,1404.6875000000002]},{"pid":[0],"image":67522,"s":[1179.7734375,1113.03125],"e":[1181.3671875,1643.75]},{"pid":[0,1],"image":67522,"s":[1981.4296875,1152.8749999999995],"e":[1981.4296875,1340.9374999999995]},{"pid":[1],"image":67522,"s":[2141.6015625,1093.9062499999986],"e":[2326.4765625,889.1093749999986]},{"pid":[1],"image":67522,"s":[2198.1796875,1067.6093749999986],"e":[2316.9140625,934.5312499999986]},{"pid":[1],"image":67522,"s":[2344.8046875,892.2968749999986],"e":[2482.6640625,1076.
@ssahu
ssahu / min-char-rnn.py
Last active August 29, 2015 14:26 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
print '%d unique characters in data.' % (len(chars), )
@ssahu
ssahu / remove-docker.sh
Created November 20, 2015 07:59
uninstall docker completely
boot2docker stop
boot2docker delete
sudo rm /usr/local/bin/docker
sudo rm /usr/local/bin/boot2docker
sudo rm /usr/local/share/boot2docker/boot2docker.iso
sudo rmdir /usr/local/share/boot2docker
rm -rf ~/.boot2docker
rm ~/.ssh/id_boot2docker*
sudo rm -f /private/var/db/receipts/io.boot2docker.*
sudo rm -f /private/var/db/receipts/io.boot2dockeriso.*
@ssahu
ssahu / notes.txt
Last active November 20, 2015 08:17
install caffe notes - el capitan, matlab r2012a, etc cpu mode only
instructions to set paths after installing mkl
file:///opt/intel/documentation_2016/en/ps2016/getstart_comp_mc.htm
sudo vi /opt/intel/composer_xe_2015/tbb/bin/tbbvars.sh
change == to '=='
disable system integration protection for el capitan: csrutil disable
to use the fallback library path
add the following to the bashrc/zshrc
export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib:/usr/lib:/opt/intel/composer_xe_2015.2.132/compiler/lib:/opt/intel/composer_xe_2015.2.132/mkl/lib
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats