Skip to content

Instantly share code, notes, and snippets.

Avatar

Ian Mckay iann0036

View GitHub Profile
@iann0036
iann0036 / gist:b473bbb3097c5f4c656ed3d07b4d2222
Last active Oct 13, 2021
List of expensive / long-term effect AWS IAM actions
View gist:b473bbb3097c5f4c656ed3d07b4d2222
route53domains:RegisterDomain
route53domains:RenewDomain
route53domains:TransferDomain
ec2:ModifyReservedInstances
ec2:PurchaseHostReservation
ec2:PurchaseReservedInstancesOffering
ec2:PurchaseScheduledInstances
rds:PurchaseReservedDBInstancesOffering
dynamodb:PurchaseReservedCapacityOfferings
s3:PutObjectRetention
@iann0036
iann0036 / main.py
Created Nov 15, 2014
Simon Says Bot
View main.py
"""
Python Bot Player
iann0036 2014
http://www.miniclip.com/games/simon-says/en/#t-c-f-C
"""
import ImageGrab
import os
import time
import win32api, win32con
@iann0036
iann0036 / auto.py
Last active Sep 22, 2021
Python Input Record and Play
View auto.py
import pyautogui, time, sys, os, win32api, win32gui, win32con, datetime, pyHook, pythoncom
from optparse import OptionParser
'''
Python Automated Actions Script by Ian Mckay
Version 0.1 - 20151217
'''
pyautogui.PAUSE = 0
pyautogui.FAILSAFE = True
@iann0036
iann0036 / gist:cb9f9463cf791eb27beb132623763f32
Last active Apr 20, 2021
Send Lambda/CFN app to S3 buckets
View gist:cb9f9463cf791eb27beb132623763f32
for region in `aws ec2 describe-regions --output text | cut -f4`
do
aws s3 cp lambda/app.zip s3://ianmckay-$region/APPLICATION/app.zip --acl public-read
aws s3 cp template.yml s3://ianmckay-$region/APPLICATION/template.yml --acl public-read
done
View v4.js
#!/usr/bin/env node
const request = require('request');
const aws4 = require('aws4');
const AWS = require('aws-sdk');
let chain = new AWS.CredentialProviderChain();
chain.resolve((err, awscreds) => {
let awsreq = aws4.sign({
service: 'sts',
View codename-speculation.txt
tag-history
payment-gateway
diode
hailstone
silverwire
archipelago
penny
panama
mamsg
gondolin
View Dockerfile
FROM ubuntu:latest
RUN apt-get update \
&& apt-get install -y python3-pip python3-dev \
&& cd /usr/local/bin \
&& ln -s /usr/bin/python3 python \
&& pip3 install --upgrade pip
RUN pip3 install numpy
RUN pip3 install scipy
@iann0036
iann0036 / logpush.py
Created Mar 6, 2018
CloudWatch Log Lambda Subscription to ElasticSearch
View logpush.py
from __future__ import print_function
import json
import base64
import zlib
from elasticsearch import Elasticsearch
from elasticsearch.connection import create_ssl_context
from datetime import datetime
def handler(event, context):
@iann0036
iann0036 / darkenScreenAroundArea.py
Last active Mar 5, 2018
Darken screen around area
View darkenScreenAroundArea.py
import wx
import time
from multiprocessing import Process, Lock
def darkenScreenAroundArea(lock, x, y, width, height):
app = wx.App(False)
screensize = wx.GetDisplaySize()
frm = DarkFrame(lock, 0, 0, screensize[0], y) # top
frm = DarkFrame(lock, 0, y, x, height) # left
frm = DarkFrame(lock, (x + width), y, (screensize[0] - x + width), height) # right
@iann0036
iann0036 / deeplens_leds.py
Created Dec 21, 2017
Play with the front LED lights on the DeepLens device
View deeplens_leds.py
import os
from time import sleep
gpio_path = "/sys/class/gpio/"
with open(gpio_path + "gpio437/direction", 'w') as direction:
direction.write('out')
with open(gpio_path + "gpio443/direction", 'w') as direction:
direction.write('out')