Skip to content

Instantly share code, notes, and snippets.

View edthrn's full-sized avatar

ed edthrn

View GitHub Profile
@edthrn
edthrn / reduce_pdf_size.sh
Created April 3, 2019 16:48
Reduce PDF size from Ubuntu command-line
#!/bin/sh
# From https://askubuntu.com/a/626301
gs \
-sDEVICE=pdfwrite \
-dCompatibilityLever=1.4 \
-dPDFSETTINGS=/default \
-dNOPAUSE \
-dQUIET \
-dBATCH \
@edthrn
edthrn / cognito-auth.js
Last active August 15, 2018 17:11
A sample use case of sending a message to an API protected by AWS Cognito.
function ajax(method, url, data, callback) {
var req = new XMLHttpRequest();
req.open(method, url);
req.addEventListener("load", function () {
if (req.status >= 200 && req.status < 400) {
callback();
} else {
console.error(req.status + " " + req.statusText + " " + url);
}
@edthrn
edthrn / Makefile
Created July 26, 2018 20:44 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)