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
def cmd = 'hostname' | |
def sout = new StringBuffer(), serr = new StringBuffer() | |
def proc = cmd.execute() | |
proc.consumeProcessOutput(sout, serr) | |
proc.waitForOrKill(1000) | |
println sout |
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
sudo pip install saws --ignore-installed six | |
Password: | |
The directory '/Users/adam/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. | |
The directory '/Users/adam/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. | |
Collecting saws | |
Downloading saws-0.4.0.tar.gz | |
Collecting awscli>=1.7.46 (from saws) | |
Downloading awscli-1.10.27-py2.py3-none-any.whl (937kB) | |
100% |████████████████████████████████| 942kB 1.3MB/s |
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
foo () { | |
jqf='.ImageId,'\ | |
'.InstanceId' | |
aws_ec2_list | jq -S "$jqf" | |
} |
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
{ | |
"CreateTime": "2016-02-29T18:18:48.000Z", | |
"ImageId": "ami-f7a2bf96", | |
"InstanceType": "m4.large", | |
"SpotInstanceRequestId": "sir-039b6k6b", | |
"SpotPrice": "0.030000", | |
"State": "cancelled", | |
"Status": { | |
"Code": "instance-terminated-by-user", | |
"Message": "Spot Instance terminated due to user-initiated termination.", |
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
# Dump all docker registry image versions | |
docker_reg_image_versions () { | |
if [ -z $1 ]; then | |
echo "Pass registry hostname as argument." | |
else | |
reg="$1" | |
read -p "$reg username: " user | |
read -s -p "$reg password: " pass | |
echo "" | |
for i in $(curl -k -s -X GET "https://$reg/v2/_catalog" \ |
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
require 'open3' | |
puts "test1.rb" | |
Open3.popen3("ruby test2.rb") do |stdin, stdout, stderr, wait_thr| | |
while line = stdout.gets do | |
puts line | |
end | |
end |
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
bucket_name="my-cloudtrail-bucket" | |
acc_num="myacc" | |
region="us-west-1" | |
aws s3 cp --recursive s3://$bucket_name/AWSLogs/$acc_num/CloudTrail/$region/2016/01/ | |
ls | |
gunzip -c cloudTrail-log-file-name.json.gz | jq . |
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
set -e | |
log_files=( /home/app/log/development.log \ | |
/home/app/log/production.log ) | |
for i in ${log_files[@]}; do | |
if [[ -e $i ]]; then | |
exec tail -F $i | |
else | |
exec sleep 10 |
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
# Personal Access Token required - go here: https://github.com/settings/tokens | |
repo="newrepo" | |
gh_user="adampats" | |
gh_token="mytoken" | |
curl -u "$gh_user:$gh_token" https://api.github.com/user/repos -d '{"name":"'$repo'"}' |
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
# create json file in appropriate location, e.g. | |
./data_bags/docker/config.json | |
# add stuff in data_bag format to config.json | |
nano ./data_bags/docker/config.json | |
# generate a secret key if you don't have one | |
openssl rand -base64 512 | tr -d '\r\n' > chef_secret_key | |
# encrypt it - chef-zero style |