Skip to content

Instantly share code, notes, and snippets.

View 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
View keybase.md

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:

View swipely-sumo-logic-blog-post-example-02.rb
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'
View swipely-sumo-logic-blog-post-example-01.sh
# 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 | \
View docker-api-attach-stream-test.rb
require 'docker'
container = Docker::Container.create(
'Image' => 'ubuntu:latest',
'Cmd' => [
'/bin/bash',
'-c',
'for i in {1..10}; do echo $i; sleep 1; done'
]
)