Skip to content

Instantly share code, notes, and snippets.

@derianpt
derianpt / KeepDbStopped.yml
Created Oct 16, 2020 — forked from kichik/KeepDbStopped.yml
CloudFormation template that stops RDS from automatically starting back up
View KeepDbStopped.yml
# aws cloudformation deploy --template-file KeepDbStopped.yml --stack-name stop-db --capabilities CAPABILITY_IAM --parameter-overrides DB=arn:aws:rds:us-east-1:XXX:db:XXX
Description: Automatically stop RDS instance every time it turns on due to exceeding the maximum allowed time being stopped
Parameters:
DB:
Description: ARN of database that needs to be stopped
Type: String
AllowedPattern: arn:aws:rds:[a-z0-9\-]+:[0-9]+:db:[^:]*
Resources:
DatabaseStopperFunction:
Type: AWS::Lambda::Function
@derianpt
derianpt / delta_only.js
Last active May 7, 2021
activesg badminton booking scripts
View delta_only.js
// ==UserScript==
// @name activesg - single court for 2 hrs
// @namespace blah
// @version 0.6.5
// @description activesg court booking
// @match https://members.myactivesg.com/*
// @copyright 2017+, naresh,Gavin,Kent
// @require http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// ==/UserScript==
@derianpt
derianpt / StacksAndQueues.go
Created Nov 3, 2018
LIFO Stack and FIFO Queue implementation in Go/Golang.
View StacksAndQueues.go
package main
import (
"errors"
"fmt"
)
func main() {
// test out queue
var queue Queue
View pass-in-envs.yml
database:
image: "postgres:alpine"
environment:
- POSTGRES_USER
- POSTGRES_DB
@derianpt
derianpt / final-compose.yml
Last active Sep 27, 2019
medium docker part 2 final compose file
View final-compose.yml
version: "3"
services:
web-client:
build: https://github.com/youraccount/web-client.git
ports:
- "4210::5000"
entrypoint: "npm run dev"
web-server:
@derianpt
derianpt / database-persisted.yml
Last active Jun 27, 2019
medium docker part 2
View database-persisted.yml
database:
image: "postgres:alpine"
environment:
POSTGRES_USER: postgres
POSTGRES_DB: mydb
ports:
- "4201:5432"
# persist to a named volume
volumes:
- server_db:/var/lib/postgresql/data
@derianpt
derianpt / .env
Created Oct 16, 2018
.env for docker medium post part 2
View .env
POSTGRES_USER=postgres
POSTGRES_DB=mydb
View environments-snippet.yml
database:
image: "postgres:alpine"
environment:
POSTGRES_USER: postgres
POSTGRES_DB: mydb
View build-contexts.yml
# 1. Absoulute path
build: .
# 2. Relative path
build: ../path/to/app/
# 3. Git repo URL
build: https://github.com/docker/rootfs.git
# 4. Git repo URL with branch
@derianpt
derianpt / Dockerfile
Last active Apr 22, 2020
front-end app
View Dockerfile
# Base image is Alpine with latest stable Node installed.
FROM node:alpine
# set working directory for subsequent commands
WORKDIR /front-end
# leverage build cache by copying npm package files first
COPY ./package*.json ./