Skip to content

Instantly share code, notes, and snippets.

############################################
# Instance info
############################################
INSTANCE_ID=$(/usr/bin/curl -s http://169.254.169.254/latest/meta-data/instance-id)
EC2_AVAIL_ZONE=`/usr/bin/curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone`
REGION="`echo \"$EC2_AVAIL_ZONE\" | /bin/sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
ENI_ID="${ENI_ID}" # have terraform or whatever you're using provide this
ENI_IP=$(/usr/bin/aws ec2 describe-network-interfaces --region=${REGION} | \
/usr/bin/jq -cr --arg i "${ENI_ID}" '.NetworkInterfaces[]|select(.NetworkInterfaceId==$i).PrivateIpAddress')
NETCIDR="${ENI_IP%.*}.0/24" # yeah, it's defaults for my network, put in whatever it is for you
flip() {
echo;
echo -en "( º_º) ┬─┬ \r"; sleep .5;
echo -en " ( º_º) ┬─┬ \r"; sleep .5;
echo -en " ( ºДº)┬─┬ \r"; sleep .5;
echo -en " (╯'Д')╯︵⊏ \r"; sleep .5;
echo -en " (╯'□')╯︵ ⊏ \r"; sleep .5;
echo " (╯°□°)╯︵ ┻━┻"; sleep .5;
}
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
# Copyright (C) 1996, 1999-2010 Free Software Foundation, Inc.
# Copying and distribution of this file, with or without modification,
# are permitted provided the copyright notice and this notice are preserved.
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
# Possibly useful emacs-lisp to show the colors:
# (font-lock-add-keywords nil '(("38;5;\\([1-9][0-9]+\\)" (1 `(face (:background ,((lambda (c) (let* ((x (- (string-to-int c) 16)) (arr '("00" "5f" "87" "af" "d7" "ff")) (blue (mod x 6)) (green (mod (/ x 6) 6)) (red (mod (/ x 36) 6))) (if (> x 215) (let* ((z (- x 216)) (s (nth z '("08" "12" "1c" "26" "30" "3a" "44" "4e" "58" "62" "6c" "76" "80" "8a" "94" "9e" "a8" "b2" "bc" "c6" "d0" "da" "e4" "ee" "ff")))) (concat "#" s s s)) (concat "#" (nth red arr) (nth green arr) (nth blue arr))))) (match-stri