Skip to content

Instantly share code, notes, and snippets.

Ilya Grigorik igrigorik

Block or report user

Report or block igrigorik

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
lelandbatey /
Last active Oct 15, 2019
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!


This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"


mstepien / drive-appscript.js
Last active Jan 1, 2016 — forked from igrigorik/drive-appscript.js
BigQuery queries for the HTTP Archive dataset with some Google BigQuery API code updates: - use of class QueryRequest -
View drive-appscript.js
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "Run Query", functionName: "runQuery"} ];
ss.addMenu("HTTP Archive + BigQuery", menuEntries);
function runQuery() {
var projectNumber = 'httparchive';
var sheet = SpreadsheetApp.getActiveSheet();
hemanth / devtool.bash
Created Nov 23, 2013
Hacking Chrome DevTools Setup
View devtool.bash
#!/usr/bin/env bash
# Setup script for hacking chrome devtools
# Source ->
echo "Creating folder and initialize a git repo"
mkdir devtools-frontend && cd devtools-frontend
git init
echo "Adding chromium remote and initialize sparse checkout"
git remote add upstream
View cr_cssproperties.json
stevesouders / activetable.js
Last active Jul 4, 2019
ActiveTable is a bookmarklet that makes any table sortable. It also allows you to remove columns, and it remembers the removed columns for next time. Use alt+click to UNhide all columns (and clear memory). To use it, create a bookmark called "ActiveTable" that has this URL: javascript:(function(){ var jselem=document.createElement('SCRIPT'); jse…
View activetable.js
// ActiveTable - a bookmarklet to make tables sortable and editable
function init() {
var aHrows = getHrows();
var numHrows = aHrows.length;
var aHidden = getHiddenColumns();
ATpopup = document.createElement("div"); = "position: absolute; visibility: hidden; padding: 0; font-family: Arial; background-color: rgba(255, 255, 255, 0.9); border-radius: .5em; text-align: center; box-shadow: .05em .05em .5em #00C;";
ATpopup.innerHTML = "<a href='sort' title='sort' onclick='sortColumn(); return false'><img border=0 src='' style='padding-top: 0.2em;'></a><br><a href='hide' style='color: #C00; font-family: monospace; font-size: 1.5em; text-decoration: none;' title='hide' onclick='hideColumn(); return false'>x</a>"; // TODO - use protocol-less URL for img
pmeenan / user-timing-rum.js
Last active Jul 8, 2019
Support routine for adding W3C user timing events to a site. Includes some basic polyfill support for browsers that don't support user timing or navigation timing (though the start time for non-navigation timing support could be improved with IE < 9 to use IE's custom start event).
View user-timing-rum.js
// Support routines for automatically reporting user timing for common analytics platforms
// Currently supports Google Analytics, Boomerang and SOASTA mPulse
// In the case of boomerang, you will need to map the event names you want reported
// to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable:
// rumMapping = {'aft': 'custom0'};
(function() {
var wtt = function(n, t, b) {
t = Math.round(t);
if (t >= 0 && t < 3600000) {
// Google Analytics
marcelduran / kbps.sql
Last active Dec 18, 2015
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…
View kbps.sql
SELECT client + ' (' + STRING(volume) + ')' AS client, mean, q_10th, q_25th, median, q_75th, q_90th, q_95th, q_99th
'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,
import json
import urllib
import urllib2
import time
""" Nike plus activity log
-- May --
sergejmueller / .htaccess
Last active Apr 5, 2017
Apache: Detecting WebP support with Header Vary Accept
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
louismullie / textrank-sentence.rb
Last active Dec 14, 2015
An implementation of the TextRank algorithm for extractive summarization using Treat + GraphRank. Uses the number of non-stop-words with a common stem as a similarity metric between sentences.
View textrank-sentence.rb
require 'graph-rank'
require 'treat'
# Implements the PageRank algorithm for
# unsupervised extractive summarization.
# Reference: R. Mihalcea and P. Tarau, “TextRank:
# Bringing Order into Texts,” in Proceedings of
# EMNLP 2004. Association for Computational
# Linguistics, 2004, pp. 404–411.
You can’t perform that action at this time.