Skip to content

Instantly share code, notes, and snippets.

file ssimulacra mean_opinion_score
i01_10_1.bmp 0.03280812 5.97297
i01_10_2.bmp 0.05361108 5.94595
i01_10_3.bmp 0.10545110 4.91667
i01_10_4.bmp 0.20741088 3.21622
i01_10_5.bmp 0.32883978 2.08108
i02_10_1.bmp 0.04410916 6.00000
i02_10_2.bmp 0.06837454 5.97222
i02_10_3.bmp 0.12411026 5.43243
i02_10_4.bmp 0.22185609 3.50000
We can't make this file beautiful and searchable because it's too large.
"RegionID","RegionName","City","State","Metro","CountyName","SizeRank","1996-04","1996-05","1996-06","1996-07","1996-08","1996-09","1996-10","1996-11","1996-12","1997-01","1997-02","1997-03","1997-04","1997-05","1997-06","1997-07","1997-08","1997-09","1997-10","1997-11","1997-12","1998-01","1998-02","1998-03","1998-04","1998-05","1998-06","1998-07","1998-08","1998-09","1998-10","1998-11","1998-12","1999-01","1999-02","1999-03","1999-04","1999-05","1999-06","1999-07","1999-08","1999-09","1999-10","1999-11","1999-12","2000-01","2000-02","2000-03","2000-04","2000-05","2000-06","2000-07","2000-08","2000-09","2000-10","2000-11","2000-12","2001-01","2001-02","2001-03","2001-04","2001-05","2001-06","2001-07","2001-08","2001-09","2001-10","2001-11","2001-12","2002-01","2002-02","2002-03","2002-04","2002-05","2002-06","2002-07","2002-08","2002-09","2002-10","2002-11","2002-12","2003-01","2003-02","2003-03","2003-04","2003-05","2003-06","2003-07","2003-08","2003-09","2003-10","2003-11","2003-12","2004-01","2004-02","20
@eeeps
eeeps / random-white-elephant-assigner.rb
Last active December 12, 2019 22:06
Pairs people up and emails them with their pair
require 'net/smtp'
people = [ {
:name => "Eric Portis",
:email => "eric@cloudinary.com",
:address => "1812 Obstruction Pass Rd, Olga, WA 98279"
},
{
:name => "Mr Worldwide",
:email => "mrworldwide@pitbull.party",
@eeeps
eeeps / origin-policy-feature-policy-ch
Created March 3, 2020 00:36
An Origin Policy that opts into sending Client Hints to the first and a third party, origin-wide.
// drop this JSON into `/.well-known/origin-policy`
{
"ids": ["policy-1"],
"features": {
"policy": "ch-dpr https://res.cloudinary.com 'self';
ch-width https://res.cloudinary.com 'self';
ch-viewport-width https://res.cloudinary.com 'self'"
}
}
@eeeps
eeeps / roundToEvenIfEquidistant.js
Created July 29, 2021 18:40
roundToEvenIfEquidistant.js
function roundToEvenIfEquidistant( float ) {
// equidistant case
if ( Math.ceil( float ) - float === float - Math.floor( float ) ) {
if ( Math.ceil( float ) % 2 === 0 ) { // if ceil is even
return Math.ceil( float );
} else {
return Math.floor( float );
}
} else {
// non-equidistant
const uas = [
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36",
"Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Mobile Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0",
"Mozilla/5.0 (Android 10; Mobile; rv:100.0) Gecko/100.0 Firefox/100.0",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15",
"Mozilla/5.0 (iPhone; CPU iPhone OS 15_3 like Mac OS X) AppleWebKit/604.1 (KHTML, like Gecko) Version/15.2 Mobile/15E148 Safari/604.1"
]

Four examples (all uncredentialed requests):

Let’s say image.com is varying responses based on Accept. Permissive CORS/CORP might allow embedder.com to detect whether the user is sending a different Accept to it vs image.com. If embeder.com has some understanding of image.com’s delivery logic, it also allows embedder.com to tell something about the Accept value that was sent to image.com. That seems… innocuous? ACAO:* and CORP:cross-origin are probably OK here. But I’m not 100% sure.

Now, let’s say image.com is doing some kind of A/B test, and sending different responses randomly based on IP. That (+ read permissions) allows embedder.com to determine whether or not it got a different IP address from the user than image.com. This feels worse to me than the first case… like it could work against privacy protections the user is trying to employ against embedder.com. IPs are more unique than Accept, so, especially with lots of A/B buckets, this feels like maybe a fingerprinting risk. Also IP is tied t

CREATE TEMPORARY FUNCTION getImageDensity(payload STRING)
RETURNS ARRAY<STRUCT<clientWidth INT64, approximateResourceWidth INT64, d FLOAT64>>
LANGUAGE js AS '''
try {
var $ = JSON.parse(payload);
var responsiveImages = JSON.parse($._responsive_images);
responsiveImages = responsiveImages['responsive-images'];
return responsiveImages.map(({approximateResourceWidth, clientWidth}) => ({
approximateResourceWidth: parseInt(approximateResourceWidth) || 0,
clientWidth: parseInt(clientWidth) || 0,
@eeeps
eeeps / loaded-vs-painted-pixels.sql
Created October 20, 2022 14:30
Loaded vs painted image pixels on websites. Charted here: https://observablehq.com/d/8f52adeae83108a5
#standardSQL
# pixels loaded and painted
CREATE TEMPORARY FUNCTION getPixels(responsiveImagesJsonString STRING)
RETURNS STRUCT<loadedImagePixels BIGNUMERIC, paintedCssPixels BIGNUMERIC>
LANGUAGE js AS '''
const parsed = JSON.parse( responsiveImagesJsonString );
if ( parsed && parsed.map ) {
return parsed
@eeeps
eeeps / loaded-vs-painted-pixels-per-image.sql
Created October 25, 2022 23:51
Loaded vs painted image pixels on websites. Charted here: https://observablehq.com/d/518f7de822daa05a
#standardSQL
# pixels loaded and painted
CREATE TEMPORARY FUNCTION getPixels(responsiveImagesJsonString STRING)
RETURNS ARRAY<STRUCT<loadedImagePixels INT64, paintedCssPixels INT64>>
LANGUAGE js AS '''
const parsed = JSON.parse( responsiveImagesJsonString );
if ( parsed && parsed.map ) {
return parsed
.map( d => ({