Skip to content

Instantly share code, notes, and snippets.

Avatar

Ilya Grigorik igrigorik

View GitHub Profile
@igrigorik
igrigorik / json-bq-schema-generator.rb
Last active Nov 17, 2019
BigQuery JSON schema generator
View json-bq-schema-generator.rb
require 'open-uri'
require 'zlib'
require 'yajl'
# References
# - https://developers.google.com/bigquery/preparing-data-for-bigquery#dataformats
# - https://developers.google.com/bigquery/docs/data#nested
#
def type(t)
@igrigorik
igrigorik / micro-openssl-perf.sh
Created Dec 15, 2013
EC2 micro instance in EC2 West...
View micro-openssl-perf.sh
ubuntu@ip-10-202-152-39:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
stepping : 7
microcode : 0x70a
cpu MHz : 1799.999
cache size : 20480 KB
@igrigorik
igrigorik / 150ms-delay.txt
Last active Dec 29, 2015
sudo tcpdump -ttttt host www.amazon.com ...
View 150ms-delay.txt
# 150ms in/out delay
# ~ 300 ms to complete handshake, as expected
#
00:00:00.000000 IP igrigorik.57812 > 176.32.98.166.http: Flags [S], seq 2280359597, win 65535, options [mss 1460,nop,wscale 4,nop,nop,TS val 1261175917 ecr 0,sackOK,eol], length 0
00:00:00.094100 IP 176.32.98.166.http > igrigorik.57812: Flags [S.], seq 895108428, ack 2280359598, win 8190, options [mss 1460,nop,wscale 6], length 0
00:00:00.297209 IP igrigorik.57812 > 176.32.98.166.http: Flags [.], ack 1, win 16384, length 0
00:00:00.297224 IP igrigorik.57812 > 176.32.98.166.http: Flags [P.], seq 1:79, ack 1, win 16384, length 78
# ~100 ms response time + 300 ms RTT later...
@igrigorik
igrigorik / compare.rb
Created Nov 27, 2013
Testing various Deflate compression parameters...
View compare.rb
# Quick comparison of Deflate performance with respec to varios
# LZ77 window and memLevel settings. E.g...
#
# $> curl https://github.com/timeline.json -o timeline.json
# $> ruby compare.rb timeline.json
#
require "zlib"
unless file = ARGV[0]
View Gemfile
source 'https://rubygems.org'
gem 'goliath'
View connectionchange.js
class ConnectionInfo {
constructor(media="unknown",
className="unknown",
classId=0) {
this.media = media;
this.className = className;
this.classId = classId;
}
}
@igrigorik
igrigorik / github.bash
Last active Oct 17, 2020
Open GitHub URL for current directory/repo...
View github.bash
alias gh="open \`git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
@igrigorik
igrigorik / nginx.conf
Created Aug 29, 2013
CH + select best candidate based on defined buckets.
View nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
@igrigorik
igrigorik / nginx.conf
Last active Dec 21, 2015
CH + DPR negotiation example for Nginx.
View nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
You can’t perform that action at this time.