Skip to content

Instantly share code, notes, and snippets.

Jared Short shortjared

Block or report user

Report or block shortjared

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shortjared
shortjared / serverless.yml
Created Jan 29, 2019
Configs with serverless-api-gateway-caching plugin
View serverless.yml
service: aws-nodejs
custom:
apiGatewayCaching:
enabled: true
provider:
name: aws
runtime: nodejs8.10
@shortjared
shortjared / handler.js
Created Jan 29, 2019
Function Throttle Alarms Serverless.yml Example
View handler.js
'use strict';
function sleep(ms){
return new Promise(resolve => setTimeout(resolve, ms));
}
module.exports.hello = async (event, context) => {
await sleep(5000); // hit api endpoint twice in 5 seconds, get a 429!
return {
statusCode: 200,
body: JSON.stringify({
@shortjared
shortjared / list.txt
Last active Apr 9, 2020
List of AWS Service Principals
View list.txt
acm.amazonaws.com
alexa-appkit.amazon.com
apigateway.amazonaws.com
application-autoscaling.amazonaws.com
appstream.application-autoscaling.amazonaws.com
appsync.amazonaws.com
athena.amazonaws.com
autoscaling.amazonaws.com
batch.amazonaws.com
channels.lex.amazonaws.com
@shortjared
shortjared / README.md
Last active Oct 8, 2019
If you have ever wanted to grab a marketplace AMI (ex: OpenVPN) you'll know that the process is painful. This solves the pain.
View README.md

Usage

  • You will need to first make sure you have subscribed to the marketplace product
  • Get the AMI of the marketplace
  • Copy the script to machine
  • awsume (or otherwise authorize) to AWS
  • chmod the script to be executable if needed chmod +x marketplace-ami-encryptor.sh

Usage ./marketplace-ami-encryptor.sh {region} {ami} {name}
Example: ./marketplace-ami-encryptor.sh us-east-1 ami-f6eed4e0 OpenVPN

@shortjared
shortjared / nginx.conf
Last active Feb 10, 2020
AWS API Gateway Nginx Reverse Proxy
View nginx.conf
# NOTE
#
#
# Use sed on the instance up to replace the INSTANCE_ID and DNS_RESOLVER with the following commands
#
####################################################################################################
# Fetch the private IP for resolving DNS dynamically in nginx
# We also need to escape the `.` from it for usage in later sed
#
# DNS_RESOLVER=`grep nameserver /etc/resolv.conf | cut -d " " -f2 | sed 's/\./\\./g'`
View slack-theme.css
#msgs_scroller_div::-webkit-scrollbar-track, #client_body::before, .client_container,
#search_terms, #client_body, #footer, ts-message, .channel_header, ts-jumper ts-jumper-container,
ts-jumper input[type="text"] {
background: #282c34 !important;
}
#message_edit_form .ql-editor, #message_edit_form .ql-placeholder, #msg_form .ql-editor, #msg_form .ql-placeholder {
color: #fff
}
View test-animation.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View mac-idempotent-setup.sh
#!/bin/sh
# Install Homebrew
which brew > /dev/null 2>&1
if [ $? -eq 1 ]; then
#Cheat, if we don't have brew, install xcode command line utils too
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
@shortjared
shortjared / serverless.yml
Created Jun 15, 2017
sensitive env vars passed as params
View serverless.yml
# serverless.yml
service:
name: myService
awsKmsKeyArn: arn:aws:kms:us-east-1:XXXXXX:key/some-hash # Optional KMS key arn which will be used for encryption for all functions
frameworkVersion: ">=1.0.0 <2.0.0"
provider:
name: aws
View algolia-sync.rb
#!/usr/bin/env ruby
require 'json'
require 'algoliasearch'
# Copy the algolia from prior commit to a tmp file for comparison
`git show $(git rev-parse HEAD~1):algolia.json > old-algolia.json`
current_algolia = JSON.parse(File.read('algolia.json'))
old_algolia = JSON.parse(File.read('old-algolia.json'))
You can’t perform that action at this time.