View boilerplate.html
body { margin: 0; }
canvas { width: 100%; height: 100% }
<script src=''></script>
<script src=''></script>
import cv2, sys
vidcap = cv2.VideoCapture(sys.argv[1])
success,image =
count = 0
success = True
while success:
success, image =
print(' * writing frame', count)
cv2.imwrite('frame-' + str(count) + '.jpg', image)

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.


Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
# gzip a text file
gzip -9 data.json
# remove the gzip file extension
mv data.json.gz data.json
# upload to s3
aws s3 cp data.json s3://bucket/data.json --acl public-read --content-type application/json --content-encoding gzip --metadata-directive REPLACE
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
View no-style.js
from __future__ import division
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.feature_extraction.text import TfidfVectorizer
from collections import defaultdict
from sklearn import decomposition
import sys, glob, json, codecs, os
import numpy as np
def read_file(path):
with, 'r', 'utf8') as f: