Skip to content

Instantly share code, notes, and snippets.

Avatar

Søren B. Vrist svrist

View GitHub Profile
View preserverless.yaml
....
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 Feb 7, 2017
export cloudformation outputs as more simple json
View export_values.py
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 Feb 7, 2017
Update or create a CloudFormation stack given a name and template + params'
View cf_create_or_update.py
'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
View handler.py
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 Feb 7, 2017
serverless framework friendly logformat
View lambdahelper.py
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 Feb 7, 2017
Mangle sys.path to include lambda zipped vendored python dependencies
View _pathmangle.py
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)
View galleryimage
{{ $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"
View gallery
View frontmatter
----
title: CPH:Triathlon – Race report
author: svrist
date: 2015-02-20
aliases:
- /2015/02/20/cphtriathlon-race-report/
lightbox: True
View keybase.md

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:

You can’t perform that action at this time.