Skip to content

Instantly share code, notes, and snippets.

View willvincent's full-sized avatar

Will Vincent willvincent

View GitHub Profile
@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())) {