Skip to content

Instantly share code, notes, and snippets.

# Kibana is served by a back end server. This controls which port to use.
port: 5601
# The host to bind the server to.
host: "0.0.0.0"
# The Elasticsearch instance to use for all your queries.
elasticsearch_url: "http://10.0.4.4:9200"
# preserve_elasticsearch_host true will send the hostname specified in `elasticsearch`. If you set it to false,
#!/usr/local/bin/bash
# NA SA EU AP
AWS_ENV="${1:-NA}"
echo "USING AWS ENVIRONMENT: ${AWS_ENV} (also avail SA, EU, AP)"
declare -A SERVICES
"requestTemplates" : { "application/json": "{\n \"body\" : $input.json('$'),\n \"headers\": {\n #foreach($header in $input.params().header.keySet())\n \"$header\": \"$util.escapeJavaScript($input.params().header.get($header))\" #if($foreach.hasNext),#end\n \n #end\n },\n \"method\": \"$context.httpMethod\",\n \"params\": {\n #foreach($param in $input.params().path.keySet())\n \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end\n \n #end\n },\n \"query\": {\n #foreach($queryParam in $input.params().querystring.keySet())\n \"$queryParam\": \"$util.escapeJavaScript($input.params().querystring.get($queryParam))\" #if($foreach.hasNext),#end\n \n #end\n } \n}" },
serverless project create
_______ __
| _ .-----.----.--.--.-----.----| .-----.-----.-----.
| |___| -__| _| | | -__| _| | -__|__ --|__ --|
|____ |_____|__| \___/|_____|__| |__|_____|_____|_____|
| | | The Serverless Application Framework
| | serverless.com, v0.4.2
`-------'
Serverless: Initializing Serverless Project...
if("undefined" === typeof document.currentScript){
(function(){
/***************************************************************************/
/* document.currentScript polyfill + improvements */
/***************************************************************************/
var scripts = document.getElementsByTagName('script');
document._currentScript = document.currentScript;
// return script object based off of src
var getScriptFromURL = function(url) {
@cphoover
cphoover / gist:6157082
Last active December 20, 2015 15:49
RFC 2616 | HTTP 1.1 | Pertinent to Caching

HTTP 1.1 | Pertinent to Caching

9.1.1 Safe Methods

Implementors should be aware that the software represents the user in their interactions over the Internet, and should be careful to allow the user to be aware of any actions they might take which may have an unexpected significance to themselves or others.

var hi = require('highland');

function stringify(s) {
    return s.map(function(msg) {
        return JSON.stringify(msg);
    });
}

function wrapMessage(s) {

Hello everyone... I have a question, that maybe someone can help me out with.. I have a highland stream let's call it streamA basically I want to capture the first non error event emitted by that stream and determine whether it is an object message {...} being emitted or a raw string "...". If streamA's first message is a string I want to send it through a particular transform stream, If it streamA's first message is an object I will send it through different set of transforms. I am working under the assumption that the stream will only emit the same data type on each message and thus it would be inefficient to do the data type check on each message. Here is an example of the code I have come up with...

var hi = require('highland');
// grok pattern
\[checkout\] Checkout (?<action>\w+) - (?<checkout_type>[^-]+)(?: - \[(?<total>[0-9\.]+)\]$)?
// grok pattern with grok pattern substitution
\[checkout\] Checkout %{WORD:action} - (?<checkout_type>[^-]+)(?: - \[%{NUMBER:total}\]$)?
// log entries
[b2c_web] [app2] [b2c-3774016-5092740] - 2015-04-14T16:41:30.626Z - info: [checkout] Checkout attempt - new credit card - [158.99]
[b2c_web] [app2] [b2c-3774016-5092740] - 2015-04-14T16:41:33.284Z - info: [checkout] Checkout success - new credit card - [158.99]
[b2c_web] [app0] [b2c-3774016-5092740] - 2015-04-14T16:43:25.468Z - info: [checkout] Checkout attempt - new credit card - [158.94]

Question on node ChildProcess.spawn

My question is regarding the node spawn interface... I was under the impression that you could use the stdio field of the option argument to give yourself a way to redirect data to/from a child process (e.g [Readable -> child.stdin, child.stdout -> Writeable Stream, child.stderr -> Writeable stream])

My question is why can I not provide a writeable stream as the second index in the array I am passing for this field. When I do I get the error: "TypeError: Incorrect value for stdio stream: [object Object]"

why does this work??

var spawn = require("child_process").spawn;
var args = "-F --lines=0 /Users/choover/workspace/sandbox/forwarding-agent/test/test.log"