This file contains hidden or 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
expawskeys(){ | |
if [ -z "$1" ];then | |
echo "Profile prefix is required! ex: HA, jumpstart etc..." | |
fi | |
FILE="$HOME/.aws/credentials" | |
KEYS=$(cat ${FILE} | grep "\[$1\]" -A2 | tail -2 | cut -f2 -d= | xargs) | |
export AWS_ACCESS_KEY_ID=$(echo ${KEYS} | cut -f1 -d' ') | |
export AWS_SECRET_ACCESS_KEY=$(echo ${KEYS} | cut -f2 -d' ') | |
} |
This file contains hidden or 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
asciinema rec -c "tmux attach -t 3" |
This file contains hidden or 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
wireshark -k -i <( ssh dest-host sudo /usr/sbin/tcpdump -i eth0 -w - ) |
This file contains hidden or 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 | |
sudo yum install unzip wget perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA -y | |
wget -O ~ec2-user/CloudWatchMonitoringScripts-1.2.1.zip http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip | |
cd ~ec2-user && unzip CloudWatchMonitoringScripts-1.2.1.zip | |
chown ec2-user:ec2-user ~ec2-user/aws-scripts-mon | |
rm CloudWatchMonitoringScripts-1.2.1.zip | |
crontab -l > ~ec2-user/mycron | |
echo "*/5 * * * * ~ec2-user/aws-scripts-mon/mon-put-instance-data.pl --disk-space-util --disk-path=/ --from-cron" >> ~ec2-user/mycron | |
echo "*/5 * * * * ~ec2-user/aws-scripts-mon/mon-put-instance-data.pl --mem-used --mem-avail --swap-used" >> ~ec2-user/mycron | |
crontab ~ec2-user/mycron |
This file contains hidden or 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 | |
trap exit INT | |
INSTANCES=$( aws --profile=HA ec2 describe-instances --query 'Reservations[].Instances[].InstanceId[]' | sed -e 's/\[//g' -e 's/\]//g') | |
SUM=0 | |
echo $INSTANCES | |
for i in $( echo $INSTANCES | sed -e 's/"//g' -e 's/,//g' -e 's/\[//g' -e 's/\]//g' ) ;do | |
echo "---------------------------$i-------------------------------\n" | |
aws --profile=HA ec2 describe-instances --instance-ids $i --query 'Reservations[].Instances[].Tags[?Key==`Name`].Value' --output text | |
aws --profile=HA ec2 describe-instance-attribute --instance-id $( echo $i | sed -e 's/"//g' -e 's/,//' -e 's/\[//g' -e 's/\]//g' ) --attribute userData \ | |
| jq '.UserData.Value' | sed 's/"//g' | base64 --decode |
This file contains hidden or 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 | |
# Set the ROOM_ID & AUTH_TOKEN variables below. | |
# Further instructions at https://www.hipchat.com/docs/apiv2/auth | |
ROOM_ID=XXX | |
AUTH_TOKEN=XXX | |
MESSAGE="Hello world!" | |
curl -H "Content-Type: application/json" \ |
This file contains hidden or 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
# ~/.tmuxinator/test.yml | |
name: blackbook | |
root: /Users/shaytac/hearst/Track2/ | |
# Optional tmux socket | |
# socket_name: foo | |
# Runs before everything. Use it to start daemons etc. | |
# pre: sudo /etc/rc.d/mysqld start |
This file contains hidden or 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 s3 ls | grep "s3file" | awk '{print $3}' | xargs -I {} aws s3 rb s3://{} |
This file contains hidden or 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
description "Vault server" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
chdir /home/vault | |
env VAULT_ADDR=http://127.0.0.1:8200 | |
script |
This file contains hidden or 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
{ | |
// you may set specific environment variables here | |
// e.g "env": { "PATH": "$HOME/go/bin:$PATH" } | |
// in values, $PATH and ${PATH} are replaced with | |
// the corresponding environment(PATH) variable, if it exists. | |
"env": {"GOPATH": "$HOME/go", "PATH": "$GOPATH/bin:$PATH" }, | |
"fmt_cmd": ["goimports"], |