Skip to content

Instantly share code, notes, and snippets.

View scott-edwards-123's full-sized avatar

Scott Edwards scott-edwards-123

View GitHub Profile
@artero
artero / launch_sublime_from_terminal.markdown
Last active September 12, 2024 02:13 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@mndoci
mndoci / aws-cli-jq
Last active December 12, 2015 06:19
Various AWS cli calls parsed using jq
aws ec2 describe-images | jq '.Images[] | {name, description}'
aws ec2 describe-instances | jq -c '.Reservations[] | .Instances[] | {InstanceId, InstanceType}'
aws ec2 describe-instances | jq -c '.Reservations[] | .Instances[] | {InstanceId, InstanceType, PublicIpAddress}'
@howeyc
howeyc / s3cp.go
Last active January 21, 2021 20:07
Golang - copy files to / from s3
// From https://github.com/kr/s3/tree/master/s3cp
// Added public read for uploaded files
// Command s3cp copies a file to or from Amazon S3.
//
// Usage:
//
// s3cp file url
// s3cp url file
//
// The file does not need to be seekable or stat-able. You can use s3cp to
@emilisto
emilisto / ec2_tags.py
Last active March 15, 2019 17:07
Grain for Salt that exposes all EC2 instance tags in grains['tags'], free for all to use and distribute. Tweet me @svammel if you have questions.
"""
ec2_tags - Exports all EC2 tags in a 'tags' grain
For Salt (http://saltstack.org)
Author: Emil Stenqvist <[email protected]>
Usage:
1. Put ec2_tags.py in roots/_grains/
@aegrumet
aegrumet / gist:6374367
Last active December 21, 2015 22:19
AWS command-line jq commands
# ec2 instance info
aws ec2 describe-instances | sed -e 's/"Key"/"key"/' -e 's/"Value"/"value"/' |jq -c '[.Reservations[].Instances[]|{PrivateIpAddress,PublicIpAddress, AZ: .Placement.AvailabilityZone, Name: (.Tags|from_entries|.Name)}]|sort_by(.Name)[]'
# ec2 instance info with filter
aws --profile us ec2 describe-instances --filters '[{"Name":"tag-key","Values":["Name"]}, {"Name":"tag-value","Values":["*agentserver*"]}]' | sed -e 's/"Key"/"key"/' -e 's/"Value"/"value"/' |jq -c '[.Reservations[].Instances[]|{PrivateIpAddress,PublicIpAddress, AZ: .Placement.AvailabilityZone, Name: (.Tags|from_entries|.Name)}]|sort_by(.Name)[]'
# ebs snapshot info
@mrinaudo
mrinaudo / LICENSE
Last active October 27, 2021 18:37
Basic Template Builder for AWS VPC - Interactively generate basic AWS CloudFormation-based AWS VPC templates.
The MIT License (MIT)
Copyright (c) 2014 Matteo Rinaudo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@bridgetkromhout
bridgetkromhout / AWS ELB pre-warming questions
Created January 23, 2014 16:25
AWS ELB pre-warming questions. These questions (and sample answers) were provided by AWS support on 2013-11-26; I've edited slightly for clarity.
0. What is the name of the ELB which needs to be pre-warmed?
a. e.g. yourwebapp-yourcompany-123456789.us-east-1.elb.amazonaws.com
1. What is the approximate increase percentage in traffic, or expected requests/sec that will go through the load balancer (whichever is easier to answer)?
a. e.g. 3,500 per second
2. Do you know the average amount of data passing through the ELB per request/response pair?
a. e.g. Roughly 250KB.
3. Expected percent of traffic going through the ELB that will be using SSL termination?
@lalyos
lalyos / ambari.md
Last active November 30, 2017 03:44
ambari setup

Ambari uses a local postgres db by default.This page describes how to use ambari-server with remote postgres server.

Install

Ambari is installed on centos 6.4 with the following command:

curl -so /etc/yum.repos.d/ambari.repo http://public-repo-1.hortonworks.com/ambari/centos6/1.x/GA/ambari.repo
yum repolist
yum -y install ambari-server
@james-huston
james-huston / hastats.sh
Last active February 7, 2018 13:21
HAProxy stats to StackDriver using a shell script
# run this every minute from cron as a quick and dirty solution to get some
# haproxy stats on each of your listeners over to stackdriver
instance=$(curl -s "http://169.254.169.254/latest/meta-data/instance-id")
# while [ 1 ]; do
cp /dev/null /tmp/hastats.json
echo 'show stat' | socat - UNIX-CLIENT:/tmp/haproxy.sock \
|while IFS=',' read pxname svname qcur qmax scur smax slim stot bin bout dreq \
dresp ereq econ eresp wretr wredis status weight act bck chkfail chdown lastchg \

Using aws-cli and jq

list all instances for all ASGs

aws autoscaling describe-auto-scaling-instances \
  | jq '.AutoScalingInstances[] | {AutoScalingGroupName, InstanceId}'

list instance IDs for a particular ASG