Skip to content

Instantly share code, notes, and snippets.

View jetstreamin's full-sized avatar
:octocat:
chillin' like the vanilla shake that I am

Mike Mahon jetstreamin

:octocat:
chillin' like the vanilla shake that I am
View GitHub Profile
@jetstreamin
jetstreamin / GetEstimatedSPExecutionTime.sql
Created October 7, 2018 22:28
Get Estimated SP Execution Time
SELECT TOP 10 d.object_id, d.database_id, OBJECT_NAME(object_id, database_id) 'proc name',
d.cached_time, d.last_execution_time, d.total_elapsed_time,
d.total_elapsed_time/d.execution_count AS [avg_elapsed_time],
d.last_elapsed_time, d.execution_count
FROM sys.dm_exec_procedure_stats AS d
WHERE OBJECT_NAME(object_id, database_id) = 'sp_GlobalIndex_IncrementalUpdate_GetDocuments'
ORDER BY [total_worker_time] DESC;
@jetstreamin
jetstreamin / dev-toolbelt.bat
Created January 20, 2019 12:49
This is my script for installing a dev box. It uses chocolaty and a couple other package managers for Windows 10.
REM Dev Box Setup
REM This script sets up my dev boxes for virtual machines that I use.
REM It will go through and 1st install Chocolatey, then it will installs extensions for vs code and perform various
REM other setup functions.
REM M. Mahon
REM @jetstreamin
REM Chocolaty Command Reference: https://chocolatey.org/docs/commands-reference
@jetstreamin
jetstreamin / aws.amplify.spinupjsapp.sh
Last active January 21, 2019 20:43
AWS Amplify - Spin-Up JS App
PROJNAME=$1
mkdir $PROJNAME
echo Making $PROJNAME
mkdir -p $PROJNAME/src && cd $PROJNAME
npm init
touch index.html
touch src/app.js
npm install
npm start
@jetstreamin
jetstreamin / drop-fks.sql
Created January 24, 2019 20:56
SQL - Drop Foreign Keys From Table
IF EXISTS (SELECT *
FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'dbo.FK_TableName_TableName2')
AND parent_object_id = OBJECT_ID(N'dbo.TableName')
)
ALTER TABLE [dbo.TableName] DROP CONSTRAINT [FK_TableName_TableName2]
@jetstreamin
jetstreamin / gist:dbce8eefc26657ad4a6d8d6b0c70f6ca
Last active February 16, 2019 22:20
AWS - S3 - CORS Configuration Sample
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
@jetstreamin
jetstreamin / cognito.yaml
Created February 11, 2019 22:42 — forked from singledigit/cognito.yaml
Create a Cognito Authentication Backend via CloudFormation
AWSTemplateFormatVersion: '2010-09-09'
Description: Cognito Stack
Parameters:
AuthName:
Type: String
Description: Unique Auth Name for Cognito Resources
Resources:
# Creates a role that allows Cognito to send SNS messages
SNSRole:
@jetstreamin
jetstreamin / better cors
Last active February 16, 2019 22:24
Better CORS for S3 Buckets
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="https://s3.amazonaws.com/doc/2006-03-01">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
@jetstreamin
jetstreamin / all-public-s3-bucket-policy.json
Created February 17, 2019 21:14
all public s3 bucket
{
"Id": "XXX",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "XXX",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
@jetstreamin
jetstreamin / aws cloudwatch cron
Last active March 4, 2019 20:27
aws cloudwatch cron
# Use the hash sign to prefix a comment
# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 7) (Sunday=0 or 7)
# | | | | |
# * * * * * command to be executed
#--------------------------------------------------------------------------
@jetstreamin
jetstreamin / try-catch.sh
Last active March 5, 2019 10:45
try-catch.sh utility for bash
# plucked from https://stackoverflow.com/a/25180186
#!/bin/bash
function try()
{
[[ $- = *e* ]]; SAVED_OPT_E=$?
set +e
}