Skip to content

Instantly share code, notes, and snippets.

View ngaloppo's full-sized avatar

Nico Galoppo ngaloppo

View GitHub Profile
def yield_or_eval &block
return unless block
if block.arity > 0
yield self
else
self.instance_eval(&block)
end
end
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/ngaloppo/6216772/raw | /bin/bash -ex
# When forking, you can get the URL from the download button.
pushd $HOME
### Install tools ###
packages='curl git vim tmux'
@ngaloppo
ngaloppo / init.pp
Created August 13, 2013 23:38 — forked from asimihsan/init.pp
class opencv {
Exec { path => "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin", }
$version = "2.4.6.1"
$libopencv_core_filename = "libopencv_core.so.2.4.6"
case $operatingsystem {
# Install OpenCV from source. This is an instructive example
# and may come in handy if we need to move to a version of
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew.git
HEAD: 4c2cee38dfe682c7375facc5bcf0e28c467e47df
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit ivybridge
OS X: 10.8.4-x86_64
Xcode: 4.6.3
CLT: 4.6.0.0.1.1365549073
LLVM-GCC: build 2336
@ngaloppo
ngaloppo / piplist.txt
Created September 18, 2014 15:04
Output of pip list
argcomplete (0.6.7)
astropy (0.3.2)
atom (0.3.7)
backports.ssl-match-hostname (3.4.0.2)
beautifulsoup4 (4.3.1)
binstar (0.5.3)
bitarray (0.8.1)
blaze (0.5)
blz (0.6.2)
bokeh (0.4.4)
@ngaloppo
ngaloppo / gist:c63f3db5da92d7d6864d
Created November 14, 2014 18:14
Make unix directory group accessible
sudo chgrp -R staff /alt
chmod +R g+rw /alt
umask 002 # allow group write; everyone must do this
chmod g+s . # files created in directory will be in group G
def format_bytes(n):
order = 0
while n > 1024:
order += 1
n //= 1024
return '%d%sB' % (n, ('', 'k', 'M', 'G', 'T', 'P')[order])
@ngaloppo
ngaloppo / pythonvimfix.txt
Last active December 30, 2015 20:03
editorconfig / anaconda / vim fix
Make sure PYTHONHOME is set to the right path!
@ngaloppo
ngaloppo / video_info.py
Created March 23, 2016 18:28
OpenCV video information extraction
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import logging
import cv2 as cv
import argparse
import os
log = logging.getLogger('test_video')
name: "VGG_ILSVRC_16_layers"
input: "data"
input_shape {
dim: 1
dim: 3
dim: 224
dim: 224
}