Skip to content

Instantly share code, notes, and snippets.

const AWS = require("aws-sdk");
const proxy = require("proxy-agent");
const {
getActivityTask,
sendTaskFailure,
sendTaskHeartbeat,
sendTaskSuccess,
} = require("./awsHelper");
const { worker } = require("./worker");
@kurtismash
kurtismash / sqsBiggerBatching.js
Last active September 2, 2022 20:20
Concept - Retrieve and process batches >10 messages from SQS
let msgIdx = 0;
const randomInt = (min, max) => {
return Math.floor(Math.random() * (max - min + 1) + min);
};
const getMessages = (batchSize) => {
const messages = [];
for (let i = 0; i < batchSize; i += 1) {
messages.push({ idx: msgIdx, timeout: randomInt(0, 20) });
msgIdx += 1;
}
@kurtismash
kurtismash / Sox Commands
Created May 9, 2022 15:23
Collection of useful sox commands
# Generate MD5 of audio data chunk within WAV file (OSX)
sox <input_file> -t raw - | md5
# Merge audio files by channel, i.e. 2 mono to stereo
sox -M <input_file.L> <input_file.R> <output_file>
# Raw audio data into WAV file
sox -t raw -r 44.1k -b 16 -c 1 -B -e signed-integer <input_file> <output_file>.wav
@kurtismash
kurtismash / vega_multiline.json
Created March 14, 2021 01:38
Vertically center multiline text marks using Vega
// As a fix for https://github.com/vega/vega/issues/2057 is still not released
// I needed a workaround for vertically centering multiline text. This method
// explicitly sets the lineHeight of the text mark which can then be used to
// calculate the offset needed to shift the anchor point of the text on the y
// axis. The vertical centering is applied by the marks[0].transform[0] formula.
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"data": [
{