--->>> snip lilybin <<<---
#!/usr/bin/env php
<?php
function do_curl($url, $opts)
{
$curl = curl_init($url);
curl_setopt_array($curl, $opts);
$result = curl_exec($curl);
curl_close($curl);
return $result;
}
$optind = 0;
$opts = getopt('d', $argv, $optind);
$files = array_slice($argv, $optind);
if (count($files) !== 1) {
die("Usage: lilybin [-d] file\n");
}
if (isset($opts['d'])) {
$url = 'https://s3-us-west-2.amazonaws.com/lilybin-scores/' . $files[0];
$file = fopen($files[0], 'w');
do_curl($url, array(CURLOPT_FILE => $file));
fclose($file);
} else {
$url =
'https://7icpm9qr6a.execute-api.us-west-2.amazonaws.com/prod/prepare_preview/stable';
$result = json_decode(do_curl($url, array(
CURLOPT_HTTPHEADER => array('Content-Type: application/json'),
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => json_encode(array('code' =>
file_get_contents($files[0]))),
CURLOPT_RETURNTRANSFER => true,
)));
if (!$result->id) {
echo "ERROR:\n{$result->stderr}";
exit(1);
} else {
echo $argv[0], ' -d ', $result->id, ".pdf\n";
}
}
--->>> end snip lilybin <<<---
--
Sven Axelsson
++++++++++[>++++++++++>+++++++++++>++++++++++>++++++
++++<<<<<-]>++++.+.++++.>+++++.>+.<<-.>>+.>++++.<<.
+++.>-.<<++.>>----.<++.>>>++++++.<<<<.>>++++.<----.