Skip to content

Instantly share code, notes, and snippets.

@gwilken
gwilken / middleware.js
Created April 17, 2019 17:18
Secure headers with Express
const setSecureHeaders = (req, res, next) => {
res.setHeader("X-Powered-By", "a_whole_lotta_coffee");
res.setHeader("Content-Security-Policy", "default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self';");
res.setHeader("Referrer-Policy", "no-referrer");
res.setHeader("X-XSS-Protection", "1; mode=block")
res.setHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate")
res.setHeader("Expires", "-1")
res.setHeader("Pragma", "no-cache")
res.setHeader("Feature-Policy", "microphone 'none'; camera 'none'; fullscreen 'none'; payment 'none';")
next();
@jthrilly
jthrilly / package.json
Created January 29, 2019 09:48 — forked from mallendeo/package.json
Record gsap animations frame by frame with puppeteer
{
"name": "gsap-to-video",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"fs-extra": "^7.0.0",
"puppeteer": "^1.7.0"
}
}
@mattdesl
mattdesl / MeshCustomMaterial.js
Last active April 5, 2023 08:41
Custom mesh standard material with glslify + ThreeJS r83dev
const glslify = require('glslify');
const path = require('path');
// This is the original source, we will copy + paste it for our own GLSL
// const vertexShader = THREE.ShaderChunk.meshphysical_vert;
// const fragmentShader = THREE.ShaderChunk.meshphysical_frag;
// Our custom shaders
const fragmentShader = glslify(path.resolve(__dirname, 'standard.frag'));
const vertexShader = glslify(path.resolve(__dirname, 'standard.vert'));
@dloman
dloman / xvfb
Last active September 12, 2023 12:32 — forked from jterrace/xvfb
### BEGIN INIT INFO
# Provides: Xvfb
# Required-Start: $local_fs $remote_fs
# Required-Stop:
# X-Start-Before:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Loads X Virtual Frame Buffer
### END INIT INFO
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@a1phanumeric
a1phanumeric / batch_ai_to_svg.jsx
Created March 19, 2013 10:28
ESTK .jsx script to open directory of .ai files and save them as SVGs with standardised artboards (an artboard which perfectly fits the image).
#target illustrator
var sourceDir,
destDir,
files,
sourceDoc;
sourceDir = Folder.selectDialog( 'Select the import directory.', '~' );
destDir = Folder.selectDialog( 'Select the export directory.', sourceDir.sourceDir );