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 / backup.sh
Created March 5, 2019 10:46
backup.sh - simple backup script for bash
#!/bin/bash
OF=/var/my-backup-$(date +%Y%m%d).tgz
tar -cZf $OF /home/me/
@jetstreamin
jetstreamin / loop.sh
Last active March 5, 2019 10:39
loop.sh example of a loop in bash
# plucked from https://stackoverflow.com/a/25180186
#!/bin/bash
# Read a string with spaces using for loop
for value in I like programming
do
echo $value
done
@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
}
@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 / 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 / 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 / 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 / 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 / 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 / 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