Skip to content

Instantly share code, notes, and snippets.

https://forums.whirlpool.net.au/archive/9n111qlk
@cgspeck
cgspeck / de-watermark.sh
Last active November 8, 2021 08:56
De-watermark a PDF
#! /bin/bash -e
# inspired by https://superuser.com/questions/448519/how-to-remove-watermark-from-pdf-using-pdftk
if [ $# -ne 2 ]; then
echo -e "Usage:\n ${0} \"watermark text\" input.pdf\n"
exit 1
fi
INPUT_FILENAME=$2
WM_STRING=$1
@cgspeck
cgspeck / vpc-fargate.yaml
Created November 23, 2020 10:02 — forked from lizrice/vpc-fargate.yaml
Cloudformation template for setting up VPC and subnets for Fargate
# Usage:
# aws cloudformation --region <region> create-stack --stack-name <stack name> --template-body file://vpc-fargate.yaml
# This template will:
# Create a VPC with:
# 2 Public Subnets
# 2 Private Subnets
# An Internet Gateway (with routes to it for Public Subnets)
# A NAT Gateway for outbound access (with routes from Private Subnets set to use it)
#
@cgspeck
cgspeck / Code.gs
Last active July 1, 2017 05:47
Process a Google Form and subscribe the respondent to a MailChimp and Mailman lists using custom fields
/* global UrlFetchApp */
/* exported processForm */
/* eslint no-console: "warn" */
function sendDetailsToMailChimp(firstName, lastName, emailAddress, membershipType) {
// inject or replace ${} values with your literals
// membershipType is a custom field, replace or modify as you require
var url = `https://${DC}.api.mailchimp.com/3.0/lists/${LISTID}/members/`
var data = {
@cgspeck
cgspeck / circle.scad
Created April 29, 2017 06:36
OpenSCAD points along a circle demo
radius = 10;
circle(radius);
sectors = 8;
sector_degrees = 360 / sectors;
for(sector = [1 : sectors]) {
angle = sector_degrees * sector;
echo(str("--- Angle:", angle));
x_pos = radius * sin(angle);
@cgspeck
cgspeck / generate-cards.rb
Created March 9, 2017 02:41
Quick script to generate repeating cards across a page as HTML
#! /usr/bin/env ruby
raise "Please provide source path" unless ARGV[0]
# all measurements are in mm
COLS_PER_ROW = 3
CARD_HEIGHT = 50
REPEAT_CARDS = 4
OUT_FILE_NAME='index.html'
PAGE_WIDTH=210
@cgspeck
cgspeck / migrate.py
Created February 20, 2017 10:51
Quick and dirty script to do a batched migration of books to a new Calibre library running in Docker
#! /usr/bin/python3
import logging
import glob
import os
import subprocess
from pathlib import Path, PosixPath
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)