This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple functions for querying the SW cache. | |
// Only approximate! (1) Only includes bodies. (2) Can't count opaque resources. | |
function cacheDump(c) { | |
return c.keys().then(a => { | |
return Promise.all(a.map(req => | |
c.match(req).then(res => res.clone().blob().then(b => [req.url, b.size])) | |
)).then(a => new Map(a)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Delays calling the given function until the browser is notifying us | |
* about a certain minimum budget or the timeout is reached. | |
* @param {!Window} win | |
* @param {number} startTime When we started waiting for idle. | |
* @param {number} minimumTimeRemaining Minimum number of millis idle | |
* budget for callback to fire. | |
* @param {number} timeout in millis for callback to fire. | |
* @param {function()} fn Callback. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Usage: ./gifenc.sh video.mkv anim.gif | |
palette="/tmp/palette.png" | |
filters="fps=30,scale=320:-1:flags=lanczos" | |
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette | |
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2 |