Skip to content

Instantly share code, notes, and snippets.

View willvincent's full-sized avatar

Will Vincent willvincent

View GitHub Profile

Keybase proof

I hereby claim:

  • I am willvincent on github.
@willvincent
willvincent / db_backup.sh
Last active October 19, 2017 12:59
Intended for use with cron. This script will backup all (or one specific) database, the specified user has access to on the given DB server, and remove backups older than the specified duration to keep them for. If no params are passed, defaults will be used. and backups created for _every_ database.
#!/bin/bash
USAGE="$0 [-u <user> -p <password> -h <host> -P <PORT> -d <database> -D <destination/directory/without/trailing/slash>]"
DESTINATION=`pwd`
USER=root
PASS=root
HOST=localhost
PORT=3306
# SPECIFY HOW LONG TO RETAIN BACKUPS
@willvincent
willvincent / gist:55bf1e7baeecec564a89
Created April 9, 2015 20:16
Spits out approximate memory usage of an app (passed as an argument) -- mac os 10.9+ (maybe earlier)
<?php
$app = $argv[1];
print exec('hostinfo | grep memory | perl -ne \'$used = `ps aux | grep ' .
$app . ' | awk \'"\'"\'{x+=\$4} END{print x/100}\'"\'"\'` and /Primary memory available: (\d+)/ and printf("' .
$app . ' is using approximately ") and printf($1*$used) and print ("GB\n");\'');
@willvincent
willvincent / parser.php
Created March 25, 2015 05:27
Parse filenames out of a FCPXML file.
<?php
$xml = simplexml_load_file($argv[1]);
$media = array();
$video = array();
$audio = array();
foreach ($xml->sequence->media->video->track->clipitem as $item) {
if (trim($item->name->__toString())) {
@willvincent
willvincent / transcoder.sh
Last active April 20, 2020 21:41
Batch transcode a directory of video files to another directory, with your desired codecs and whatnot
#!/bin/bash
# These paths should either be relative to the current directory
# or full system paths.
SOURCE_PATH="Camera_Original"
DEST_PATH="Prores"
# wildcard for files to process
FILES="*.MXF"