This file contains hidden or 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
| #!/usr/bin/env python | |
| # Multi threading way to query AWS regional APIs. | |
| # A lot faster than synchronously polling each region one-after-another. | |
| import boto3 | |
| import threading | |
| from time import sleep | |
| logs = [] |
This file contains hidden or 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
| def calculate_subs(_list): | |
| totals = [] | |
| index = 0 | |
| first_val = True | |
| for i in _list: | |
| if first_val: | |
| totals.append(i) | |
| first_val = False | |
| else: | |
| if i - prev == 1: |
This file contains hidden or 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
| def myfnc(l, n): | |
| le = len(l) | |
| return l[n % le::] + l[:n % le:] | |
| def main(): | |
| input_list = [1, 2, 3, 4, 5] | |
| shift_rotate = 2 | |
| x = myfnc(input_list, shift_rotate) | |
| print(x) |
This file contains hidden or 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
| def convert(numeral): | |
| romans = { | |
| "I": 1, | |
| "V": 5, | |
| "X": 10, | |
| "L": 50, | |
| "C": 100, | |
| "D": 500, | |
| "M": 1000 | |
| } |
This file contains hidden or 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
| import boto3 | |
| import json | |
| # Add any instance IDs to the list instances | |
| # instances = ["i-xxxxxxx", "i-yyyyyyy", "i-zzzzzzz"] | |
| instances = ["i-xxxxxxx"] | |
| def lambda_handler(event, context): | |
| ec2_client = boto3.client("ec2") |
This file contains hidden or 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
| package main | |
| import "github.com/aws/aws-lambda-go/lambda" | |
| func handleRequest () (string, error) { | |
| return "Hello from Go!", nil | |
| } | |
| func main() { | |
| lambda.Start(handleRequest) | |
| } |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import boto3 | |
| import time | |
| sns = boto3.client("sns") | |
| arn = "TOPIC_ARN" | |
| count = 0 | |
| while True: |
This file contains hidden or 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
| #!/usr/bin/python3 | |
| # https://gist.github.com/daniel-woods | |
| # Use a Webhook to send a message to a Microsoft Teams channel using Connectors/Incoming Webhook | |
| import json | |
| from urllib2 import urlopen, HTTPError, Request | |
| def post_message(url, data): | |
| req = Request(url, data) |
This file contains hidden or 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
| #!/usr/bin/python | |
| import boto3 | |
| import json | |
| # Query Parameters: | |
| # Phone Number we need to look up | |
| phone_num = "+xxxxxxxxxxxxx" | |
| # In which User Pool? |
This file contains hidden or 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 | |
| # Default user uses different names, depending on OS. | |
| # Amazon Linux = "ec2-user" | |
| # Ubuntu = "ubuntu" | |
| remote_user="ec2-user" | |
| pem="/home/.ssh/YOUR_PRIVATE_KEY" | |
| port=22 |
NewerOlder