Skip to content

Instantly share code, notes, and snippets.

View 3con's full-sized avatar

Evan Conkle 3con

View GitHub Profile
@3con
3con / head.html
Created October 17, 2017 03:08 — forked from krschmidt/head.html
Set Canonical URL via Javascript
<script type='text/javascript'>
var link = document.createElement('link');
link.setAttribute('rel', 'canonical');
link.setAttribute('href', location.protocol + '//' + location.host + location.pathname);
document.head.appendChild(link);
</script>
@3con
3con / redirections.xml
Created September 20, 2017 16:35 — forked from lazypower/redirections.xml
AWS S3 Redirect rules for my Blog
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>tag/planet/rss/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>feeds/tag_planet.atom.xml</ReplaceKeyWith>
<HttpRedirectCode>302</HttpRedirectCode>
</Redirect>
</RoutingRule>
@3con
3con / redirect-domain-with-s3-and-cloudfront.json
Created September 19, 2017 02:35 — forked from amosshapira/redirect-domain-with-s3-and-cloudfront.json
CloudFormation template to redirect "company.co.uk" to "company.com"
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Redirect {www.,}company.co.uk web site to company.com, including SSL",
"Resources": {
"BucketCompanyCoUk": {
"Properties": {
"AccessControl": "PublicRead",
"BucketName": "company.co.uk",
"CorsConfiguration": {
"CorsRules": [
@3con
3con / Cloudformation.json
Created September 19, 2017 02:29 — forked from andresbravog/Cloudformation.json
ServerLess Article
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Cloud Formation Template for S3 based static site",
"Mappings": {
"RegionMap": {
"us-east-1": {
"S3hostedzoneID": "Z3AQBSTGFYJSTF",
"websiteendpoint": "s3-website-us-east-1.amazonaws.com"
},
"us-west-1": {
@3con
3con / README.md
Created September 18, 2017 23:16 — forked from yorkxin/README.md
Amazon S3 Redirect Rules Generator

Amazon S3 Redirect Rules Generator

A Ruby script to generate simple Amazon S3 Redirection Rules XML file.

Update: There is an app for that now! Use Amazon S3 Redirector (Web app) and you can generate the XML without any knowledge about Ruby. Thanks to @rainforestapp. BTW, It's open source too.

Dependencies

  • Nokogiri
@3con
3con / README.md
Created September 18, 2017 23:15 — forked from dryan/README.md
Script to create redirects in S3 buckets

s3redirect

Authentication

Your AWS credentials can be set in a number of ways:

  1. In a ".boto" file in your home folder. See Boto's documentation for how to create this file.
  2. In the environment variables "AWS_ACCESS_KEY_ID" and "AWS_SECRET_ACCESS_KEY".
  3. Passed in as arguments. -a or --access-key for the Access Key ID and -s or --access-secret for the Secret Access Key.
@3con
3con / dynamodb_read_backoff.py
Created September 2, 2017 03:48 — forked from shentonfreude/dynamodb_read_backoff.py
Wrap boto3 dynamodb in an exponential backoff to avoid ProisionedThroughputExceededException
#!/usr/bin/env python
# An exponential backoff around Boto3 DynamoDB, whose own backoff eventually
# fails on long multipage scans. We'd like to use this as a wrapper somehow,
# see: https://gist.github.com/numberoverzero/cec21b8ca715401c5662
from time import sleep
import boto3
from boto3.dynamodb.conditions import Attr
@3con
3con / Gemfile
Created August 2, 2017 21:50 — forked from nvd/Gemfile
swagger s3 cf
source 'https://rubygems.org'
gem 'aws-sdk', '~> 2.3'
@3con
3con / deploy.sh
Last active August 29, 2015 14:16 — forked from tokudu/deploy.sh
#!/bin/bash
# Updates all EC2 instances from git
# Author: anton@sothree.com
CODE_LOCATION=/var/www/your_project
SERVER_PREFIX=your_project
# exit if something fails
set -e
@3con
3con / .bashrc
Created April 9, 2014 17:01 — forked from jamiebegin/.bashrc
# Place this command in your .bashrc (or whatever is appropriate for your shell of choice).
alias aws='client=$1 source ~/bin/aws.sh $client'