Skip to content

Instantly share code, notes, and snippets.

@derianpt
derianpt / KeepDbStopped.yml
Created October 16, 2020 08:43 — forked from kichik/KeepDbStopped.yml
CloudFormation template that stops RDS from automatically starting back up
# 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 February 3, 2024 14:15
activesg badminton booking scripts
// ==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 November 3, 2018 04:12
LIFO Stack and FIFO Queue implementation in Go/Golang.
package main
import (
"errors"
"fmt"
)
func main() {
// test out queue
var queue Queue
database:
image: "postgres:alpine"
environment:
- POSTGRES_USER
- POSTGRES_DB
@derianpt
derianpt / final-compose.yml
Last active September 27, 2019 07:29
medium docker part 2 final compose file
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 June 27, 2019 07:09
medium docker part 2
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 October 16, 2018 09:08
.env for docker medium post part 2
POSTGRES_USER=postgres
POSTGRES_DB=mydb
database:
image: "postgres:alpine"
environment:
POSTGRES_USER: postgres
POSTGRES_DB: mydb
# 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 April 22, 2020 04:52
front-end app
# 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 ./