Skip to content

Instantly share code, notes, and snippets.

View nathanmalishev's full-sized avatar
🦹‍♂️

Nathan Malishev nathanmalishev

🦹‍♂️
View GitHub Profile
-- Show the current time in your time zone.
--
-- Read how it works:
-- https://guide.elm-lang.org/effects/time.html
--
-- For an analog clock, check out this SVG example:
-- https://elm-lang.org/examples/clock
--
import Browser
-- Press a button to generate a random number between 1 and 6.
--
-- Read how it works:
-- https://guide.elm-lang.org/effects/random.html
--
import Browser
import Html exposing (..)
import Html.Attributes exposing (class, classList, href, style)
import Html.Events exposing (..)
func CreateLambdaContextLocally(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
type MyCustomClaims struct {
Username string `json:"cognito:username"`
Email string `json:"email"`
// custom claims etc
jwt.StandardClaims
}
@nathanmalishev
nathanmalishev / modd.conf
Last active March 1, 2020 06:25
Modd conf showing individual handler rebuilds and global rebuils for utils
handler/handlerX/**.go {
prep: go build -o dist/handlerX ./handler/handlerX/
}
handler/handlerY/**.go {
prep: go build -o dist/handlerY ./handler/handlerY/
}
helper/**.go util/**.go {
prep: for dir in `ls handler`; do \
@nathanmalishev
nathanmalishev / makefile
Last active March 1, 2020 06:25
makefile, for use with AWS Lambda & golang, showing local development
clean:
@rm -rf dist
@mkdir -p dist
gomon:
reflex -r '\.go' -s -- sh -c 'make build'
build: clean
@for dir in `ls handler`; do \
GOOS=linux go build -o dist/handler/$$dir PATH/handler/$$dir; \
+-------------+------------+--------------+-------------+
| Service | Speed | Environment | Extra hacks |
+-------------+------------+--------------+-------------+
| Serverless | 💩 | 🔥 | 🔥 |
| AWS SAM | 👍 | 👍 | 💩 |
| Local | 🔥 | 💩 | 💩 |
+-------------+------------+--------------+-------------+
Shit hot (very good) - 🔥
Okay - 👍
Shit - 💩
@nathanmalishev
nathanmalishev / network-deploy-snippey.yaml
Last active July 18, 2018 00:32
A snippet of the roles-stack for medium
WebAppRole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action:
- "sts:AssumeRole"
Principal:
Parameters:
Env:
Description: An environment name that will be prefixed to resource names
Type: String
AllowedValues: ["development", "production"]
resources:
NetworkRole:
Type: "AWS::IAM::Role"
Properties:
@nathanmalishev
nathanmalishev / createAndExecuteRoles.yaml
Last active January 25, 2019 17:19
A set of policies, used to create an initial ci user
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- 'cloudformation:CreateChangeSet'
- 'cloudformation:DescribeChangeSet'
- 'cloudformation:ExecuteChangeSet'
- 'cloudformation:DescribeStacks'
Resource:
- 'arn:aws:cloudformation:<region>:<account_no>:stack/<roles_permission_stack_name>/*'
# This template is a Cloud Formation template, that has AWS Sam seamlessly mixed in
# It is extremely powerful as you will see!
# This is a template of Lambda & RDS, publically available (so no private VPC)
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31 # This is to tell cloudformation we need to transform this template, as it has SAM!
Description: Severless set up with an RDS
######## ### ######## ### ## ##
## ## ## ## ## ## ## ## ### ###