Skip to content

Instantly share code, notes, and snippets.

Rick Viscomi rviscomi

Block or report user

Report or block rviscomi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rviscomi
rviscomi / multi <--> single
Created Jun 3, 2018
Convenience functions for turning a multi-line string into concatenated single-line strings and back
View multi <--> single
concat = q => q.split('\n').map(l => `"${l}"`).join('+\n');
multi = q => q.split('\n').map(l => l.replace(/(^"|"\+$)/g, '')).join('\n');
@rviscomi
rviscomi / scrape-meetups.js
Created Apr 3, 2018
Scrapes a Meetup.com topic's "All Meetups" page to extract name, location, and membership info.
View scrape-meetups.js
meetups = Array.from(document.querySelectorAll('.gridList-item')).map(i => {
name = i.querySelector('a span').innerText;
where = i.querySelector('span a').innerText;
members = parseInt(i.querySelector('.text--secondary').innerText.match(/([\d\,]+)/)[0].replace(',', ''));
return {name, members, where};
})
@rviscomi
rviscomi / wappalyzerbigquery.js
Last active May 2, 2018
wappalyzer to bigquery
View wappalyzerbigquery.js
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);
View gist:d5d94293e5b1e335fdadbd00817f7dc0
{"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 / compression.sql
Last active Nov 5, 2017
Exploring compression stats in HTTP Archive
View compression.sql
# 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,
View HA Histogram.js
// getHistogramQuery('bytesJS', '2017_05_15')
getHistogramQuery = (metric, date) => `SELECT
*
FROM
(
SELECT
'desktop' AS client,
volume,
bin,
pdf,
@rviscomi
rviscomi / HA pages.js
Last active Jun 12, 2017
Generates a query to use with BigQuery that gets the 25/50/75 percentiles of a metric over all desktop/mobile pages tables.
View HA pages.js
/* 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
View js-library-ranking-histogram.py
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
View http-archive-spf.sql
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
You can’t perform that action at this time.