Skip to content

Instantly share code, notes, and snippets.

brew install get_iplayer
get_iplayer --subtitles --file-prefix="<pid>" --output=$PWD --pid $PID
ffmpeg -i $PID.mp4 -ss 00:25:26 -t 00:01:59 -vf subtitles=$ $PID-clip-subtitles.mp4
View generate-xsl.php
$saxon = new Saxon\SaxonProcessor();
print "{$saxon->version()}\n";
$input = 'schematrons/1.0/jats4r-topic.sch';
$xsl = 'skeleton/iso_schematron_skeleton_for_saxon.xsl';
$output = 'jats4r-topic.xsl';
$processor = $saxon->newXsltProcessor();
hubgit / scripts-package.json
Created Feb 14, 2019
npm scripts for typescript libraries
View scripts-package.json
"scripts": {
"build": "npm-run-all --parallel build:*",
"build:cjs": "tsc --outDir dist/cjs --module commonjs",
"build:es": "tsc --outDir dist/es --declarationDir dist/types --declaration",
"dev": "npm-run-all --parallel \"build:* --watch\"",
"lint": "tslint --project .",
"prebuild": "rimraf dist",
"prettier": "prettier --write \"src/**/*.{ts,tsx}\" \"*.{js,json}\"",
"preversion": "npm-run-all --parallel typecheck lint test",
"test": "jest",
hubgit /
Last active Feb 4, 2019
Sources of variables in docker-compose.yml, Dockerfile, and the applications they start

Used in docker-compose.yml

  • environment variables in the shell where docker-compose is run
  • values set in an .env file in the folder where docker-compose is run

Used in Dockerfile

  • build args set in docker-compose.yml (build > args, object) and imported with ARG in Dockerfile
  • values set with ARG in Dockerfile
View just-keep-scrolling.js
window.setInterval(() => window.scrollTo(0, document.body.scrollHeight), 1000)
View mapbox-style-contours-only.json
"version": 8,
"name": "OS Outdoor",
"metadata": {
"mapbox:autocomposite": true,
"mapbox:type": "template",
"mapbox:print": {
"units": "in",
"width": 8.5,
"height": 11,
View index.html
<!doctype html>
<meta charset="utf-8">
<body style="margin: 0; height: 100vh; width: 100vw; overflow: hidden; display: flex">
<textarea style="height: 100%; overflow-y: auto; flex: 1; flex-shrink: 0; padding: 1em; border: none; background: #eee; font: 400 11px system-ui" autofocus spellcheck="false" placeholder="JSON input…"></textarea>
<output style="height: 100%; overflow-y: auto; flex: 1; flex-shrink: 0; padding: 1em; white-space: pre-wrap; font: 400 11px system-ui" laceholder="JSON output…"></output>
const input = document.querySelector('textarea')
const output = document.querySelector('output')
tar c data | gzip --best > data.tar.gz
View fetch-crossref-metadata.js
const prefixes = [
View urlsearchparams.js
(() => {
// build
const params = new URLSearchParams()
params.append('q', 'bar')
params.append('n', 5)
// stringify
// const url = `${params.toString()}`
const location = new URL('')
You can’t perform that action at this time.