Skip to content

Instantly share code, notes, and snippets.

View kepstein's full-sized avatar

Kevin Epstein kepstein

View GitHub Profile
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": "*",
"Resource": "*",
"Condition": {
"ForAllValues:StringEquals": {
"aws:RequestedRegion": [
@kepstein
kepstein / BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
Created June 10, 2018 05:34 — forked from ccstone/BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
BBEdit-TextWrangler Regular Expression Cheat-Sheet
————————————————————————————————————————————————————————————————————————————————————————————————————
BBEDIT/TEXTWRANGLER REGULAR EXPRESSION GUIDE MODIFIED 2016/02/29 17:26
————————————————————————————————————————————————————————————————————————————————————————————————————
NOTES:
The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use.
Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete.
@kepstein
kepstein / polly.py
Created January 20, 2017 19:01
AWS Polly generates TTS and downloads the result to MP3 using Boto3
#!/usr/bin/python
import boto3
from contextlib import closing
client = boto3.client('polly')
response = client.synthesize_speech(
OutputFormat='mp3',
Text='Amazon Polly is a service that turns text into lifelike speech. Polly lets you create applications that talk, enabling you to build entirely new categories of speech-enabled products. Polly is an Amazon AI service that uses advanced deep learning technologies to synthesize speech that sounds like a human voice. Polly includes 47 lifelike voices spread across 24 languages, so you can select the ideal voice and build speech-enabled applications that work in many different countries.',
@kepstein
kepstein / us-phone-regex.sh
Created October 12, 2019 03:40
regex for US phone number
\+?1?\s?\-?\(?\d{3}\)?\s?\-?\d{3}\s?\-?\d{4}
@kepstein
kepstein / PowerShell Commands.ps1
Last active March 10, 2021 09:15
Sample Windows Packer
<#
NOTE: DO NOT RUN THIS SCRIPT
This is simply a record of commands
demonstrated in the AWS PowerShell Webinar
#>
#Credentials
Get-EC2Instance -AccessKey $AccessKey -SecretKey $SecretKey -Region us-west-1
@kepstein
kepstein / lambda_account_id.py
Created April 13, 2021 17:29
Get AWS Account ID with Lambda
# https://www.radishlogic.com/aws/lambda/how-to-get-the-aws-account-id-in-lambda-python/
def lambda_handler(event, context):
aws_account_id = context.invoked_function_arn.split(":")[4]
print(aws_account_id)
@kepstein
kepstein / prowler.yaml
Last active April 25, 2021 21:14
CloudFormation to deploy Prowler as a CodeBuild project
---
AWSTemplateFormatVersion: 2010-09-09
Description: Creates a CodeBuild project to audit an AWS account with Prowler and stores the html report in a S3 bucket. This will run onece at the beginning and on a schedule afterwards. Partial contribution from https://github.com/stevecjones
Parameters:
ServiceName:
Description: 'Specifies the service name used within component naming'
Type: String
Default: 'prowler'
LogsRetentionInDays:
@kepstein
kepstein / Create-RandomFiles.ps1
Created June 15, 2021 02:03
PowerShell utility to create random files
#Function Create-RandomFiles{
<#
.SYNOPSIS
Generates a number of dumb files for a specific size.
.DESCRIPTION
Generates a defined number of files until reaching a maximum size.
.PARAMETER TotalSize
Specify the total size you would all the files combined should use on the harddrive.
@kepstein
kepstein / jq-cheetsheet.md
Created January 21, 2022 18:15 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq