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
#!/bin/bash | |
CONTENT="$1" | |
# Create a random file name for tmp files | |
RAND=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 32) | |
TMPFILE="/tmp/$RAND" | |
# Render content to tmp file and output content | |
echo -e "$CONTENT" > "$TMPFILE.in" |
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
# Assumes: | |
# - curl is installed | |
# - you have a slack channel with an incoming webhook configured | |
require 'json' | |
def notify_slack(webhook_url, channel, username, text, image) | |
payload = { | |
:channel => channel, | |
:username => username, |
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
#!/bin/bash | |
# https://cloud.google.com/compute/docs/faq#find_ip_range | |
# nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8 | |
myarray=() | |
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :` | |
do | |
myarray+=($LINE) | |
for LINE2 in `dig txt $LINE +short | tr " " "\n" | grep include | cut -f 2 -d :` |