Skip to content

Instantly share code, notes, and snippets.

View bfulton's full-sized avatar

Bright Fulton bfulton

  • San Francisco Bay Area, CA
View GitHub Profile
@bfulton
bfulton / test.sh
Created November 2, 2014 20:00 — forked from tlunter/test.sh
#!/bin/bash
set -e -o pipefail
set +e
{ echo "test"; echo "test2"; } | cat > /dev/null
echo $?
set -e
set +e
{ echo "test"; echo "test2"; } > /dev/null

Keybase proof

I hereby claim:

  • I am bfulton on github.
  • I am bfulton (https://keybase.io/bfulton) on keybase.
  • I have a public key whose fingerprint is FDD8 DB62 2284 444F 2034 2502 5176 9258 42D3 583C

To claim this, I am signing this object:

require 'aws-sdk'
require 'sumo'
require 'time'
# get all instances that have sent logs in last hour
sumo_insts = Sumo.search(
query: 'instance_id | parse "\"instance_id\":\"*\"" as instance_id | count by instance_id',
from: (Time.now - (60 * 60)).iso8601,
to: Time.now.iso8601,
time_zone: 'UTC'
# search for 5 most displayed icons
query='
gif or jpeg or png |
parse regex "icon[^\w]+(?<image_url>http[^\\]+)\\" |
count by image_url | order by _count | limit 5
'
sumo -q "$query" \
--from '2014-09-25T18:00:00' --to '2014-09-25T18:59:59' \
--time-zone 'UTC' \
--records | \
require 'docker'
container = Docker::Container.create(
'Image' => 'ubuntu:latest',
'Cmd' => [
'/bin/bash',
'-c',
'for i in {1..10}; do echo $i; sleep 1; done'
]
)