Skip to content

Instantly share code, notes, and snippets.

@eyliu
eyliu / moharam1995.py
Created May 26, 2009 04:24
Fun with Electromagnetic Python: http://empy.sourceforge.net
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright: 2009 Elson Liu
# License: BSD
"""
Reproduces Fig. 2 in Moharam, Grann, Pommet, and Gaylord, "Formulation for
stable and efficient implementation of the rigorous coupled-wave analysis
of binary gratings", J. Opt. Soc. Am. A 12(5), pp. 1068–1076, 1995
(doi:10.1364/JOSAA.12.001068)
"""
@eyliu
eyliu / svn-multi.tex
Created June 2, 2009 21:22
LaTeX settings for Subversion keyword substitution
% LaTeX settings for Subversion keyword substitution
\usepackage{svn-multi}
\svnidlong
{$HeadURL: $}
{$LastChangedDate: $}
{$LastChangedRevision: $}
{$LastChangedBy: $}
\svnid{$Id: $}
% don't forget to set the Subversion properties:
@eyliu
eyliu / apportionment.py
Created November 15, 2009 23:30
Python script to automatically apportion representative seats for the Michigan Student Assembly
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright: 2009 Elson Liu
# License: BSD
# Requires: urllib2
# Requires: xlrd
"""
Download enrollment data for the University of Michigan, Ann Arbor campus
and apportion seats on the Michigan Student Assembly
"""
@eyliu
eyliu / homework.cls
Created December 3, 2009 08:29
LaTeX document class for typesetting homework
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesClass{homework}[2009/05/15 v0.0.1 Document class for typesetting homework]
\LoadClass[12pt,letterpaper,answers]{exam}
\RequirePackage{xspace}
\newcommand{\course}[1]{\def\@course{#1\xspace}}
\newcommand{\problemlist}[1]{\begin{center}\large #1 \end{center}}
\makeatletter
@eyliu
eyliu / nlopt.rb
Created July 27, 2011 14:34
Homebrew formula for NLopt
require 'formula'
class Nlopt < Formula
url 'http://ab-initio.mit.edu/nlopt/nlopt-2.2.4.tar.gz'
homepage 'http://ab-initio.mit.edu/wiki/index.php/NLopt'
md5 '9c60c6380a10c6d2a06895f0e8756d4f'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}",
@eyliu
eyliu / libctl.rb
Created July 27, 2011 14:57
Homebrew formula for libctl
require 'formula'
class Libctl < Formula
url 'http://ab-initio.mit.edu/libctl/libctl-3.1.tar.gz'
homepage 'http://ab-initio.mit.edu/wiki/index.php/Libctl'
md5 '173fdc658b652a4ddfb983efc849e760'
depends_on 'guile'
def install
@eyliu
eyliu / h5utils.rb
Created July 27, 2011 15:24
Homebrew formula for h5utils
require 'formula'
class H5utils < Formula
url 'http://ab-initio.mit.edu/h5utils/h5utils-1.12.1.tar.gz'
homepage 'http://ab-initio.mit.edu/wiki/index.php/H5utils'
md5 '46a6869fee6e6bf87fbba9ab8a99930e'
depends_on 'hdf5'
def install
@eyliu
eyliu / meep.rb
Created July 27, 2011 15:49
Homebrew formula for MEEP
require 'formula'
class Meep < Formula
url 'http://ab-initio.mit.edu/meep/meep-1.1.1.tar.gz'
homepage 'http://ab-initio.mit.edu/wiki/index.php/Meep'
md5 '415e0cd312b6caa22b5dd612490e1ccf'
depends_on 'harminv'
depends_on 'libctl'
depends_on 'hdf5'
@eyliu
eyliu / machine_cfg.py
Created August 15, 2011 18:43
Configuration for CAMFR on Mac OS X Lion (dependencies from Homebrew and SciPy Superpack)
# This Python script contains all the machine dependent settings
# needed during the build process.
# Compilers to be used.
cc = "/usr/bin/gcc-4.2"
cxx = "/usr/bin/g++-4.2"
f77 = "/usr/local/bin/gfortran"
link = cxx
@eyliu
eyliu / machine_cfg.py
Created August 29, 2011 16:18
Configuration for RODIS for Mac OS X with dependencies provided by Homebrew
# Configuration file for RODIS:
# http://photonics.intec.ugent.be/research/facilities/design/rodis/default.htm
#
# Based on the configuration file for Ubuntu Linux:
# http://photonics.intec.ugent.be/research/facilities/design/rodis/setup-ubuntu-hardy-
# howto.txt
#
# Boost.Python provided by Homebrew: http://mxcl.github.com/homebrew/
cc = "gcc"
cxx = "g++"