Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# Usage: ./run.sh <ips.csv>
set -euo pipefail
IP_CSV="$1"
OUT_LOG="combined-output.log"
# 1) Clear the single output file
: > "$OUT_LOG"
#!/usr/bin/env python3
import ipaddress, csv
# ◼ Adjust these file‐names/paths as needed
CIDR_FILE = 'cidrs.tsv'
IP_FILE = 'ips.txt'
OUTPUT_FILE = 'matched.tsv'
# 1) Load and parse your CIDRs
networks = []
#!/usr/bin/env bash
# runscript.sh
# Usage: ./runscript.sh <ip-address>
set -euo pipefail
IP_ADDRESS=${1:-}
if [[ -z $IP_ADDRESS ]]; then
echo "Usage: $0 <ip-address>"
exit 1
#!/usr/bin/env bash
# runscript.sh
# Usage: ./runscript.sh <ip-address>
set -euo pipefail
IP_ADDRESS=${1:-}
if [[ -z $IP_ADDRESS ]]; then
echo "Usage: $0 <ip-address>"
exit 1
#!/usr/bin/env bash
set -euo pipefail
# 1) initialize/clear per‑profile logs
awk -F, '
NR>1 { logs[$1]=1 }
END { for(p in logs) system("> " p "-output.log") }
' ips.csv
# 2) for each line (skip header) in ips.csv
#!/usr/bin/env zsh
# aws-multi-role.zsh
# Usage: ./aws-multi-role.zsh <env>
# Example: ./aws-multi-role.zsh preprod
set -euo pipefail
# --- 1. prerequisites --------------------------------------------------------
# verify jq is installed (for JSON parsing)
if ! command -v jq >/dev/null; then
###########################
# VARIABLES
###########################
variable "source_account_id" {
description = "Account ID of the VPC owner (lz351prod)"
type = string
default = "913016797819"
}
We couldn’t find that file to show.
We couldn’t find that file to show.
1. Basic Syntax
• Comments:
Use # for single-line comments and triple quotes ("""...""" or '''...''') for multi-line strings or docstrings.
# This is a single-line comment
"""
This is a multi-line comment or docstring.
Useful for module or function documentation.
"""