Skip to content

Instantly share code, notes, and snippets.

@vre
vre / read_kinesis_stream.sh
Created June 9, 2017 09:23
Small tool to read any kinesis stream you have
#!/bin/bash
# Reads and outputs Kinesis stream given as argument
# For oneliner see https://gist.github.com/vre/7ee11edb765bf9bbdf1ad4ab1790c7c1
# Based on https://gist.github.com/LarsFronius/e579051d7f140fd803b0
if [ -z "$1" ]; then
echo "This script outputs AWS Kinesis stream as ASCII"
echo "Usage: $0 <stream name>"
echo
@vre
vre / Read kinesis stream oneliner
Last active June 9, 2017 11:22 — forked from LarsFronius/gist:e579051d7f140fd803b0
If you ever want to debug a Kinesis stream, copy this bash one liner.
# On a mac, `brew install awscli` before running and define your AWS account keys.
# Set the 'streamname' to match the name of your Kinesis stream
# For shell scripted version see https://gist.github.com/vre/997b336499824a0e56999d030dce321a
# Based on https://gist.github.com/LarsFronius/e579051d7f140fd803b0
# Works-For-Me aws-cli/1.11.36
streamname=my-kinesis-stream-name; aws kinesis describe-stream --stream-name $streamname --output text | grep SHARDS | awk '{print $2}' | while read shard; do aws kinesis get-shard-iterator --stream-name $streamname --shard-id $shard --shard-iterator-type LATEST --output text | while read iterator; do while output=`aws kinesis get-records --shard-iterator $iterator --output text`; do iterator=`echo "$output" | head -n1 | awk '{print $2}'`; echo "$output" | awk 'NR > 1' | grep RECORDS | while read record; do echo $record | awk '{print $3}' | base64 -D; done; done; done; done
@vre
vre / fix_vagrant_connection_fukup_by_cisco_anyconnect.sh
Last active August 29, 2015 14:18
Cisco Anyconnect and Virtualbox don't go well together. The firewall blocks all traffic except what goes through the VPN. To allow traffic to virtualbox you need to run the following snippet on your OSX every time the VPN (re)connects. Yosemite not supported yet by this script.
#!/bin/bash
if [ `uname` != "Darwin" ]; then
echo "Run this on OS X "
exit 1
fi
# pre ask password
sudo -v
# Set firewall rules so connection to virtualbox functions for Maverics