What this will cover
- Host a static website at S3
- Redirect
www.website.com
towebsite.com
- Website can be an SPA (requiring all requests to return
index.html
) - Free AWS SSL certs
- Deployment with CDN invalidation
const upload (url) => { | |
const parts = url.split('?'); | |
const extractedFilename = parts[parts.length - 2]; | |
const filename = extractedFilename ? `${i}_${extractedFilename}` : `${i}.pdf`; | |
const key = `document-groups-documents/${docFolder}/${filename}`; | |
const response = await axios({ | |
url, | |
method: 'get', | |
responseType: 'stream', | |
}); |
# Copyright (C) 2018 Dineshkarthik Raveendran | |
from __future__ import print_function # Python 2/3 compatibility | |
import boto3 | |
import argparse | |
def replicate(table_name, existing_region, new_region, new_table_name): | |
""" | |
Replicate table in new region. |
var http = require('http'); | |
var router = require('routes')(); | |
var Busboy = require('busboy'); | |
var AWS = require('aws-sdk'); | |
var inspect = require('util').inspect; | |
var port = 5000; | |
// Define s3-upload-stream with S3 credentials. | |
var s3Stream = require('s3-upload-stream')(new AWS.S3({ | |
accessKeyId: '', |
const mustache = require('mustache'); | |
/** | |
* @param html | |
* @param data has the following structure: | |
* { | |
* pages: [ | |
* { | |
* packages: { | |
* dspName: String, |
#!/usr/bin/env bash | |
read -p "Container name: " container_name | |
read -p "username: " username | |
read -p "password: " password | |
read -p "database: " database | |
read -p ".sql path: " sql_file | |
script=exec docker exec -i $container_name mysql -u$username -p$password $database < $sql_file |
const fileLink = 'https://link-to-remote-file.pdf'; | |
PDFJS.workerSrc = '/path/to/pdf.worker.js'; | |
PDFJS.getDocument(fileLink) | |
.then(function (doc) { | |
// A lots of valuable information in `doc` variable | |
return doc.pdfInfo.numPages; | |
}); |
language: php | |
php: | |
- 5.6 | |
- 7.0 | |
- 7.1 | |
cache: | |
directories: | |
- $HOME/.composer |
<?php | |
$mock = Mockery::mock(ClassYouWantToMock::class)->makePartial(); | |
$mock->shouldReceive('methodNameToMock')->andReturn($returnVariable); | |
$this->app->instance(ClassYouWantToMock::class, $mock); |
{ | |
"name": "SomeName", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"local:onboard": "node $NODE_DEBUG_OPTION /usr/bin/lambda-local -f index -e _onboard_event.json -t 300", | |
"local:refresh": "node $NODE_DEBUG_OPTION /usr/bin/lambda-local -f index -e _refresh_event.json -t 300" | |
}, | |
"license": "ISC", |