Skip to content

Instantly share code, notes, and snippets.

View svrist's full-sized avatar

Søren B. Vrist svrist

View GitHub Profile
....
Parameters:
....
CidrBlock:
Default: 172.21.0.0/16
Description: VPC Cidr Block
Type: String
AllowedPattern: "\\d+.\\d+.\\d+.\\d+/\\d+"
ConstraintDescription: Must be CIDR
Subnets:
@svrist
svrist / export_values.py
Created February 7, 2017 21:43
export cloudformation outputs as more simple json
from __future__ import division, print_function, unicode_literals
import json
import re
import boto3
def main(stack):
cf = boto3.client('cloudformation')
@svrist
svrist / cf_create_or_update.py
Created February 7, 2017 21:34
Update or create a CloudFormation stack given a name and template + params'
'Update or create a stack given a name and template + params'
from __future__ import division, print_function, unicode_literals
from datetime import datetime
import logging
import json
import sys
import boto3
import botocore
from __future__ import division, print_function, unicode_literals
import _pathmangle # noqa # pylint: disable=W0611
import lambdahelper # noqa # pylint: disable=W0611
lambdahelper.setup_logging() # noqa
import json
import psycopg2
@svrist
svrist / lambdahelper.py
Created February 7, 2017 19:44
serverless framework friendly logformat
from __future__ import division, print_function, unicode_literals
import logging
import os
def setup_logging():
'serverless framework friendly logformat'
if 'LAMBDA_TASK_ROOT' not in os.environ:
return
@svrist
svrist / _pathmangle.py
Created February 7, 2017 18:17
Mangle sys.path to include lambda zipped vendored python dependencies
import os
import sys
if 'LAMBDA_TASK_ROOT' in os.environ:
here = os.path.dirname(__file__)
vendored = os.path.join(here, 'vendored')
if os.path.isdir(vendored):
sys.path.append(vendored)
{{ $suffix := or (.Get "suffix") "jpg" }}
{{ $size := or (.Get "size") "150x150" }}
{{ with .Get "file" }}
<dl class="gallery-item">
<dt class="gallery-icon landscape">
<a href="PREFIX/{{ . }}.{{ $suffix }}" data-lightbox="set1"
data-title="{{ $.Get "caption" }}" >
<img
src="PREFIX/{{ . }}-{{ $size }}.{{ $suffix }}"
itemprop="thumbnail"
----
title: CPH:Triathlon – Race report
author: svrist
date: 2015-02-20
aliases:
- /2015/02/20/cphtriathlon-race-report/
lightbox: True

Keybase proof

I hereby claim:

  • I am svrist on github.
  • I am svrist (https://keybase.io/svrist) on keybase.
  • I have a public key whose fingerprint is 6325 6FE1 EB39 3F9B B2E9 025A 9481 7B5D 902F 56CC

To claim this, I am signing this object: