Eitan Grinspun’s “How to host a visit”

August 25th, 2016

Eitan has prepared a google doc on hosting visitors to the lab that I find very useful. It contains a detailed list (some unique to Columbia) of things you should do to host a visitor and when you should do them.

Real-time LaTeX in browser

August 23rd, 2016

A long time ago, I made a little web app that allowed you to submit Latex code to a server, the server would run pdflatex and then send back the pdf to be rendered on the page.

Nowadays MathJax can render LaTeX equations in the browser. I found http://www.texrendr.com that let’s you interactively write formulae, but it’s restricted to a single equation. There’s also the LaTeXit standalone app, but you have to keep hitting “typeset”. This isn’t so useful if you’re trying to quickly type math during a Skype call.

So I wrote a little program to run in the browser:


You can also fork the git gist

option click on volume menu bar item to change sound devices

August 19th, 2016

I find myself often switching the microphone and speaker devices on my mac. I usually go all the way through System Preferences > Sound, but I stumbled upon a much faster route.

Normally if you click on the volume menu item at the top of the screen you get a little volume slider:

volume menu bar

If you hold OPTION while you click you see a device selection menu:

volume menu bar option click

Energy optimization, calculus of variations, Euler Lagrange equations in Maple

August 16th, 2016

Here’s a simple demonstration of how to solve an energy functional optimization symbolically using Maple.

Suppose we’d like to minimize the 1D Dirichlet energy over the unit line segment:

min  1/2 * f'(t)^2
subject to: f(0) = 0, f(1) = 1

we know that the solution is given by solving the differential equation:

f''(t) = 0, f(0) = 0, f(1) = 1

and we know that solution to be

f(t) = t

How do we go about verifying this in Maple:

E := diff(f(t),t)^2:
L := EulerLagrange(E,t,f(t)):

so far this will output:

        L := {-2*diff(diff(x(t),t),t), -diff(x(t),t)^2 = K[2], 2*diff(x(t),t) = K[1]}

Finally solve with the boundary conditions using:


which will output

         t(t) = t

Are you using libigl?

August 3rd, 2016

I would love to gather up some information about who out there is using libigl. Drop me a line if you or your university/institution/company is.

Inverse of common ease curves

July 13th, 2016

Awkwardly I ended up needing the inverse of an ease curve (or S-curve) used in tweening animations. For trigonometric ease curves, this is easy. For example, if your ease filter is:

f = 0.5-cos(x*pi)*0.5;

then the inverse is:

x = acos(-2*(f-0.5))/pi

But if you’re using the famous cubic ease curve,

f = 3.*x.^2 - 2.*x.^3

then the relevant inverse is a complex function (involving the i = sqrt(-1)) that produces real values for f in [0,1]:

x = -1./4.*(1-2.*f+2.*(f.^2-f).^(1./2)).^(1./3)-1./4./(1-2.*f+2.*(f.^2-f).^(1./2)).^(1./3)+1./2-1./2.*i.*3.^(1./2).*(1./2.*(1-2.*f+2.*(f.^2-f).^(1./2)).^(1./3)-1./2./(1-2.*f+2.*(f.^2-f).^(1./2)).^(1./3));

I haven’t bothered to see if this can be simplified into something tidy. It’d be great to get rid of the i.

MAC Address Spoofing on Mac OS X for unlimited free hour passes on xfinitywifi and CableWiFi networks

July 8th, 2016

From what I gather, xfinity charges people to “rent” wifi routers and then uses that hardware to host pay-per-use public wifi networks. These networks are usually named xfinitywifi or CableWiFi. Every 24 hours each MAC Address is granted a “$0.00 Complimentary Free Pass”:

  1. CLICK I am not an XFINITY customer
  2. CLICK Sign Up
  3. CHOOSE $0.00 for a Complimentary Hour Pass
  4. CLICK Start Session

To “spoof” a new wifi MAC Address on MAC OS X, one can issue:

ifconfig en0 | grep ether

This will spit out a number like: 70:51:81:c1:3f:6e. Record this number. To set your MAC address to a random yet valid address use:

sudo ifconfig en0 ether `openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`

Then, later, if you want to return to your old address issue:

ifconfig en0 ether 70:51:81:c1:3f:6e

It seems that System Preferences > Network > Advanced > Hardware will reveal your original MAC address in case you forget it.

You can also place these commands as aliases in your ~/.profile:

alias random_mac="ifconfig en0 ether \`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'\`"
alias reset_mac="ifconfig en0 ether 70:56:81:c0:3f:6d"
alias sudo='sudo '

This all assumes en0 is your wifi location. It might be en1 on other macs.

Baran & Lehtinen’s “Notes on inflating curves” 2009

June 29th, 2016

Notes on inflating curves

Ilya Baran has permitted me to host online his and Jaakko Lehtinen’s technical report from 2009, Notes on Inflating Curves.

The clever “trick” in this approach is rather than to set the height as the solution to a Poisson equation, to set the square of the height to the solution to a Poisson equation. This ensures that the surface normals are in plane at the boundary so the inflated surface may be glued to itself and turned into a closed “pillow” surface. This idea was leveraged and expanded upon in Ink-and-Ray: Bas-Relief Meshes for Adding Global Illumination Effects to Hand-Drawn Characters.

You could cite this note as:

  author = {Baran, Ilya and Lehtinen, Jaakko},
  title = {Notes on inflating curves},
  institution = {MIT},
  year = {2009},

Javascript bookmarklet to delete first publication from CCV web form

June 17th, 2016

The Canadian Common CV webform failed to upload my publications correctly. But it doesn’t allow batch deletion of items so to delete each one at a time I’d have to click the little trash can and click “Yes” and then the page reloads. To avoid this I wrote a little javascript bookmarklet:

eval($("img[alt^=Delete]")[0].getAttribute('onclick').replace('preventBubbling(event);askDeleteBefore','processSubmit').replace('return false;',''))

Adding libigl as a submodule

June 9th, 2016

If you’re adding libigl as a submodule to your project, you should add it recursively so that all of its submodules are also pulled in:

git submodule add https://github.com/libigl/libigl.git
git submodule update --init --recursive