Skip to content

Instantly share code, notes, and snippets.

View sherbondy's full-sized avatar

Ethan Sherbondy sherbondy

View GitHub Profile
@sherbondy
sherbondy / lappyramid.jl
Created January 3, 2015 03:10
Laplacian Pyramid
# generates a laplacian pyramid decomposition of an image A, with nlevels + 1 residual level
function lappyramid(A, nlevels)
residual = A
pyramid = ()
for n = 1:nlevels
(N, Ns) = impyramid(residual, sizes="both")
L = residual - N
residual = Ns
pyramid = tuple(pyramid..., L)
@sherbondy
sherbondy / gaussianpyramid.jl
Created January 3, 2015 03:09
Gaussian Pyramid
function gaussianpyramid(A, levels)
pyramid = ()
Ns = A
for n = 1:levels
pyramid = tuple(pyramid..., Ns)
Ns = impyramid(Ns)
end
return pyramid
@sherbondy
sherbondy / impyramid.jl
Created January 3, 2015 03:09
Image Pyramid
# generates a lower level of the Gaussian pyramid decomposition of an image.
function impyramid(A; sizes="downsampled")
a = 0.375
kernel = [1/4 - a/2, 1/4, a, 1/4, 1/4 - a/2]
B = imfilter(imfilter(A,kernel), kernel') # slowest part of impyramid, by far
if (sizes == "downsampled")
return (B[1:2:end, 1:2:end])
elseif (sizes == "both")
return (B, B[1:2:end,1:2:end])
@sherbondy
sherbondy / gist:a7db89941c55bfa062d1
Last active August 29, 2015 14:10
Running OVR SDK 0.4.4 Beta on Ubuntu 14.10
@sherbondy
sherbondy / typed stack trace
Last active January 1, 2016 06:59
NullPointerException from core.typed, oh no :(
rt.main=> (check-ns)
Initializing core.typed ...
Loading Clojurescript...
Clojurescript found and loaded.
Initializing cljs.core
NullPointerException clojure.core/deref-future (core.clj:2108)
rt.main=> (e)
java.lang.NullPointerException: null
at clojure.core$deref_future.invoke (core.clj:2108)
Initializing core.typed ...
Loading Clojurescript...
Clojurescript not found
"Elapsed time: 3083.994912 msecs"
core.typed initialized.
Start collecting rt.core
Finished collecting rt.core
Collected 1 namespaces in 3721.379436 msecs
Start checking rt.core
44: Not checking rt.core/->Vector3 definition
@sherbondy
sherbondy / chrome-extension-install.js
Created November 7, 2013 22:40
Woah, one-click chrome extension installation, found while browsing the one-tab website... Didn't know this existed, but makes complete sense.
var clickTargetIds = ['installButton1', 'installButton2'];
var isChrome = navigator.userAgent.indexOf("Chrome")!=-1;
for(var i in clickTargetIds) {
document.getElementById(clickTargetIds[i]).onclick = function() {
if(isChrome) {
window['chrome']['webstore']['install'](undefined, function() {
// damn, they even record analytics events to see how effective the install button is...
@sherbondy
sherbondy / macsetup.txt
Created October 26, 2013 22:39
Poverty. Developing on mac os without root is hard.
`source /afs/athena.mit.edu/user/e/t/ethanis/MacData/.rvm/scripts/rvm`
rvm get head
rvm autolibs disable
rvm list remote
rvm install ruby-1.9.3-p327 --binary
rvm alias create default ruby-1.9.3-p327
rvm use default
gem install cocoapods
pod install
@sherbondy
sherbondy / flux.sh
Last active December 26, 2015 04:39
Flux as a daemon (had trouble getting the gui to work on debian wheezy)
#!/bin/sh
### BEGIN INIT INFO
# Provides: xflux
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Initialize flux on launch
# Description: Flux helps you to avoid eye and disrupted sleep patterns strain by adjusting your display colors based on time of day.
### END INIT INFO
@sherbondy
sherbondy / core.clj
Last active December 22, 2015 05:49
definition missing complaint
ns rt.core
(:refer-clojure :exclude [+ - * /])
(:require [clojure.core.typed :as typed
:refer [ann ann-datatype ann-form ann-record check-ns tc-ignore]])
(:require [clojure.algo.generic.arithmetic :as arith :refer [+ - * /]]))
(ann-record Vec3 [x :- Number y :- Number z :- Number])
(defrecord Vec3 [x y z])
(ann ^:no-check clojure.algo.generic.arithmetic/+ [Vec3 Vec3 -> Vec3])