This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% make a grid from [0, 2] x [0, 2] | |
[x, y] = meshgrid(0:.1:2, 0:.1:2); | |
% now we construct the vector field | |
u = -y; | |
v = x; | |
% why do they call it quiver? | |
quiver(x,y,u,v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% The linspace command in matlab has spacing which is strange (x2 - x1)/(n-1). This is incorrect for the Fourier commands. This command fixes the problem. | |
function x = fourier_linspace(x1, x2, N) | |
% we can use the matlab linspace command and just ignore the right endpoint. | |
x = linspace(x1, x2, N + 1); | |
x = x(1:end - 1); | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% simple script that allows one to plot the Fourier modes. % The modes should be given in Terry Tao's notation so that | |
% u = \sum_{i = 1}^N exp(2 \pi n xi) \hat{u}_n | |
% For example, cos would be given as [0 1/2] | |
function plot_fourier_modes(K, modes) | |
plot(fourier_linspace(0, 2*pi, 2*K + 1), ifft(full_fourier_spectrum(K, modes))); grid on; | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% generate a simple heatmap in matlab | |
colormap('hot'); | |
% randomly generate some noise | |
data = rand(100, 100); | |
% plot "image with scaled color". | |
imagesc(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% simple command that converts a vector to a multidimensional index given the size of the array | |
% you should ignore any singleton dimensions (don't provide an element of the vector) | |
% TODO turn this into a Gist | |
% size_of_matrix: vector of dimensions of the matrix (can include singleton dimensions) | |
% vec_index: a vector whose nth component corresponds to the nth index. | |
function indx = vec2ind(size_of_matrix, vec_index) | |
% We convert this to a linear index. Not that matlab takes the full n dimensional integer | |
% lattice and converts it to a one dimensional integer lattice by reading off successive columns. | |
% the formula (really bijection between countable sets) between Z^n_1 x Z^n_2 x Z^n_3 --- Z^n_k is given by | |
% (a_0, a_1, ..., a_n) -> a_0 + (b_0)(a_1 - 1) + (b_0 b_1) (a_2 - 1) + (b_0 b_1 b_2) (a_3 - 1) + .... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple makefile for java programs | |
JCC = javac | |
LIBS = /usr/bin/apache-commons.jar:/usr/bin/pdfbox.jar | |
JFLAGS = -g -cp $(LIBS):. | |
# we clear any default suffixes | |
.SUFFIXES: .java .class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# awesome python script that takes all files from the camera and archives them. | |
# it imports from the temp directory and builds a large archive in the Photo folders. | |
# The current iteration is quite functional in an effort for conciseness. | |
import os, time, shutil, calendar, subprocess, sys, fnmatch, shutil, re | |
from os import path | |
class PhotoArchiver: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# g++ -mmacosx-version-min=10.8 -o bin/kepler kepler.cpp image_compare.cpp s3_conn.cpp report_parser.cpp `GraphicsMagick++-config --cppflags --cxxflags --ldflags --libs` -L 'reference source/jsoncpp-src-0.5.0/libs/linux-gcc-4.2.1' -ljson -I 'reference source/jsoncpp-src-0.5.0/include/json' -L 'reference source/libs3-2.0/build/lib' -I 'reference source/libs3-2.0/inc' -I include -lcurl -lxml2 -lz -ls3 | |
GMLINKER=`GraphicsMagick++-config --cppflags --cxxflags --ldflags --libs` | |
IDIR = include | |
CC = g++ | |
CFLAGS =-I$(IDIR) -mmacosx-version-min=10.8 -Wall -I/usr/local/include/GraphicsMagick -g | |
ODIR = bin | |
LDIR =../lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"description" : "", | |
"elements" : | |
[ | |
{ | |
"description" : "", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var root = (typeof exports == 'undefined' ? window : exports); | |
var config = { | |
// Ensure Content-Type is an image before trying to load @2x image | |
// https://github.com/imulus/retinajs/pull/45) | |
check_mime_type: true | |
}; |