Skip to content

Instantly share code, notes, and snippets.

View nshenry03's full-sized avatar

Nicholas Henry nshenry03

View GitHub Profile
@nshenry03
nshenry03 / .ackrc
Last active February 22, 2019 17:55
Bash configuration files
--ignore-dir=.kitchen
--ignore-dir=.terraform
--type-set=terraform:ext:tf
--type-set=terraformstate:match:/tfstate/
for tr in $(
curl -s https://github.com/terraform-aws-modules \
| fgrep 'itemprop="name codeRepository"' \
| sed -e 's|.*/terraform-aws-modules/||' -e 's|".*||'
)
do
git clone https://github.com/terraform-aws-modules/${tr}.git
done
for tr in $(
@nshenry03
nshenry03 / gist:abd0adfb498abeaf281b750611a61fc9
Created August 26, 2016 00:40
These are the load balancers in prod that only have 1 or 2 instances in them (where at least 1 of the instances is app01, app02, or app03
aws elb describe-load-balancers --profile prod | \
jq '.LoadBalancerDescriptions[] | \
select(\
(\
(.Instances[] | .InstanceId == "i-1b5a85f7") or \
(.Instances[] | .InstanceId == "i-e3663209") or \
(.Instances[] | .InstanceId == "i-1c5a85f0")) \
and (.Instances | length <= 2)\
) | \
.LoadBalancerName'
@nshenry03
nshenry03 / findOutOfServiceInstances.sh
Created May 31, 2016 21:15
Find instances that are out of service for each load balancer in an Amazon account
AWS_CONFIG_PROFILE='prod' # from ${HOME}/.aws-config
for elb in $(
aws elb describe-load-balancers --profile "${AWS_CONFIG_PROFILE}" | \
jq '.LoadBalancerDescriptions | .[] | .LoadBalancerName' | \
sed 's/"//g'
) ; do
echo -e "ELB: ${elb}\n========================================"
aws elb describe-instance-health \
--load-balancer-name ${elb} --profile "${AWS_CONFIG_PROFILE}" | \
@nshenry03
nshenry03 / Manual curl
Created April 29, 2016 17:42
Slow chef rpm download from ec2 seoul korea server
[root@ip-10-0-88-200 ~]# curl -L https://packages.chef.io/stable/el/6/chef-12.7.2-1.el6.x86_64.rpm > blah.rpm
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
14 52.7M 14 7765k 0 0 41375 0 0:22:18 0:03:12 0:19:06 0

Keybase proof

I hereby claim:

  • I am nshenry03 on github.
  • I am nshenry03 (https://keybase.io/nshenry03) on keybase.
  • I have a public key whose fingerprint is 1D4A 7707 0BEA C68E DAA7 3180 8512 BA36 4AFE 58C3

To claim this, I am signing this object:

@nshenry03
nshenry03 / perProcessMemorySummary.sh
Last active August 29, 2015 14:20
Get a summary of per process memory usage using awk (php-fpm for example). Note, if a process shares libraries, they will be counted multiple times so this isn't perfect; however, it should give you a good rough summary of the amount of memory used.
ps aux | fgrep php-fpm | egrep -v 'master process|fgrep' | sort -k13 | awk '{print $1,$6}' | awk '{a[$1]+=$2;}END{for(i in a)print i, a[i] * 0.001;}' | sort -nr -k2 | awk '{ sum+=$2 ; print $1, $2, " MB"} END {print "Total Memory Usage:", sum, " MB"}'
@nshenry03
nshenry03 / pdfMerge.sh
Created December 8, 2014 21:49
Quick script used to merge some PDFs for St. Paul's Lutheran Church of Calhan and Family Heritage Publishers so that they can print the 100 year history book.
#!/bin/bash -
#===============================================================================
#
# FILE: pdfMerge.sh
#
# USAGE: ./pdfMerge.sh
#
# DESCRIPTION: Merges two PDFs based on page numbers
#
# AUTHOR: Nick Henry (NSH), nicholas.henry@appdirect.com
@nshenry03
nshenry03 / Public GPG Key
Created August 20, 2014 16:43
Public GPG Key for Nick Henry
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.10 (GNU/Linux)
mQINBEvteekBEACzlg+IWTNFdmduRGujvBFYVsvpX3hKKjmU3LRfYTloKL0oF+lJ
A5pjz1RuLa28nbQzt7uxBcbuA+X+8LRp3Ppu5DYTw8s3b9m3Kg3Yhg2WLg6MA5Cz
/A9005AQKRL8ceiV91Yzb54wN7hiETeiCOuICCVWTdSH6H2dXF1myCZ9zrJJ1beK
3YrPCu/OsiIkOt7K3KP03IjDpdTUPdONoiR7fjAWdQqRnLbRrVcbMFExPhfxqGs1
E27ndAOanvesfF6zqO48QAmeSKu3B0Tv2M4bsiO7h3U+bdfDwCjg4m7aijN1rIXF
YzEvNyEsLYreEmsamQCiJwW1SxFGB0JvGqQ6K1E7r7SZMaQJAGUiKf2NxoKYwZZM
MvpvG0SYPyQ2JuVpmsfnMaz6sbP3MbMNdN5XzyPOcRU+h83bPufpoW9Y6nc7GmBP
h2ejZiB+vrg/VHHgjeCJ26UThfKRItpjMUqw9Rjxv6Wh0GbWNNp/nfhH0suahsPo