Skip to content

Instantly share code, notes, and snippets.

View jjhiew's full-sized avatar

JJ Hiew jjhiew

View GitHub Profile
@jjhiew
jjhiew / default.nginx.conf
Last active November 4, 2020 22:18
Nginx configuration to setup SSL Termination and Reverse Proxy for Sendgrid Link Tracking
# Should go into `/etc/nginx/sites-available` as file named `default`
# Redirect HTTP to HTTPS
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443;
@jjhiew
jjhiew / html-to-pdf-to-s3-stream.js
Created October 7, 2015 17:35
Stream a PDF to S3 using HTML-PDF and Streaming S3 (NodeJS)
var pdf = require('html-pdf');
var fs = require('fs');
var streamingS3 = require('streaming-s3') ;
var html = '<h1>Test</h1><p>Hello World</p>';
pdf.create(html).toStream(function(err, stream) {
var uploader = new streamingS3(stream {
accessKeyId: 'YOUR_ACCESS_KEY_ID',