Skip to content

Instantly share code, notes, and snippets.

@stilist
stilist / init.pp
Created July 11, 2014 22:11 — 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
@stilist
stilist / gist:cd7fdfabbf9ec5ed89b7
Created July 3, 2014 21:46
Installing OpenCV on OS X (using Homebrew)

Based on http://jjyap.wordpress.com/2014/02/21/installing-opencv-2-4-8-on-mac-osx-with-python-support/

  1. edit .bashrc or .bash_profile to include: export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Python/2.7/site-packages/:$PATH"
  2. brew update
  3. brew tap homebrew/science
  4. brew install opencv
  5. cd /Library/Python/2.7/site-packages/
  6. ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py
  7. ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv2.so cv2.so
@stilist
stilist / .bash_profile
Last active December 24, 2015 06:29
`bundle exec rake` shorthand
function be () {
bundle exec $@
}
function ber () {
bundle exec rake $@
}
@stilist
stilist / Gemfile
Last active December 15, 2015 06:49
Flickr backup script
source "https://rubygems.org"
ruby "1.9.3"
gem "flickraw"
@stilist
stilist / sinatra_json_api.rb
Last active December 10, 2015 06:18
How I run Backbone.js applications on Sinatra.
require "sinatra/base"
module Sinatra
# = Sinatra::JsonApi
#
# <tt>Sinatra::JsonApi</tt> is an extension meant for use with Backbone-style
# apps that use the backend strictly as an API. It assumes that full page
# loads should serve only to bootstrap the frontend application.
#
# == Usage
require 'sinatra'
require 'action_mailer'
class Mailer < ActionMailer::Base
def contact
mail(
:to => "[email protected]",
:from => "[email protected]",
:subject => "Test") do |format|
format.text
@stilist
stilist / .bash_profile
Last active October 13, 2015 12:58
Natural-language git commands
# [...]
function parse_git_branch () {
local git_status="`git status -unormal 2>&1`"
# fatal: Not a git repository (or any of the parent directories): .git
if [[ $git_status == fatal* ]] ; then
echo ""
# On branch master
#
@stilist
stilist / .bash_profile
Last active October 13, 2015 10:08
Bash stuff!
export EDITOR=nano
# http://git-blame.blogspot.com/2012/02/anticipating-git-1710.html
export GIT_MERGE_AUTOEDIT=no
export CC=clang
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
###############################################################################
@stilist
stilist / gist:3752151
Created September 19, 2012 20:45
If you’re ever curious about your setTimeout calls…
var oldTimeout = setTimeout;
window.setTimeout = function(callback, timeout) {
var date = new Date();
console.log(("** " + timeout + "ms"), callback);
oldTimeout(function() { callback(); }, timeout);
}
@stilist
stilist / gist:3179287
Created July 25, 2012 23:17
.bash_profile
export SHELL=/bin/bash
# system paths
export PATH=/usr/local/bin:/bin:/usr/sbin:/sbin:$HOME/bin:$PATH
# MySQL
export PATH="/usr/local/mysql/bin:$PATH"
# node.js
export NODE_PATH="$HOME/local/node:$HOME/local/node/lib/node_modules"