vena.net

Reload gulp when gulpfile.js changes

I’m that lazy.

var spawn = require('child-process').span;

gulp.task('auto-reload', function() {
    spawn('gulp', [], {stdio: 'inherit'});
    process.exit();
});

gulp.task('watch', function() {
    gulp.watch('gulpfile.js', ['auto-reload']);
});

gulp.task('default', ['watch']);

"Nothing to migrate."

Ran into an amusing issue with Laravel today. Artisan uses glob for searching the filesystem and doesn’t escape paths. That means if you have a special character anywhere in your folder names, including folders above the project folder, glob will do strange things, fail, and otherwise go kablooey. In my case, a folder above the project had brackets in its name.

Using an ASUS router as a Time Capsule

I acquired an old Drobo Gen2, but it’s a pretty slow device so I’d like to try using it as a networked Time Machine drive. Attaching a disk array to my home server seemed redundant, I’d rather that thing focus on streaming, and I want my macs to be able to sleep, so I figured I’d try out my ASUS RT-N16 router as a Time Capsule. It runs/can run linux-based firmware and most of the necessary tools are available through entware.

It turned out to not be the best idea in the world, but guides I could find on doing this were thin and full of holes, so I decided to write my own for anyone who doesn’t mind that it’s really slow and could shorten the life of your router.

Read More

Accessing MySQL servers from the host on Vagrant+Puppet VMs

On my Vagrant VMs, I wanted to be able to access a guest VM’s MySQL server from the host when the guest has a dynamic IP, but simply giving a MySQL user a wildcard host wouldn’t cut it so long as MySQL was bound to 127.0.0.1 by default in Ubuntu. I needed to bind MySQL to all interfaces (0.0.0.0) but augeas chokes on my.cnf for some reason, so out comes the hatchet:

exec { '/usr/bin/perl -pi -e "s/^.*bind-address.*$/bind-address = 0.0.0.0/" "/etc/mysql/my.cnf"':
  onlyif => '/bin/grep "bind-address.*\=.*127\.0\.0\.1" /etc/mysql/my.cnf',
  require => Package["mysql-server"],
  notify => Service["mysql"],
}

You’ll still need to give your user a remote or wildcard host, of course.

Remove personally identifying information from iTunes Match m4a files

Quick little bash script using AtomicParsley to recursively remove all personally identifying information from m4a files downloaded through iTunes Match:

#!/bin/bash
if [ -z $1 ] || [ -z $2 ]; then 
  echo "Usage: $(basename $0) [source directory] [output directory]"
  exit 0
fi

find "$1" -depth -name "*.m4a" -type f | while read file ; do
    basename=$(basename "$file")
    path=$(dirname "$file")
    newpath="$2/${path/$1/}"
  newfile="$newpath/$basename"

    # Create the new directory if it doesn't exist
    mkdir -p "$newpath"

    echo "Working on: ${file/$1/}"
    AtomicParsley \
        "$file" \
        --DeepScan \
        --manualAtomRemove "moov.trak.mdia.minf.stbl.mp4a.pinf" \
        --manualAtomRemove "moov.udta.meta.ilst.apID" \
        --manualAtomRemove "moov.udta.meta.ilst.atID" \
        --manualAtomRemove "moov.udta.meta.ilst.cnID" \
        --manualAtomRemove "moov.udta.meta.ilst.geID" \
        --manualAtomRemove "moov.udta.meta.ilst.plID" \
        --manualAtomRemove "moov.udta.meta.ilst.sfID" \
        --manualAtomRemove "moov.udta.meta.ilst.cprt" \
        --manualAtomRemove "moov.udta.meta.ilst.flvr" \
        --manualAtomRemove "moov.udta.meta.ilst.purd" \
        --manualAtomRemove "moov.udta.meta.ilst.rtng" \
        --manualAtomRemove "moov.udta.meta.ilst.soal" \
        --manualAtomRemove "moov.udta.meta.ilst.stik" \
        --manualAtomRemove "moov.udta.meta.ilst.xid" \
        --manualAtomRemove "moov.udta.meta.ilst.----.name:[iTunMOVI]" \
        -o "$newfile" > /dev/null
done

So far this does not seem to break the match on any of my files, it just changes them from “Matched AAC audio file” to simply, “AAC audio file.”