Skip to content

Instantly share code, notes, and snippets.

View daniel-woods's full-sized avatar

Daniel Woods daniel-woods

  • Amazon
  • Dublin, Ireland
View GitHub Profile
@daniel-woods
daniel-woods / sns_lambda_slack_webhook.py
Created September 9, 2018 10:08
Create an SNS Topic, with a Lambda function subscribed. Using the below handler, you can parse the vent object for your SNS message and pass it to a Slack webhook URL.
#!/usr/bin/python2.7
# https://gist.github.com/daniel-woods
import json
from urllib2 import urlopen, HTTPError, Request
def post_message(url, data):
req = Request(url, data)
f = urlopen(req)
@daniel-woods
daniel-woods / gist:bda445616d59e4f8b98e93735a298b79
Last active September 29, 2018 02:40
sns_SubscribeAddFilterPolicy.py
#!/usr/bin/env python
import boto3
import json
sns = boto3.client("sns")
topic_arn = "YOUR_SNS_TOPIC"
proto = "http"
endpoint = "YOUR_EDNPOINT"
attributes = {"FilterPolicy": json.dumps({"key": ["foo", "bar"]})}
@daniel-woods
daniel-woods / rekog_videoQuery.py
Created July 11, 2018 18:23
Script for doing some common Rekognition Video queries on common APIs (StartFaceSearch, StartCelebrityRecognition, StartContentModeration)
#!/usr/bin/python2.7
# Script for doing some common Rekognition Video queries
import boto3
import json
from time import sleep
bucket = "YOUR_BUCKET"
s3_path = "PATH/TO/FILE.mp4"
region = "AWS_REGION" # ex: eu-west-1
@daniel-woods
daniel-woods / hash_file.go
Created July 11, 2018 18:05
File Checksums in Go
// ./hash_file.go sha256 /path/to/file
package main
import (
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"fmt"
"io"
"log"
@daniel-woods
daniel-woods / sns_generateFakeEndpoints.py
Created July 5, 2018 15:55
Generates a bunch of "create_platform_endpoint" calls with fake Device Tokens.
#!/usr/bin/python
# Script to generate fake endpoints for a platform application.
import boto3
import time
sns = boto3.client("sns")
platform_application = "YOUR_SNS_APPLICATION_PLATFORM_ARN"
number_of_endpoints = 150321
i = 0
@daniel-woods
daniel-woods / sns_countEndpointsInApplication.py
Last active July 5, 2018 15:33
Count the number of mobile endpoints in an SNS Application. Useful for counting the endpoints in an application where the number is greater than 100,000, the AWS console's current limit.
#!/usr/bin/python
# Script to count the number of endpoints in an SNS platform application
# By calling list_ednpoints using pagination, append the response size to a counter.
# Count the number of endpoints that are enabled.
import boto3
import time
start_time = time.time()
import random
import math
def perlinNoise(hex_x, hex_y, seed):
random.seed(seed)
pers_min = 0.45
pers_max = 0.75
DECLARE
CURSOR retUnassigned IS
SELECT FaultSheet.fault_no FROM FAULTSHEET
FULL OUTER JOIN Repairs ON FaultSheet.fault_no=Repairs.fault_no
WHERE FaultSheet.fault_no NOT IN(SELECT fault_no FROM Repairs);
BEGIN
OPEN retUnassigned;
FETCH retUnassigned INTO var1;
--print Var1
DROP TABLE REPAIRS;
DROP TABLE SERVICECENTRE;
DROP TABLE FAULTSHEET;
DROP TABLE APPLIANCE;
DROP TABLE STOCK;
DROP TABLE CUSTOMER;
DROP TABLE MANUFACTURER;
#Open an Image File and display some simple metadata.
import os # os.stat
from tkinter import *
import time # for getting time
from tkinter import filedialog
from tkinter import messagebox
from tkinter import ttk