Skip to content

Instantly share code, notes, and snippets.

View gregglind's full-sized avatar

Gregg Lind gregglind

View GitHub Profile
@gregglind
gregglind / pyright_397_dict_arg.py
Created March 19, 2025 20:05
Demonstration of a confusion change between Pyright 1.1.396 and 1.1.397
# pyright: strict
"""
uv run --with "pyright==1.1.396" pyright -> No errors
uv run --with "pyright==1.1.397 --> 3 errors, 0 warnings, 0 informations
Code changes: https://github.com/microsoft/pyright/compare/1.1.396...1.1.397
"""
@gregglind
gregglind / pydantic_freezing_instance_workaround.py
Created February 26, 2025 22:04
Pydantic: Freezing an instance workaround
from pydantic import BaseModel
from typing import Any
class UnfrozenThing(BaseModel):
model_config = {"extra": "allow", "validate_assignment": True}
f: str | None = None
def model_post_init(self, __context: Any) -> None:
self.f = 'a'
self.model_config
@gregglind
gregglind / dns.txt
Last active March 24, 2022 19:16
Walking Shadow DNS Gist, as seen by DYN
# Dig (dns lookup has both going to the same place
# traceroute has both going to the same place.
❯ dig +noall +answer +multiline @216.146.35.35 walkingshadow.org any
walkingshadow.org. 3600 IN A 66.96.163.129
walkingshadow.org. 1800 IN MX 10 ASPMX2.GOOGLEMAIL.COM.
walkingshadow.org. 1800 IN MX 10 ASPMX3.GOOGLEMAIL.COM.
walkingshadow.org. 1800 IN MX 1 ASPMX.L.GOOGLE.COM.
walkingshadow.org. 1800 IN MX 5 ALT1.ASPMX.L.GOOGLE.COM.
@gregglind
gregglind / NextflixPartyExtensionPrivacyAnalysis.md
Created March 23, 2020 15:13
Netflix Party Extension Privacy Analysis

Analysis of Netflix Party Chrome Extension

Bottom line.

You should trust the Netflix Party Chrome Extension as much as you trust a random programmer in Philadelphia [1][Sharya], who hosts the NextflixParty.com site.

Details

What is Nextflix Party Chrome Extension?

--
-- General Filter for 'seen today' for all Study and Shield addons
--
--
require "cjson"
require "hyperloglog"
require "string"
Name: Shield Study 13 - Net Neutrality
Type: show-heartbeat
{ engagementButtonLabel: 'Get it now',
includeTelemetryUUID: true,
learnMoreMessage: 'Learn More',
learnMoreUrl: 'https://wiki.mozilla.org/Firefox/Shield/Shield_Studies',
message: 'Want to try something new in Firefox?',
postAnswerUrl: 'https://addons.mozilla.org/firefox/shield_study_13',
repeatOption: 'once',
Name: Shield Study 13 - Net Neutrality
Type: show-heartbeat
{ engagementButtonLabel: 'Get it now',
includeTelemetryUUID: true,
learnMoreMessage: 'Learn More',
learnMoreUrl: 'https://wiki.mozilla.org/Firefox/Shield/Shield_Studies',
message: 'Want to try something new in Firefox?',
postAnswerUrl: 'https://addons.mozilla.org/firefox/shield_study_13',
repeatOption: 'once',
@gregglind
gregglind / hackyStravaLapData.js
Created June 19, 2017 17:23
Getting Lap Data out of Strava
window.NodeList.prototype.map = Array.prototype.map;
function floatTime (s) { f=s.split(':').map(Number); return f[0] + f[1]/60}
console.log(document.querySelectorAll('.mile-splits tbody tr').map(node=>node.querySelector('td:nth-child(2)').firstChild.data).map(floatTime).join("\n"))
@gregglind
gregglind / bootstrap.js
Created April 26, 2017 20:07
A bootstrap file for a simple pref flip study helper addon
// https://github.com/gregglind/quantum-preference-telemetry-annotation-pretender/blob/master/index.js
const CID = Cu.import('resource://gre/modules/ClientID.jsm');
const { TelemetryController } = Cu.import('resource://gre/modules/TelemetryController.jsm');
const { TelemetryEnvironment } = Cu.import('resource://gre/modules/TelemetryEnvironment.jsm');
function generateTelemetryIdIfNeeded() {
let id = TelemetryController.clientID;
/* istanbul ignore next */
@gregglind
gregglind / promiseAll.josh.js
Created March 1, 2017 19:33
Promises, and loading the files
function waitUp(t) {
window.setTimeout(()=>console.log("waited", t),t)
}
waitUp.bind(null, 100)()
function loadAFile(url) {
return new Promise(function (resolve, reject){
// simulate unknown wait time