SAM template for a Bref HTTP application:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:| <?php | |
| // Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck. | |
| // Happy to be proven wrong! | |
| final class Router { | |
| private $dependencies; | |
| public function __construct (Dependencies $dependencies) { | |
| $this->dependencies = $dependencies; | |
| // You might say that this is Service Locator, but it's not. This router is toplevel, | |
| // and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI. |
| apiVersion: policy/v1beta1 | |
| kind: PodSecurityPolicy | |
| metadata: | |
| name: developers-psp | |
| spec: | |
| privileged: false | |
| allowPrivilegeEscalation: false | |
| hostNetwork: false | |
| hostPID: false | |
| hostIPC: false |
| <?php | |
| function require_auth() { | |
| $AUTH_USER = 'admin'; | |
| $AUTH_PASS = 'admin'; | |
| header('Cache-Control: no-cache, must-revalidate, max-age=0'); | |
| $has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW'])); | |
| $is_not_authenticated = ( | |
| !$has_supplied_credentials || | |
| $_SERVER['PHP_AUTH_USER'] != $AUTH_USER || | |
| $_SERVER['PHP_AUTH_PW'] != $AUTH_PASS |
| import random | |
| header_names = ['User-Agent'] | |
| ua = ['Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36', 'Mozilla/5.0 (Linux; Android 6.0; CAM-L21 Build/HUAWEICAM-L21; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/62.0.3202.84 Mobile Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'] | |
| if (messageIsRequest): | |
| request = helpers.analyzeRequest(messageInfo) | |
| headers = request.getHeaders() | |
| for header_name in header_names: |
| import cats.instances.either._ | |
| import Transducer.run | |
| import UserRegistration._ | |
| object Main extends App { | |
| private val commands = List(GDPRDeletion, StartRegistration, StartRegistration, ConfirmAccount, GDPRDeletion) | |
| run(userRegistration)(commands).foreach(println) | |
| // OUTPUT |
| library(osmplotr) | |
| valpo <- get_bbox(c(-71.660, -33.065, -71.610, -33.015)) | |
| valpo_roads <- extract_osm_objects(key = 'highway', bbox = valpo) | |
| map <- osm_basemap(valpo, bg = 'gray20') | |
| map <- add_osm_objects(map, valpo_roads, col = 'gray70') | |
| print_osm_map(map, | |
| filename = './outputs/02-valparaiso-dark.jpg', | |
| width = 2000, units = 'px', dpi = 300) |
| <alps> | |
| <doc>Sample Service</doc> | |
| <!-- properties --> | |
| <descriptor id="identifier" def="https://schema.org/identifier" /> | |
| <descriptor id="givenName def="https://schema.org/givenName" /> | |
| <descriptor id="familyName def="https://schema.org/familyName" /> | |
| <descriptor id="status" def="https://schema.org/status" /> | |
| <descriptor id="dateCreated" def="https://schema.org/dateCreated" /> | |
| <descriptor id="dateModified" def="https://schema.org/dateModified" /> |
SAM template for a Bref HTTP application:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:| const | |
| AWS = require('aws-sdk'), | |
| { Readable } = require('readable-stream'); | |
| const s3 = new AWS.S3({ | |
| region: 'ap-northeast-2' | |
| }); | |
| s3SelectQuery = (query) => { | |
| return new Promise((resolve, reject) => { |
| #!/usr/bin/python2 | |
| # -*- encoding: utf-8 -*- | |
| # implementation of the serial protocol used by | |
| # AM03127 LED signs. Based on the document | |
| # AM004 - 03128/03127 LED Display Board Communication | |
| # Version 2.2, Date Aug. 13, 2005 | |
| # My LED board is a "Mc Crypt 590996 / 590998" | |
| # LED Light Writing Board |