Skip to content

Instantly share code, notes, and snippets.

View giladsh1's full-sized avatar

Gilad Sharaby giladsh1

  • Israel
View GitHub Profile
@n0531m
n0531m / list_gcp_iprange.sh
Last active November 16, 2024 12:38
Google Cloud Platform : ip address range
#!/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 :`
@seancdavis
seancdavis / notify_slack.rb
Created December 7, 2015 12:55
Post incoming webhook to Slack using Ruby
# 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,
#!/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"