Skip to content

Instantly share code, notes, and snippets.

View npinto's full-sized avatar

Nicolas Pinto npinto

View GitHub Profile
@npinto
npinto / gist:1818999
Created February 13, 2012 18:45
boots
#!/bin/bash
PJT=$HOME/venv/hongmajaj_ht_vs_neurons
set -e
set -x
test ! -d ${PJT}
mkdir -p ${PJT}
virtualenv ${PJT}
@npinto
npinto / montage2d.py
Created February 13, 2012 21:27
montage2d
import numpy as np
from scipy import misc
import pylab as pl
from skimage.util import shape
def foo(p):
alpha = int(np.ceil(np.sqrt(p.shape[0])))
# -- fill missing squares
cst = p.mean()
@npinto
npinto / site.cfg
Created February 24, 2012 20:32
Numpy's site.cfg on Gentoo 64bit with atlas
[atlas]
include_dirs =
library_dirs = :/usr/lib64
atlas_libs = cblas, blas, atlas
lapack_libs = lapack, blas, cblas, atlas
[blas_opt]
include_dirs =
library_dirs = :/usr/lib64
libraries = cblas, blas, atlas
[lapack_opt]
import numpy as np
from numpy.lib.stride_tricks import as_strided
for dtype in ('float32', 'float16'):
print 'trying with', dtype
arr_in = np.random.randn(10, 10, 4).astype(dtype)
window_shape = (5, 5, 1)
arr_shape = np.array(arr_in.shape)
@npinto
npinto / system_info_patch-r2.diff
Created March 6, 2012 05:44
Numpy support for detecting libraries in several directories simultaneously (for numpy-1.6.1) see bug report at http://projects.scipy.org/numpy/ticket/993
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
index 6dedf59..972a219 100644
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -424,11 +424,7 @@ class system_info:
dirs = self.get_lib_dirs()
info = {}
for lib in libs:
- i = None
- for d in dirs:
@npinto
npinto / log
Created March 18, 2012 21:06
brew install -v cairo
==> Downloading http://www.cairographics.org/releases/cairo-1.10.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/cairo-1.10.2.tar.gz
/usr/bin/tar xf /Library/Caches/Homebrew/cairo-1.10.2.tar.gz
==> ./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/cairo/1.10.2 --with-x --enable-xcb
./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/cairo/1.10.2 --with-x --enable-xcb
checking for gcc... /usr/bin/gcc-4.2
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
@npinto
npinto / blas-hb-bug.py
Created March 19, 2012 11:14
blas honeybadger bug
import numpy as np
from scipy import linalg
N = 1000
X = np.random.random((N, 512))
K = np.dot(X, X.T)
v, Q = linalg.eigh(K)
@npinto
npinto / timestretch-1.8X-320.sh
Created March 22, 2012 10:49
audiobook timestretch beta scripts
#!/bin/bash
mkdir -p 1.8X
for f in *.mp3; do
src="$f"; dst="1.8X/$(basename "$f")";
echo "${src}" to "${dst}";
sox "$src" "${dst}.wav" tempo 1.8 50;
lame -b 320 "${dst}.wav" "${dst}";
rm -vf "${dst}.wav";
done;
@npinto
npinto / plos09_l3_stride_one.gson
Created March 27, 2012 22:19
plos09_l3_stride_one.gson
[[("lnorm",
{"kwargs": {"inker_shape": choice([(3, 3), (5, 5), (7, 7), (9, 9)]),
"outker_shape": this.inker_shape,
"remove_mean": choice([false, true]),
"stretch": choice([0.1, 1, 10]),
"threshold": choice([0.1, 1, 10])}})],
[("fbcorr",
{"initialize": {"filter_shape": choice([(3, 3), (5, 5), (7, 7), (9, 9)]),
"generate": ("random:uniform", {"rseed": 42}),
"n_filters": choice([16, 32, 64])},
@npinto
npinto / gist:2372927
Created April 13, 2012 02:03
brew install -v homebrew/dupes/vim
==> Cloning https://vim.googlecode.com/hg/
Updating /Library/Caches/Homebrew/vim--hg
hg pull
warning: vim.googlecode.com certificate with fingerprint b9:6a:92:25:09:74:2b:14:03:70:27:b0:9f:18:f3:30:ef:02:d3:ec not verified (check hostfingerprints or web.cacerts config setting)
pulling from https://vim.googlecode.com/hg/
searching for changes
no changes found
hg update
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
==> Checking out revision 70eff6af1158