Skip to content

Instantly share code, notes, and snippets.

View buggy's full-sized avatar

Rich Buggy buggy

View GitHub Profile
@buggy
buggy / gist:3df16ad87751a9cb6eeacad3a909a9e9
Created March 28, 2018 12:33
Default options with the Javascript spread operator
function myfunc(options) {
const defaultOptions = {
min: 0,
max: 10,
};
const finalOptions = {
...defaultOptions,
...options,
};
import 'source-map-support/register'
import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from "aws-lambda";
let response;
export async function lambdaHandler(event: APIGatewayProxyEvent, context: Context): Promise<APIGatewayProxyResult> {
try {
// const ret = await axios(url);
response = {
@buggy
buggy / README.md
Last active September 5, 2019 02:33
DynamoDB Documentation

FEATURE

Attribute Value
pk Feature#${featureId}
__typename Feature
pk11 Feature#${accountId}
sk11 ${title|lowercase}
pk11 Feature#${accountId}
sk11 ${updatedAt|timestamp}
@buggy
buggy / template.yaml
Created October 11, 2019 08:01
API Gateway Proxy AppSync
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: SAM Template for API Gateway Proxy AppSync
Parameters:
DomainName:
Type: String
Stage:
Type: String
Default: dev
@buggy
buggy / index.ts
Created December 3, 2019 02:28
Generate SAM Project Using Amplify Transformers
import * as fs from "fs";
import * as yaml from "js-yaml";
import GraphQLTransform from "graphql-transformer-core";
import DynamoDBModelTransformer from "graphql-dynamodb-transformer";
import ModelAuthTransformer from "graphql-auth-transformer";
import ModelConnectionTransformer from "graphql-connection-transformer";
import SearchableModelTransformer from "graphql-elasticsearch-transformer";
import VersionedModelTransformer from "graphql-versioned-transformer";
import FunctionTransformer from "graphql-function-transformer";
@buggy
buggy / common.ts
Last active April 22, 2020 13:41
Lambda handler split by HTTP method
import { APIGatewayEvent, APIGatewayProxyHandler, Callback, Context } from "aws-lambda";
export function RestHandler(
onCreate?: APIGatewayProxyHandler,
onUpdate?: APIGatewayProxyHandler,
onDelete?: APIGatewayProxyHandler
) {
return async (event: APIGatewayEvent, context: Context, callback: Callback) => {
switch (event.httpMethod) {
case "DELETE":
version: "3.8"
services:
openvpn-client:
image: ghcr.io/wfg/openvpn-client
container_name: openvpn-client
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
environment: