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
export DISPLAY=:10 | |
killall -9 Xvfb | |
Xvfb :10 -screen 0 1024x768x24 -extension RANDR > /dev/null 2>&1 & |
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
timing = !!(typeof window.performance !== "undefined" && typeof window.performance.timing !== "undefined"); | |
if (timing && timing.msFirstPaint && window.t_pagestart) { | |
t_firstpaint = timing.msFirstPaint - window.t_pagestart; | |
} else if (window.chrome && typeof window.chrome.loadTimes === 'function') { | |
t_firstpaint = window.chrome.loadTimes().firstPaintTime - window.chrome.loadTimes().startLoadTime; | |
} |
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
sudo fallocate -l 2G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile |
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
const http2 = require('http2'); | |
const fs = require('fs'); | |
const options = { | |
key: fs.readFileSync('./selfsigned.key'), | |
cert: fs.readFileSync('./selfsigned.crt'), | |
allowHTTP1: true | |
} | |
const server = http2.createSecureServer(options, (req, res) => { |
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
try { | |
navigator.serviceWorker.getRegistrations().then(function(registrations) { | |
registrations.forEach(function(registration) { | |
if (registration.active && registration.active.scriptURL.includes("dexecure")) { | |
console.log('removing registration', registration); | |
registration.unregister(); | |
} | |
}) | |
}) | |
} catch (e) { |
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
wget -E -H -k -K -p -t 2 -T 30 --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36" -e robots=off http://example.com |
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
function modifyURL(url) { | |
// ect can be 'slow-2g', '2g', '3g', or '4g'. | |
const connectionType = navigator.connection.effectiveType; | |
if (connectionType === "slow-2g" || connectionType === "2g") { | |
return url + "?opt=aggressive"; | |
} else if (connectionType === "4g") { | |
return url + "?opt=mild"; | |
} else { | |
return url + "?opt=default"; | |
} |
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
<html> | |
<body> | |
<div class="jank-detector"> | |
Random numbers, to highlight jank: | |
<span class="rand"></span> | |
</div> | |
<script> | |
const rand = document.querySelector(".rand"); | |
function randFrame() { | |
rand.textContent = Math.random(); |
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
const img = new Image(); | |
img.src = "cat.png"; | |
img.decode().then(() => { | |
// image fully decoded and can be safely rendered on the screen | |
const orig = document.getElementById("orig"); | |
orig.parentElement.replaceChild(img, orig); | |
}); |
OlderNewer