Hunter Ford Hunter Ford

Compiling MP4Box on Mac OS X

# Create a temporary directory for sources.
SOURCES=$(mktemp -d /tmp/XXXXXXXXXX)
cd $SOURCES

# Download the necessary sources.
curl -#LO http://www.ijg.org/files/jpegsrc.v8c.tar.gz
curl -#LO http://downloads.sourceforge.net/project/libpng/libpng15/1.5.1/libpng-1.5.1.tar.gz
curl -#LO http://downloads.sourceforge.net/project/faac/faad2-src/faad2-2.7/faad2-2.7.tar.gz
curl -#LO ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz
curl -#LO http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
curl -#LO http://www.libsdl.org/tmp/SDL-1.3.tar.gz
svn export --non-interactive --trust-server-cert https://gpac.svn.sourceforge.net/svnroot/gpac/trunk/gpac

# Unpack files
for file in `ls ${SOURCES}/*.tar.*`; do
    tar -xzf $file
    rm $file
done

cd jpeg-*/
./configure && make -j 4 && sudo make install; cd ..

cd libpng-*/
./configure && make -j 4 && sudo make install; cd ..

cd faad2-*/
./configure --without-xmms --without-drm --without-mpeg4ip && make && sudo make install; cd ..

cd libmad-*/
sed -i -e 's/-march=i486//g' configure.ac
./configure && make -j 4 && sudo make install; cd ..

cd a52dec-*/
./configure --enable-shared && make -j 4 && sudo make install; cd ..

# SDL won't compile on Lion
# http://forums.libsdl.org/viewtopic.php?t=7390&sid=62659329519f407daa486ec8a3ee2ba9
cd SDL-*/
./configure --without-x && make -j 4 && sudo make install; cd ..

cd gpac/
./configure && make lib && make apps && sudo make install lib && sudo make install

Compiling mp4v2 on Mac OS X

# Create a temporary directory for sources.
SOURCES=$(mktemp -d /tmp/XXXXXXXXXX)
cd $SOURCES

# Download the necessary sources.
curl -#LO http://mp4v2.googlecode.com/files/mp4v2-1.9.1.tar.bz2

# Unpack files
for file in `ls ${SOURCES}/*.tar.*`; do
    tar -xzf $file
    rm $file
done

cd mp4v2-*/
./configure && make -j 4 && sudo make install

Compiling FFMpeg on Mac OS X

You must have Xcode installed with Unix Tools. Xcode 3 is available for free via Apple Developer Center. However, Xcode 4 is available through the App Store (free for Lion users).

# Create a temporary directory for sources.
SOURCES=$(mktemp -d /tmp/XXXXXXXXXX)
cd $SOURCES

# Download the necessary sources.
curl -#LO http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
curl -#LO http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.tar.gz
curl -#LO http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
curl -#LO http://pkg-config.freedesktop.org/releases/pkg-config-0.25.tar.gz
curl -#LO http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.gz
curl -#LO http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
# curl -#LO http://downloads.sourceforge.net/project/opencore-amr/vo-amrwbenc/vo-amrwbenc-0.1.1.tar.gz
curl -#LO http://www.tortall.net/projects/yasm/releases/yasm-1.1.0.tar.gz
curl -#LO http://webm.googlecode.com/files/libvpx-v0.9.7-p1.tar.bz2
curl -#LO ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
curl -#LO http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
# curl -#LG -d "p=ffmpeg.git;a=snapshot;h=HEAD;sf=tgz" -o ffmpeg.tar.gz http://git.videolan.org/
curl -#LO http://ffmpeg.org/releases/ffmpeg-0.8.5.tar.bz2

# Unpack files
for file in `ls ${SOURCES}/*.tar.*`; do
    tar -xzf $file
    rm $file
done

cd faac-*/
CFLAGS="-D__unix__" ./configure && make -j 4 && sudo make install; cd ..

cd lame-*/
./configure && make -j 4 && sudo make install; cd ..

cd libogg-*/
./configure && make -j 4 && sudo make install; cd ..

cd pkg-config-*/
./configure && make -j 4 && sudo make install; cd ..

cd libvorbis-*/
./configure --disable-oggtest --build=x86_64 && make -j 4 && sudo make install; cd ..

cd libtheora-*/
./configure --disable-oggtest --disable-vorbistest --disable-examples --disable-asm
make -j 4 && sudo make install; cd ..

# cd vo-amrwbenc-*/
# ./configure && make -j 4 && sudo make install; cd ..

cd yasm-*/
./configure && make -j 4 && sudo make install; cd ..

cd libvpx-*/
./configure --enable-vp8 --enable-pic && make -j 4 && sudo make install; cd ..

cd x264-*
CFLAGS="-I. -fno-common -read_only_relocs suppress" ./configure --enable-pic --enable-shared && make -j 4 && sudo make install; cd ..

cd xvidcore/build/generic
./configure --disable-assembly && make -j 4 && sudo make install; cd ../../..

# For Lion, we have to change which compiler to use (--cc=clang).
# If you're building on Snow Leopard, you can omit this flag so it defaults to gcc.
cd ffmpeg-*/
CFLAGS="-DHAVE_LRINTF" ./configure --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libfaac --enable-libxvid --enable-libx264 --enable-libvpx --enable-hardcoded-tables --enable-shared --enable-pthreads --disable-indevs --cc=clang && make -j 4 && sudo make install

# --enable-libvo-amrwbenc

# FFMpeg creates MP4s that have the metadata at the end of the file.
# This tool moves it to the beginning.
cd tools
gcc -D_LARGEFILE_SOURCE qt-faststart.c -o qt-faststart
sudo mv qt-faststart /usr/local/bin

Half-Off Depot ‘Notify When Back In Stock’

Half-Off Depot is great! You can find a lot of restaurants or services and get gift cards or certificates for half off the actual price. No gimmicks. One problem is that everything sells out so fast! And I never know when things come back in stock. There's a "feature" where you can be notified when things come back in stock, but it just doesn't work. So... to solve the problem I came up with a little script that will scrape the site for the different gift cards I'm looking out for at specified intervals and send me an email. It's not perfect, but it does the trick for now.

#!/bin/bash

NUM_AVAILABLE=`curl -s http://halfoffdepot.com/atlanta/categories/restaurants/all-restaurants/5-seasons-brewing-company.html | grep '</h1></span>' | sed -e 's/^.*;">//' -e 's/<\/.*$//'`

if [ $NUM_AVAILABLE -ne 0 ]
then
    echo "http://halfoffdepot.com/atlanta/categories/restaurants/all-restaurants/5-seasons-brewing-company.html" | mail -s "There are $NUM_AVAILABLE gift cards available for 5 Seasons." "Your Name <user@domain.com>"
else
    echo "No gift cards available for 5 Seasons." && echo
fi

You can just replace the link with the one you're trying to target, and replace your email address. I have this running as a cron job daily at 8am,12pm, and 6pm. It's not perfect because the script doesn't check for a duplicate email, but things tend to sell-out fast, so I only usually get 2-3 emails

0 8,12,18 * * * /scripts/halfoff > /dev/null 2>&1