Skip to content

Instantly share code, notes, and snippets.

@adshrc
adshrc / buildspec.yml
Last active December 29, 2023 13:37
buildspec.yml: Build Docker Image, push to ECR and deploy to ECS (imagedefinitions.json)
version: 0.2
# Set the following env vars in CodeBuild (Environment Settings)
# You will get most of them from the ECR URI: <ACCOUNT_ID>.dkr.ecr.<ECR_REGION>.amazonaws.com/<ECR_REPOSITORY_NAME>
#
# ACCOUNT_ID
# ECR_REGION
# ECR_REPOSITORY_NAME
# ECS_CONTAINER_NAME
#
@adshrc
adshrc / README.txt
Last active September 17, 2021 15:01
Cloudflare Maintenance Page - Simple Cloudflare Worker
Easy to use Maintenance page as a Cloudflare Worker. Once set up, you can enable it for unlimited pages in your CF account. Get rid of greedy subscriptions that charge you per domain.
How to:
1. Go to Cloudflare Workers and create a new Worker (url is https://dash.cloudflare.com/<your-id>/workers/new)
2. paste the Code from above
3. Set an AUTH_KEY and AUTH_VALUE and the maintenancePageHtml (optionally)
4. deploy the worker
5. goto Cloudflare and choose a domain, click on the Workers section (url is https://dash.cloudflare.com/<your-id>/<domain>/workers)
6. click on "Add Route" and set the Route you want to enable the maintenance page for (typically <domain>/*)
7. choose your previously created worker from the dropdown
@adshrc
adshrc / query-harvest-example.ts
Created April 26, 2020 17:44
Google Apps Script (GAS) Query Library: Extend it to query your desired RESTful service. You can see an example for Harvest below. Use clasp for compiling TypeScript Code!
export namespace Harvest {
export class BaseQuery extends Query.BaseQuery {
constructor(path: string, expectedStatusCodes: Query.ExpectedStatusCodes) {
// get global properties
const SCRIPT_PROPS = PropertiesService.getScriptProperties();
const HARVEST_TOKEN = SCRIPT_PROPS.getProperty('HARVEST_TOKEN');
const HARVEST_ACCOUNT_ID = SCRIPT_PROPS.getProperty('HARVEST_ACCOUNT_ID');
const HARVEST_BASE_URL = SCRIPT_PROPS.getProperty('HARVEST_BASE_URL');