Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Nottingham mnot

View GitHub Profile
View cgmailstats.rb
require 'nokogumbo'
require 'date'
require 'json'
start = Date.today - 105
results = {}
index = 'http://www.w3.org/community/groups/'
groups = Nokogiri::HTML5.get(index)
groups = groups.search('a.h3').map {|a| a['href'].sub(/^#/, '')}
View keybase.md

Keybase proof

I hereby claim:

  • I am mnot on github.
  • I am mnot (https://keybase.io/mnot) on keybase.
  • I have a public key whose fingerprint is 1F25 A21D 3C2A 7F22 4C25 389F 4A67 D3E9 3BDE FDDE

To claim this, I am signing this object:

@mnot
mnot / fake_hdrs.py
Created Oct 24, 2014
Create some fake headers for HTTP/2 compression testing.
View fake_hdrs.py
#!/usr/bin/env python
from random import choice, sample, randrange
from string import lowercase
iterations = 10000
authorities = [
'www.foo.com',
'api1.backend.region.bar.com:8000',
@mnot
mnot / apple_pipeline
Last active Jun 29, 2017
Apple doing HTTP pipeline testing
View apple_pipeline
192.168.001.051.65156-023.015.188.224.00080: GET /configurations/pep/pipeline/pipeline0.html HTTP/1.1
Host: configuration.apple.com
Connection: Keep-Alive
GET /configurations/pep/pipeline/pipeline1.html HTTP/1.1
Host: configuration.apple.com
Connection: Keep-Alive
GET /configurations/pep/pipeline/pipeline2.html HTTP/1.1
Host: configuration.apple.com
@mnot
mnot / gist:9660370
Created Mar 20, 2014
HTTP:// over TLS proposal
View gist:9660370
<section anchor="opportunistic" title="Discovering TLS Support for http:// URIs">
<t>
A server wishing to advertise support for HTTP/2 over TLS for http:// URIs MAY do so by
including an Alt-Svc (see <xref target="AltSvc"/>) response header with the "h2" protocol
identifier.
</t>
<t>
For example, a HTTP/1 connection could indicate support for HTTP/2 on port 443 for use
with future http:// URI requests with this Alt-Svc header:
@mnot
mnot / github.sh
Created Mar 15, 2014
Git alias handler for github
View github.sh
#!/bin/sh
# Github Handler
#
# Add to your .gitconfig like this:
#
# [alias]
# hub = !"github"
@mnot
mnot / ietf_flying_times.js
Created Jun 4, 2013
Figure out how long it takes to get to a set of airports from a "home" location.
View ietf_flying_times.js
#!/usr/bin/env node
var argv = require('optimist').argv
var http = require('http');
var $ = require('jquery');
var ietf_airports = {
IETF_airports: [
@mnot
mnot / htlook.py
Last active Dec 16, 2015
Summarise how a list of HTTP servers handles a particular request to a set of URLs.
View htlook.py
"""
htlook.py
Summarise how a list of HTTP servers handles a particular request to a
set of URLs.
You can modify the request by either:
* Adding headers with the -a flag; e.g.,
@mnot
mnot / update.sh
Last active Jul 9, 2019
Update all projects in a directory from their master repositories.
View update.sh
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
for PROJECT in $DIR/*
do
if [ -d $PROJECT ] ; then
cd $PROJECT
# Git
@mnot
mnot / iri_to_uri.py
Created Jan 20, 2013
Convert an IRI to a URI
View iri_to_uri.py
import urllib
import urlparse
def iri_to_uri(iri, encoding='Latin-1'):
"Takes a Unicode string that can contain an IRI and emits a URI."
scheme, authority, path, query, frag = urlparse.urlsplit(iri)
scheme = scheme.encode(encoding)
if ":" in authority:
host, port = authority.split(":", 1)
authority = host.encode('idna') + ":%s" % port