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
#!/usr/bin/env bash | |
# When sourced, this script will export the AWS_ACCESS_KEY_ID and | |
# AWS_SECRET_ACCESS_KEY env vars from a specific profile in | |
# ~/.aws/credentials. | |
# It will also set AWS_PROFILE and AWS_DEFAULT_PROFILE, ensuring | |
# the current shell is configured to use the correct AWS credentials | |
# regardless of what script or tools you are using to connect to AWS... | |
# boto, aws cli, ansible etc. |
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
# convert txt to polly-audio ogg file | |
# coding: utf-8 | |
import subprocess | |
import codecs | |
import sys | |
f = codecs.open(sys.argv[1], encoding='utf-8') | |
cnt = 0 | |
file_names = '' |
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
aws --output json cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue="" | jq -r '.Events | .[] | "\(.EventTime| strftime("%F %T"))\t\(.Username)\t\(.EventName)\t\(.Resources[0].ResourceType)\t\(.Resources[0].ResourceName)"' |
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
import boto3 | |
from datetime import datetime, timedelta | |
regions = [ | |
"ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", | |
"eu-central-1", "eu-west-1", "eu-west-2", "us-east-1", "us-east-2", | |
"us-west-1", "us-west-2" | |
] | |
for region in regions: |
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
from elasticsearch import Elasticsearch, RequestsHttpConnection | |
from requests_aws4auth import AWS4Auth | |
import elasticsearch.helpers | |
import boto3 | |
import datetime | |
import json | |
host = '' | |
region = '' | |
service = 'es' |
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
-- ** Aggregate (COUNT, AVG, etc.) + Sliding time window ** | |
-- Performs function on the aggregate rows over a 10 second sliding window for a specified column. | |
-- .----------. .----------. .----------. | |
-- | SOURCE | | INSERT | | DESTIN. | | |
-- Source-->| STREAM |-->| & SELECT |-->| STREAM |-->Destination | |
-- | | | (PUMP) | | | | |
-- '----------' '----------' '----------' | |
-- STREAM (in-application): a continuously updated entity that you can SELECT from and INSERT into like a TABLE | |
-- PUMP: an entity used to continuously 'SELECT ... FROM' a source STREAM, and INSERT SQL results into an output STREAM | |
-- Create output stream, which can be used to send to a destination |
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
for alb in $(aws elbv2 describe-load-balancers --query 'LoadBalancers[].LoadBalancerArn[]');do | |
DEFAULT_PORT=$(aws elbv2 describe-listeners --load-balancer-arn $alb --query 'Listeners[].{Port:Port}') | |
if [ "$DEFAULT_PORT" == "443" ];then | |
echo "ALB $alb is listening on port $DEFAULT_PORT" | |
echo "Adding listener on $alb to redirect $NEW_PORT to $DEFAULT_PORT" | |
aws elbv2 create-listener --load-balancer-arn $alb --protocol HTTP --port 80 --default-actions '[ | |
{ | |
"RedirectConfig": { | |
"Protocol": "HTTPS", | |
"Host": "#{host}", |
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
#!/bin/bash | |
cd /usr/hdp/current | |
# Get the current version of Hive | |
selectLine=$( hdp-select status hive-server2 ) | |
parts=( $selectLine ) | |
echo "SelectLine: ${parts[2]}" | |
version="${parts[2]}" | |
echo "Version: ${version}" |
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
#!/bin/bash | |
usage="Usage: ./remove_older_hdfs_files.sh [path] [days]" | |
# use if working with incredibly large directories | |
# export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Xmx5g" | |
if [ ! "$1" ] | |
then | |
echo $usage; | |
exit 1; |
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
#!/bin/bash | |
# requires flite, sox and ffmpeg | |
INPUT_TXT=$1 | |
OUTPUT_WAV=${INPUT_TXT/txt/wav} | |
OUTPUT_MP3=${INPUT_TXT/txt/mp3} | |
OUTPUT_WAV_FAST=${INPUT_TXT/.txt/_fast.wav} | |
OUTPUT_MP3_FAST=${INPUT_TXT/.txt/_fast.mp3} | |
flite -f "${INPUT_TXT}" -o "$OUTPUT_WAV" 2>&1 > /dev/null |
OlderNewer