Skip to content

Instantly share code, notes, and snippets.

View marcelduran's full-sized avatar

Marcel Duran marcelduran

  • Google Inc.
  • SF Bay Area
View GitHub Profile
@marcelduran
marcelduran / httparchi_twitter.sql
Created July 16, 2013 00:04
Select all data from HTTPArchive dumps for twitter.com only
SELECT * FROM
(SELECT * FROM [httparchive:runs.2010_11_15_pages] WHERE url = "http://www.twitter.com/"),
(SELECT * FROM [httparchive:runs.2010_11_29_pages] WHERE url = "http://www.twitter.com/"),
(SELECT * FROM [httparchive:runs.2010_12_16_pages] WHERE url = "http://www.twitter.com/"),
(SELECT * FROM [httparchive:runs.2010_12_28_pages] WHERE url = "http://www.twitter.com/"),
(SELECT * FROM [httparchive:runs.2011_01_20_pages] WHERE url = "http://www.twitter.com/"),
(SELECT * FROM [httparchive:runs.2011_01_31_pages] WHERE url = "http://www.twitter.com/"),
(SELECT * FROM [httparchive:runs.2011_02_11_pages] WHERE url = "http://www.twitter.com/"),
(SELECT * FROM [httparchive:runs.2011_02_26_pages] WHERE url = "http://www.twitter.com/"),
(SELECT * FROM [httparchive:runs.2011_03_15_pages] WHERE url = "http://www.twitter.com/"),
@marcelduran
marcelduran / kbps.sql
Last active December 18, 2015 19:19
I always wondered what could be a good "page speed" metric. Since most pages have a few kbytes of payload and take a few seconds to load kbps (kilobytes per second) could be a good metric. The following httparchive bigquery shows the "page speed" in kbps quantiles as well as min, max, avg and count for both desktop and mobile pages.Check it out h…
SELECT client + ' (' + STRING(volume) + ')' AS client, mean, q_10th, q_25th, median, q_75th, q_90th, q_95th, q_99th
FROM
(SELECT
'desktop' AS client,
COUNT(0) AS volume,
AVG((bytesTotal / 1024) / (fullyLoaded / 1000)) as mean,
NTH(101, QUANTILES((bytesTotal / 1024) / (fullyLoaded / 1000), 1001)) AS q_10th,
NTH(251, QUANTILES((bytesTotal / 1024) / (fullyLoaded / 1000), 1001)) AS q_25th,
NTH(501, QUANTILES((bytesTotal / 1024) / (fullyLoaded / 1000), 1001)) AS median,
NTH(751, QUANTILES((bytesTotal / 1024) / (fullyLoaded / 1000), 1001)) AS q_75th,
var os = require('os');
const RESOLUTION = 1000; // 1s CPU resolution
function cpusInfo() {
return os.cpus().map(function(cpu) {
var t = cpu.times;
return {
total: t.user + t.nice + t.sys + t.irq + t.idle,
@marcelduran
marcelduran / gist:889721
Created March 27, 2011 22:42
YUI3 sandboxing
(function (d){
var iframe = d.body.appendChild(d.createElement('iframe')),
doc = iframe.contentWindow.document;
iframe.style.cssText = 'position:absolute; top:-999em';
doc.open();
doc.write('
<body onload="
YUI_config={win:window.parent,doc:window.parent.document};