Skip to content

Instantly share code, notes, and snippets.

View atroche's full-sized avatar

Alistair Roche atroche

View GitHub Profile
Image resizing
Task
Constructing task
2019-06-20 16:32:40,851 TRACE [LoggingMeta] Creating log category [data]: {"categoryName":"ImageResizeTask"}
2019-06-20 16:32:40,851 INFO [ImageResizeTask] Downloading watermark [data]: {"watermarkDetails":{"position":"NorthWest","url":"https://lambda-bandwidth.s3.amazonaws.com/test/resources/watermark.jpeg?AWSAccessKeyId=AKIA5U3MLUSMWUQIJB4J&Expires=1561013260&Signature=DYS9tJ%2FErwvtiSlJmzgCAP%2B%2Bvf8%3D"}}
2019-06-20 16:32:40,854 INFO [ImageResizeTask] Starting downloading from S3 [data]: {"location":{"bucket":"lambda-bandwidth","key":"test/resources/thumb.jpg"},"filePath":"/tmp/original_image"}
2019-06-20 16:32:40,855 INFO [ImageResizeTask] Starting downloading from S3 [data]: {"location":{"bucket":"lambda-bandwidth","key":"resources/srgb.icc"},"filePath":"/tmp/srgb.icc"}
2019-06-20 16:32:40,855 INFO [ImageResizeTask] Starting downloading from S3 [data]: {"location":{"bucket":"lambda-bandwidth","key":"resources/cmyk.icc"},"filePath":"/tmp/cmyk.icc"}
2019-06-20
AudioTasks
TranscodeAudioTask
Constructing task
2019-06-20 15:47:56,193 INFO [LoggingMeta] Creating log category [data]: {"categoryName":"TranscodeAudioTask"}
2019-06-20 15:47:56,193 INFO [TranscodeAudioTask] Starting to run task
2019-06-20 15:47:56,193 TRACE [TranscodeAudioTask] Checking if content type is supported [data]: {"contentType":"audio/aac","supported":true}
2019-06-20 15:47:56,193 INFO [TranscodeAudioTask] Generating previews [data]: {"inputLocation":{"bucket":"lambda-bandwidth","key":"input/agent.aac"}}
2019-06-20 15:47:56,194 INFO [TranscodeAudioTask] Generating waveform JSON
2019-06-20 15:47:59,145 INFO [TranscodeAudioTask] Uploading to S3 [data]: {"previewOutputLocation":{"bucket":"lambda-bandwidth","key":"input/agent.aac-aud-waveform"}}
2019-06-20 15:48:00,348 INFO [TranscodeAudioTask] Finished generating waveform JSON [data]: {"previewOutput":{"classifier":"aud-waveform","contentType":"application/json","id":"f5ab3190-931e-11e9-8c4a-a9e012cab2f1","metaData":{"taskProcessedDate":1561009
@atroche
atroche / basic_page_script_covs.json
Created June 1, 2019 03:53
The 'Script Coverage's returned by Chrome after the initial load of our 'Basic Page' fixture
[
{
"scriptId": "11",
"url": "http://127.0.0.1:42595/coverage_fixture1.js",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
@atroche
atroche / todo_mvc_script_coverages.json
Created June 1, 2019 03:43
The 'Script Coverage's returned by Chrome after the initial load of TodoMVC on localhost
[
{
"scriptId": "11",
"url": "http://127.0.0.1:34949/js/helpers.js",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
@atroche
atroche / vic2_saves.peg
Created May 28, 2019 12:20
Victoria II Save Game PEG (Parsing Expression Grammar) definition
// http://phrogz.net/js/pegsh/
config = definition+
definition = var_name '=' value (whitespace+)?
var_name = [a-zA-Z_0-9]+
value = string / number / boolean / object / reference
reference = var_name
// NOTE: files other than m4a are probably streamable but we can only generate waveforms for m4a
if ("audio/m4a".equals(task.getContentType()) || "audio/x-m4a".equals(task.getContentType()) || "audio/mp4".equals(task.getContentType())) {
InputStream objectContent = null;
try {
objectContent = new FileInputStream(new File(workingDir, input));
if (new FastStartChecker().check(objectContent)) {
metadata.put(META_DATA_STREAMABLE, true);
} else {
metadata.put(META_DATA_STREAMABLE, false);
}
protected void copyFileToS3(File file, String contentType, String bucket, String key) {
PutObjectRequest request = new PutObjectRequest(bucket, key, file);
request.setCannedAcl(CannedAccessControlList.Private);
request.setStorageClass(StorageClass.ReducedRedundancy);
request.setMetadata(new ObjectMetadata());
request.getMetadata().setContentType(contentType);
request.getMetadata().setServerSideEncryption(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
request.getMetadata().setCacheControl(String.format("public, max-age=%d", Duration.standardDays(90).getStandardSeconds()));
@atroche
atroche / audio_metadata.js
Created May 15, 2019 05:58
Sample audio metadata
{ streams:
[ { index: 0,
codec_name: 'aac',
codec_long_name: 'AAC (Advanced Audio Coding)',
profile: 'LC',
codec_type: 'audio',
codec_time_base: '1/48000',
codec_tag_string: '[0][0][0][0]',
codec_tag: '0x0000',
sample_fmt: 'fltp',
{"waveform":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,26,167,402,764,883,1350,1318,1260,1088,1404,1359,1490,1325,1338,1742,1366,1549,1343,1443,958,1210,1337,1482,1612,1440,1339,803,1112,851,1255,925,1194,1252,1246,1018,1256,1047,1606,2000,1968,1949,1470,1469,1415,1155,1928,2046,1213,1342,1536,1639,1082,3715,5356,4246,3600,3838,2947,3078,3115,3162,3281,3455,3453,3367,3098,3034,3044,2493,1659,1894,1435,2157,4901,4703,4975,4258,4284,4072,4214,4415,3806,3307,4207,5334,5031,4055,2849,2671,3119,2460,2849,2749,2997,3699,2451,3371,3102,1658,2534,2373,2053,1396,1916,1627,2413,1794,2187,1758,1206,1673,1388,2389,1330,1778,1885,1564,1254,1237,1267,1087,1942,1503,1629,1047,1420,916,975,1259,1185,1339,1858,2691,4320,3077,2140,1277,1602,1064,1124,1245,988,1262,976,1116,1641,1771,1822,2423,3396,7047,6870,6671,6457,5033,6405,4080,3614,2579,2913,2136,2031,1736,1641,1563,1578,1505,1949,2015,2678,2394,2419,2319,2651,2153,2006,2927,2505,1617,2013,1398,1343
[STREAM]
index=0
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=[15][0][0][0]
codec_tag=0x000f
sample_fmt=fltp