Skip to content

Instantly share code, notes, and snippets.

View rviscomi's full-sized avatar

Rick Viscomi rviscomi

View GitHub Profile
[cms]
/**
* IMPORTANT: Do not modify this file directly! It is generated by
* bin/cms-detector.js
*
* Detects the presence of Content Management Systems.
*
*
* Built on https://github.com/AliasIO/Wappalyzer.
* See https://github.com/AliasIO/Wappalyzer/blob/master/LICENSE.
parseReleaseHistory = (table) => {
const rows = Array.from(table.querySelectorAll('tbody tr'));
return rows.reduce((dates, row) => {
let version = getVersion(row.querySelector('td:nth-child(1)').innerText);
let date = getDate(row.querySelector('td:nth-child(2)').innerText);
dates.push({version, date});
const patch = row.querySelector('td:nth-child(3)').innerText;
if (patch) {
let _;
@rviscomi
rviscomi / changelog.js
Created May 10, 2017 18:28
Helper script for adding events to the HTTP Archive changelog.json file
class HAChangelog {
constructor(changelog=[]) {
this.changelog = changelog;
}
add(datestr, title, desc) {
this.changelog.push({
date: (new Date(datestr)).getTime(),
title,
desc
SELECT pages.rank AS rank, libs.url AS url FROM
(SELECT url FROM httparchive:scratchspace.2017_04_15_js_libs WHERE lib.name = 'SPF') AS libs JOIN
(SELECT url, rank FROM httparchive:runs.latest_pages) AS pages ON pages.url = libs.url
ORDER BY
rank ASC
from collections import defaultdict
import json
""" https://bigquery.cloud.google.com/savedquery/226352634162:ae7566b78dff4e8baf64aae5fdfa33c0
SELECT
libs.name AS library,
INTEGER(FLOOR(pages.rank / 1000) * 1000) AS bucket,
COUNT(0) AS volume
FROM
(SELECT url, lib.name AS name FROM httparchive:scratchspace.2017_04_15_js_libs WHERE lib.name IN ('jQuery', 'Google Maps', 'Bootstrap', 'Modernizr', 'Polymer', 'Angular', 'AngularJS', 'React')) AS libs JOIN
@rviscomi
rviscomi / HA pages.js
Last active June 12, 2017 19:16
Generates a query to use with BigQuery that gets the 25/50/75 percentiles of a metric over all desktop/mobile pages tables.
/* Generated by:
SELECT
SUBSTR(CONCAT('20', _TABLE_SUFFIX), 0, 10) AS date,
CASE
WHEN ENDS_WITH(_TABLE_SUFFIX, 'mobile') THEN 'mobile'
ELSE 'desktop'
END AS client
FROM
`httparchive.runs.20*`
WHERE
// getHistogramQuery('bytesJS', '2017_05_15')
getHistogramQuery = (metric, date) => `SELECT
*
FROM
(
SELECT
'desktop' AS client,
volume,
bin,
pdf,
@rviscomi
rviscomi / compression.sql
Last active November 1, 2020 11:15
Exploring compression stats in HTTP Archive
# https://discuss.httparchive.org/t/how-many-text-files-are-not-served-with-gzip/1092
#
# https://bigquery.cloud.google.com/table/httparchive:runs.2017_10_15_requests
#
# Browse encoding and MIME type for 10 random requests.
#standardSQL
SELECT
resp_content_encoding,
mimeType,
{"implies":["PHP"],"url":"/shop/catalog/browse\\?sessid=","name":"1&1","categories":["Ecommerce"],"script":[],"html":[]}
{"script":["google-analytics\\.com\\/plugins\\/ua\\/ec\\.js"],"name":"Google Analytics Enhanced eCommerce","categories":["Analytics"],"implies":[],"html":[]}
{"html":["(?:<link[^>]+components/bitrix|(?:src|href)=\"/bitrix/(?:js|templates))"],"implies":["PHP"],"script":["1c-bitrix"],"name":"1C-Bitrix","categories":["CMS"]}
{"html":["<link [^>]+(?:/([\\d.]+)/)?animate\\.(?:min\\.)?css"],"name":"animate.css","categories":["Web Frameworks"],"implies":[],"script":[]}
{"meta":[{"name":"generator","value":"2z project ([\\d.]+)"}],"name":"2z Project","categories":["CMS"],"implies":[],"script":[],"html":[]}
{"html":["<title>3ware 3DM([\\d\\.]+)?"],"implies":["3ware"],"name":"3DM","categories":["Miscellaneous"],"script":[]}
{"script":["(?:twlh(?:track)?\\.asp|3d_upsell\\.js)"],"name":"3dCart","categories":["CMS","Ecommerce"],"implies":[],"html":[]}
{"name":"3ware","categories":["Web Servers"],"implie
@rviscomi
rviscomi / wappalyzerbigquery.js
Last active May 2, 2018 19:11
wappalyzer to bigquery
var wappalyzer = getWappalyzer();
function run() {
for (name in wappalyzer.apps) {
const app = wappalyzer.apps[name];
app.name = name;
app.categories = app.cats.map(c => {
return wappalyzer.categories[c].name;
});
app.implies = getImplications(app);