Skip to content

Instantly share code, notes, and snippets.

@ezeeetm
ezeeetm / aws.ps1
Created November 11, 2014 21:36
ec2 instance scheduler
# Initialize AWS session w/ specific IAM role for this script.
# Redact access/secret keys in commits, or do not include this file.
log INFO "initializing AWS session"
$accessKey = "AK for user with IAM role below"
$secretKey = "SK for user with IAM role below"
Initialize-AWSDefaults -AccessKey $accessKey -SecretKey $secretKey -Region us-east-1
log INFO "initializing AWS complete"
<#
// Gray text are just helpful comments, you don’t need to type them. :)
/******* -----=====!! EASY STUFF TO MESS WITH !!=====------ ******/
// What analog pin should we use to read the value from the potentiometer?
int analogPin = 2; // Yep, you heard right: The coolest of the Analog pins...
// What pin is the LED connected to?
int ledPin = 13; // Contains a built in resistor!
@ezeeetm
ezeeetm / fsGrowthMon.ps1
Last active August 29, 2015 14:13
fsGrowthMon.ps1: monitor filesystem growth at the subfolder level, and log to .csv
# IMPORTANT: start this script in a fresh session to prevent previous exceptions from carrying over in $Error
function folderClass
{
param
(
[Parameter(Mandatory=$true)]
[String]$path,
[Parameter(Mandatory=$true)]
[double]$origSize
@ezeeetm
ezeeetm / slackDailyDigest.ps1
Last active November 5, 2015 19:52
slackDailyDigest.ps1
<#
.SYNOPSIS
Dumps the last 24h of message history from all [NM]Slack channels
to [NM]Google Group in a daily digest email.
Run it nightly as a scheduled task.
.NOTES
AUTHOR: ezee
VERSION: 1.0.1
DATE: 19FEB2015
@ezeeetm
ezeeetm / backupToS3.ps1
Last active January 22, 2019 07:33
backupToS3.ps1
# config
clear
$accessKey = "your AK" # these keys are for an IAM user with read/write access only to the -dr S3 account
$secretKey = "your SK"
$bucketName = "your bucketname"
$dataVol = "D:" # omit \
$dataDirs = $null
function initializeAwsSession
@ezeeetm
ezeeetm / AWS Instance Scheduler
Created July 15, 2015 20:10
AWS Instance Scheduler
#########################################################################################################################
# Script name: instanceScheduler.ps1
# Version: v0.1
# Date: 08Nov2014
# Author: Eric Miller
# Purpose: start/stop ec2 instances on a schedule, with retries and SNS notifications on WARNING/FATAL events
# Usage: ./instanceScheduler.ps1
# Dependencies: aws.ps1, logging.ps1
# Notes:
# In order to give the retries sufficient time to process,
@ezeeetm
ezeeetm / AWS Instance Scheduler sample schedule
Created July 15, 2015 20:11
AWS Instance Scheduler sample schedule
#accepted format: instanceId,Instance Name,Group,startTime,stopTime
#example (uncomment actual entries):
#i-c6e7bc27,LMS WebHead Golden Image,EVEN,1000,0100
i-bc13aa91,OpenVPN,ALL,1100,2259
i-80957b6c,SchoolPointe Jenkins 3.0,ALL,1100,2259
#i-659e3f03,SchoolPointe Script Host I,ALL,0630,0930
i-878ac3a6,SPWEB0A,EVEN,0900,1429
i-24431c0a,SPWEB0D,ODD,0900,0100
i-23eb9e09,SPWEB11,ODD,0900,0100
i-7624515c,SPWEB12,EVEN,0900,1434
@ezeeetm
ezeeetm / srsy.ps1
Created September 15, 2015 19:55
write your own
<#
.SYNOPSIS
Command line utility for scheduled DR backups to an isolated offsite AWS account.
Logs to .\dailySnapShotLogs
.EXAMPLE
.\dailySnapShots.ps1
Starts the long running script
.NOTES
"""
wally.py - version 1.0 tested using Python 2.7.5 [MSC v.1500 32 bit (Intel)] on Windows 7 x64
- Accepts command line arguments
- Opens simple IP:socket on a 4U2SEE LED wallboard
- Sends messages to control the behaviour of the 4U2SEE LED wallboard, defined by command line arguments and stdin
- Closes the socket
######################
TODO
- add some minimal try/except error handling
- add minor debug verbose output
@ezeeetm
ezeeetm / blueGreenDeploy.ps1
Created December 18, 2015 14:01
blueGreenDeploy.ps1
<#
.SYNOPSIS
Command line utility for initiating blue-green deployments, to be called by a build step, or by another script, in a Jenkins job.
.PARAMETER region
Optional/has default value. Specifies the AWS region, e.g. 'us-east-1'. See script Param section for allowed values.
.PARAMETER environment
Required. Specifies a friendly name for the environment, e.g. 'dev'. See script Param section for allowed values.