Skip to content

Instantly share code, notes, and snippets.

View Nooshu's full-sized avatar

Matt Hobbs Nooshu

View GitHub Profile
@Nooshu
Nooshu / gist:955b5b00adefc49e378fa251b0a67940
Created October 21, 2018 21:10
Speech page FF 62.0.3
This file has been truncated, but you can view the full file.
{
"log": {
"version": "1.1",
"creator": {
"name": "Firefox",
"version": "62.0.3"
},
"browser": {
"name": "Firefox",
"version": "62.0.3"
@Nooshu
Nooshu / results.json
Created November 29, 2018 14:05
GOV.UK Pay
{
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/69.0.3497.81 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/69.0.3497.81 Mobile Safari/537.36 TreoWorker/3.2.1",
"hostUserAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/69.0.3497.81 Safari/537.36",
"benchmarkIndex": 942
},
"lighthouseVersion": "3.2.1",
"fetchTime": "2018-11-29T13:34:25.809Z",
"requestedUrl": "https://www.payments.service.gov.uk/",
@Nooshu
Nooshu / latency.markdown
Created December 9, 2018 22:02 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@Nooshu
Nooshu / cloudfront-test-command.sh
Last active September 7, 2019 14:03
Testing the OCSP stapling of Cloudfront and Fastly
# cloudfront test
# requires: https://github.com/rcoh/angle-grinder
while true; do bash -c 'echo hello | openssl s_client -connect www.digitalmarketplace.service.gov.uk:443 -tls1_2 -tlsextdebug -status -servername www.digitalmarketplace.service.gov.uk 2>&1 | grep -q "OCSP Response Status: successful" ; echo $?'; sleep 0.5; done | agrind '* | parse "*" as code | count by code'
# Is OCSP stapling used?
# code _count
# --------------------------
# 1 (no) 151
# 0 (yes) 49
@Nooshu
Nooshu / app.js
Last active May 28, 2021 00:01
Webmention code used in the "Implementing Webmentions on this blog" Nooshu blogpost
(function(){
// Check see if browser supports the intersection observer
if ('IntersectionObserver' in window) {
// assume browser supports ES6
var supportsES6 = true;
// check see if browser supports ES6 (https://gist.github.com/DaBs/89ccc2ffd1d435efdacff05248514f38)
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
@Nooshu
Nooshu / wpt-font-injection.js
Created February 20, 2020 00:25
Modify `font-display` settings via WPT script injection
(function(){
// create our custom link tag for the stylesheet
var url = "https://www.example.com/static/app.css"; // IMPORTANT: this is the CSS that contains your @font-face rules
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.type = "text/css";
link.rel = "stylesheet"
link.href = url;
// append the stylesheet to the head
@Nooshu
Nooshu / simplified-wpt-font-injection.js
Created February 23, 2020 03:32
Simplified script for injecting fonts into WebPageTest
(function(){
// this will trigger a font load
var customFont1 = new FontFace('custom font name', 'url([FONT_URL_HERE])', {
display: 'block', // display setting to test here
weight: '700' // font-weight
// other font properties here
});
// IMPORTANT: add the font to the document
document.fonts.add(customFont1);
@Nooshu
Nooshu / test-page-script.js
Created February 23, 2020 03:36
Simple sample script to test the font load modificaion technique
// Test Page: https://keen-northcutt-3190bd.netlify.com/standard-load.html
// Paste below into the WPT Inject Script textarea.
(function(){
var montserratBold = new FontFace('montserratbold_italic', 'url(fonts/montserrat-bolditalic-webfont.woff2)', {
display: 'swap', // test the page using 'swap'
weight: '700'
});
document.fonts.add(montserratBold);
@Nooshu
Nooshu / curl-format.txt
Created July 30, 2020 21:05
cURL format for timing information
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
@Nooshu
Nooshu / failed.txt
Created August 9, 2020 22:16
Chrome headers for WOFF2 fonts, failed and successful.
:status: 200
content-type: binary/octet-stream
content-length: 67900
date: Tue, 21 Apr 2020 21:50:57 GMT
last-modified: Tue, 21 Apr 2020 14:32:51 GMT
etag: "f38ad40456df126d75363b9d7b12c979"
cache-control: max-age=315360000,immutable
accept-ranges: bytes
server: AmazonS3
x-cache: Hit from cloudfront