Skip to content

Instantly share code, notes, and snippets.

View iplayer-clip-with-subtitles.sh
brew install get_iplayer
PID=m00042g3
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.srt $PID-clip-subtitles.mp4
View generate-xsl.php
<?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
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
hubgit / docker-env-arg.md
Last active Feb 4, 2019
Sources of variables in docker-compose.yml, Dockerfile, and the applications they start
View docker-env-arg.md

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">
<title>JSON</title>
<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>
<script>
const input = document.querySelector('textarea')
const output = document.querySelector('output')
View tar-gzip.sh
tar c data | gzip --best > data.tar.gz
View fetch-crossref-metadata.js
const prefixes = [
'10.9734',
'10.4172',
'10.3844',
'10.30534',
'10.5897',
'10.26420',
'10.9790',
'10.4066',
'10.11648',
View urlsearchparams.js
(() => {
// build
const params = new URLSearchParams()
params.append('q', 'bar')
params.append('n', 5)
// stringify
// const url = `https://example.com/resources?${params.toString()}`
const location = new URL('https://example.com/resources')
You can’t perform that action at this time.