Skip to content

Instantly share code, notes, and snippets.

@gojko
gojko / sync.sh
Last active August 5, 2020 06:38
deploy files to s3 for cloudfront web sites
# let aws-sdk guess content type and allow long cache for everything apart from JS, CSS and HTML
aws s3 sync $WORKDIR/ s3://$BUCKET --cache-control="max-age=86400000" --exclude "*.html" --exclude "*.js" --exclude "*.css" --acl public-read
# set JS content type correctly so UTF chars can be included safely (otherwise browsers mess up UTF)
aws s3 sync $WORKDIR/ s3://$BUCKET --cache-control="max-age=86400000" --exclude "*" --include "*.js" --acl public-read --content-type "application/javascript; charset=UTF-8"
# set CSS content type correctly so UTF chars can be included safely
aws s3 sync $WORKDIR/ s3://$BUCKET --cache-control="max-age=86400000" --exclude "*" --include "*.css" --acl public-read --content-type "text/css; charset=UTF-8"
# 10-minute CDN cache for HTML files
aws s3 sync $WORKDIR/ s3://$BUCKET --cache-control="max-age=600" --exclude "*" --include "*.html" --acl public-read --content-type "text/html; charset=UTF-8"
# lambda vm info, nodejs10.x, 15 May 2019, ldconfig -p
68 libs found in cache `/etc/ld.so.cache'
p11-kit-trust.so (libc6,x86-64) => /lib64/p11-kit-trust.so
libz.so.1 (libc6,x86-64) => /lib64/libz.so.1
libverto.so.1 (libc6,x86-64) => /lib64/libverto.so.1
libutil.so.1 (libc6,x86-64, OS ABI: Linux 3.2.0) => /lib64/libutil.so.1
libtinfo.so.6 (libc6,x86-64) => /lib64/libtinfo.so.6
libtic.so.6 (libc6,x86-64) => /lib64/libtic.so.6
libthread_db.so.1 (libc6,x86-64, OS ABI: Linux 3.2.0) => /lib64/libthread_db.so.1
libtasn1.so.6 (libc6,x86-64) => /lib64/libtasn1.so.6
<html>
<body>
<div id="v1">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="736" height="414" viewBox="0, 0, 736, 414">
<path d="M120.5,170.5 C120.5,170.5 220.5,91.5 268.5,203.5 C316.5,315.5 434.5,263.5 375.5,201.5 C316.5,139.5 498.5,151.5 633.5,289.5" fill-opacity="0" stroke="#000000" stroke-width="4"/>
</svg>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="736" height="414" viewBox="0, 0, 736, 414">
<path d="M317.5,81.5 C317.5,81.5 437.403,153.5 485.403,265.5 C533.403,377.5 692.403,138.5 633.403,76.5 C574.403,14.5 412.5,-6.5 547.5,131.5" fill-opacity="0" stroke="#C32929" stroke-width="3"/>
</svg>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="736" height="414" viewBox="0, 0, 736, 414">
@gojko
gojko / gist:d2c1cf40ce62b464154c8d86ecc31fb1
Created January 13, 2017 22:32
example rewriting pg access to promises
/*global require, module*/
var pg = require('pg'),
API = require('claudia-api-builder'),
api = new API();
module.exports = api;
// do this once, so it does not reconnect for each request.
// may need to handle reconnecting somehow inside a request?
---
swagger: "2.0"
info:
version: "2016-12-23T01:28:46Z"
title: "geoip"
host: "xxxxx.execute-api.us-east-1.amazonaws.com"
basePath: "/prod"
schemes:
- "https"
paths:
@gojko
gojko / gist:88fe5ca54bfbdb54b32922f07895cdc2
Created October 28, 2016 20:52
RPM Packages available in AWS Lambda
## This is a list of RPM packages available on AWS Lambda, Node.js 4.3 runtime, 28 October 2016
## See https://github.com/claudiajs/lambda-vm-info for how this list was generated and to get an updated version
Installed Packages
ImageMagick.x86_64 6.7.8.9-15.21.amzn1 @amzn-updates
alsa-lib.x86_64 1.0.22-3.9.amzn1 @amzn-main
audit-libs.x86_64 2.4.1-5.27.amzn1 @ami
avahi-libs.x86_64 0.6.25-12.17.amzn1 @amzn-main
basesystem.noarch 10.0-4.9.amzn1 @ami
@gojko
gojko / gist:aaea440be880d0162767639f8a6681f9
Last active August 28, 2018 13:44
Libraries available in AWS Lambda
# AWS Lambda `ldconfig -p`, region `us-east-1`, nodejs 4.3 runtime, 26 October 2016
# See https://github.com/claudiajs/lambda-vm-info for how this was generated and to create an updated version
242 libs found in cache `/etc/ld.so.cache'
libz.so.1 (libc6,x86-64) => /lib64/libz.so.1
libxtables.so.10 (libc6,x86-64) => /lib64/libxtables.so.10
libxslt.so.1 (libc6,x86-64) => /usr/lib64/libxslt.so.1
libxml2.so.2 (libc6,x86-64) => /usr/lib64/libxml2.so.2
libxcb.so.1 (libc6,x86-64) => /usr/lib64/libxcb.so.1