Skip to content

Instantly share code, notes, and snippets.

View bgrins's full-sized avatar

Brian Grinstead bgrins

View GitHub Profile
-- https://github.com/HTTPArchive/almanac.httparchive.org/blob/a54cc07fc61461e1366112ba81cf6e8fed7236fa/sql/2022/css/multicol.sql#L9
-- https://github.com/HTTPArchive/almanac.httparchive.org/blob/a54cc07fc61461e1366112ba81cf6e8fed7236fa/sql/2021/css/grid_named_lines.sql#L9
CREATE TEMPORARY FUNCTION countMozImageRect(css STRING)
RETURNS NUMERIC
LANGUAGE js
OPTIONS (library = "gs://httparchive/lib/css-utils.js")
AS '''
try {
const ast = JSON.parse(css);
return countDeclarations(ast.stylesheet.rules, {values: /^-moz-image-rect/});
@bgrins
bgrins / 33-66CI.json
Last active September 6, 2023 20:52
Multiply runs
{ "version": "development", "options": { "test-interval": 30, "display": "minimal", "tiles": "big", "controller": "ramp", "kalman-process-error": 1, "kalman-measurement-error": 4, "time-measurement": "performance", "warmup-length": 2000, "warmup-frame-count": 30, "first-frame-minimum-length": 0, "system-frame-rate": 60, "frame-rate": 60, "configuration": "medium" }, "data": [ { "MotionMark": { "Multiply": { "marks": { "Start sampling": { "time": 0, "index": 205 }, "Complexity: 2": { "time": -4473, "index": 10 }, "Complexity: 3": { "time": -4106, "index": 32 }, "Complexity: 10": { "time": -3772, "index": 52 }, "Complexity: 32": { "time": -3438, "index": 72 }, "Complexity: 100": { "time": -3105, "index": 92 }, "Complexity: 178": { "time": -2704, "index": 113 }, "Complexity: 316": { "time": -1753, "index": 153 }, "Complexity: 562": { "time": -929, "index": 183 } }, "samples": { "controller": { "fieldMap": { "time": 0, "complexity": 1, "frameLength": 2, "smoothedFrameLength": 3 }, "data": [ [ -4639, 1, 16.66
from google.colab import files
langs.to_csv('langs.csv', encoding = 'utf-8-sig')
files.download('langs.csv')
@bgrins
bgrins / row.json
Last active May 11, 2023 17:19
Single row response
{
"url": "https://www.archdaily.com/",
"client": "mobile",
"total_elements": "2686",
"css_variables": [
"--gray-1",
"--gray-2",
"--gray-3",
"--gray-4",
"--gray-5",
@bgrins
bgrins / about.md
Last active May 10, 2023 17:55
news-homepage-analysis

Analysis of news sites for Speedometer using HTTPArchive

  • create-dataset.sql is used to create a smaller table with both desktop and mobile results so that analysis is cheaper to run. Takes about 5TB of processing to generate this table. Note that the set of URLs is gathered from external links on the pages beneath https://en.wikipedia.org/wiki/Wikipedia:News_sources. The data may be skewed due to the lists on Wikipedia not reflecting the most popular content, including non-news sites, and including URL paths which are ignored. The list could be swapped out with a different list and have queries re-run.
  • query-dataset.sql creates a summary table the first time it runs, and then queries the results of that along with some reporting
  • running-the-same-custom-metrics-in-the-ui.js is meant to be used as a "Custom Metric" on the webpagetest UI as per the instructions at https://github.com/HTTPArchive/custom-metrics/tree/8497c859ef0a7c99924981f369bb53eb3441bd6c#testing

The following custom metrics are used to

/**!
@license
handlebars v4.0.6
Copyright (C) 2011-2016 by Yehuda Katz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
var prefs = Services.prefs;
var prefNames = prefs.getChildList("", {});
var prefSizes = {};
for (var i = 0; i < prefNames.length; i++) {
var prefName = prefNames[i];
if (prefs.getPrefType(prefName) !== prefs.PREF_STRING) continue;
prefSizes[prefName] = new Blob([prefs.getStringPref(prefName)]).size;
var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13;
function objectConverter(columns) {
return new Function("d", "return {" + columns.map(function(name, i) {
return JSON.stringify(name) + ": d[" + i + '] || ""';
}).join(",") + "}");
}
function customConverter(columns, f) {
var object = objectConverter(columns);
return function(row, i) {
return f(object(row), i, columns);
function zoomOnMarkers(marker1, marker2) {
const zeroAt = selectors.profile.getZeroAt(getState());
dispatch(actions.commitRange(marker1.start - zeroAt, marker2.start - zeroAt));
}
function resetRange() {
dispatch(actions.popCommittedRanges(0));
}
function findRanges(suiteName) {
#!/bin/bash
# First install whisper.cpp:
# xcode-select --install # if necessary
# git clone https://github.com/ggerganov/whisper.cpp.git
# cd whisper.cpp && make && cd models && bash ./download-ggml-model.sh small
# Next, install ffmpeg if necessary (`brew install ffmpeg`)
if [[ ! -f $1 ]]; then
echo "$1 is not a file."