This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let AWS = require('aws-sdk') | |
let ecs = new AWS.ECS() | |
let sqs = new AWS.SQS() | |
let asg = new AWS.AutoScaling() | |
let cluster = process.env.CLUSTER | |
let QueueUrl = process.env.QUEUE_URL | |
let drainingTimeout = process.env.DRAINING_TIMEOUT | |
async function getContainerInstanceArn(id) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const _ = require("lodash") | |
, SNSParser = require("./sns") | |
, Slack = require("../slack"); | |
class BatchParser extends SNSParser { | |
handleMessage(message) { | |
if (_.get(message, "source") !== "aws.batch") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL); | |
ini_set("display_errors", 1); | |
class Test implements ArrayAccess | |
{ | |
public $data = array(); | |
public function __set($key, $value){ | |
$this->data[$key] = $value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you examine this command, you'll see I'm trying to run stderr through a piped command and leave stdout alone. | |
# The problem is that you have to redirect things around. Yes, you could simply swap stderr/out and it would work, but when they're muxed together, you get crossover. | |
# So, in bash world it makes perfect sense to use a new file descriptor -- #3 -- to bypass the processing in the piped commands, and then redirect 3>&1 to get it back. | |
# THIS WON'T WORK. | |
# Example from a real problem: | |
# This runs strace against a PHP command, removes duplicate gettimeofday system calls (which number in the 100s of thousands for running PHP processes), and colorizes the stderr output from strace as red so it can be differentiated from stdout. | |
$ strace -r "$@" 2>&1 1>&3 | perl -ne'$|=1; $cur = /gettimeofday/; if(!$prev){ print; }else{ if($cur){ print "."; }else{ print "\n"; print; }} $prev = $cur;' | sed $'s#.*#\e[31m&\e[m#' 1>&2 3>&1 | |
ERROR: Bad file descriptor: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Compute the tasks that must occur to convert a key-value table specified by $src | |
* into a new key-value $dest where the VALUES are the important tags and the IDs | |
* are simply placeholders. | |
* | |
* This is helpful with user-provided data where keys are stored in the database | |
* (especially as integers) but user-provided values (labels for records, etc.) | |
* are the actual identifiers for the data. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#~/.bash_profile | |
alias mt='multitail -CS php' | |
#~/.multitailrc | |
# See documentation | |
# keetweej.vanheusden.com/svn/multitail/trunk/multitail.conf | |
# | |
# Get this file right! If you don't multitail will just crash. | |
# No warning, no error, just won't start. And it's your fault. |