Skip to content

Instantly share code, notes, and snippets.

@phuedx
phuedx / README.md
Last active June 28, 2024 05:49
Distraction-free YouTube

Distraction-free YouTube

Hide the distracting parts of YouTube!

Install directly with Stylus

@phuedx
phuedx / main.js
Created February 12, 2019 17:06
Toy MediaWiki EventLogging catter
const PORT = 8035;
const http = require('http');
const url = require('url');
const server = http.createServer((req, res) => {
const i = req.url.indexOf('?');
let rawEvent = req.url;
// The EventLogging client doesn't specify a name for the query parameter
@phuedx
phuedx / boogy.js
Last active August 11, 2017 10:14
MediaWiki experiment session generator!!1
(function () {
// ---
// EXPERIMENT DEFINITION
// ---
const experiment = {
enabled: true,
name: 'ext.Popups.instrumentation.eventLogging',
buckets: {
@phuedx
phuedx / InitialiseSettings.php
Last active May 3, 2017 18:02
Go Go Gadget Gadgets
<?php
// Generated by go_go_gadget_export.php.
'wgPopupsConflictingNavPopupsGadgetName' => [
'af' => 'popups',
'av' => 'popups',
'az' => 'popups',
'azb' => 'popups',
'be' => 'popups',
@phuedx
phuedx / Barack_Obama.js
Last active December 23, 2015 12:08
The sizes of Parsoid- and non-Parsoid-generated (very nearly almost all Cite-generated) element IDs on https://en.wikipedia.org/api/rest_v1/page/html/Barack_Obama.
// $ curl -so /dev/null https://en.wikipedia.org/api/rest_v1/page/html/Barack_Obama -w '%{size_download}'
var TOTAL_BYTES = 1582727;
function total_bytes_for_ids(ids) {
return ids.reduce(
// 5 additional bytes for the "id=''" string
(acc, id) => acc + id.length + 5,
0
);
}
@phuedx
phuedx / Feature-life-cycle.md
Last active January 11, 2020 22:53
Feature life cycle

Feature life cycle

Glossary

Patch: Developers submit a patch, sometimes with dependencies, to Gerrit. The patches are currently based off of the master branch and are merged to the master branch after they've been reviewed

Master: What gets deployed to production

Beta cluster: A test wiki that syncs the master branches of many extensions approximately every ten minutes, which is available at http://en.m.wikipedia.beta.wmflabs.org. The Release Engineering team run browser tests against the beta cluster every night

@phuedx
phuedx / wikigrok-aggregation-test.py
Last active August 29, 2015 14:17
Dumb WikiGrok claim aggregation script
import csv
import hashlib
raw_claims = open('claims.tsv', 'r')
claims = csv.DictReader(raw_claims, delimiter='\t')
aggregated_claims = {}
for claim in claims:
hash = hashlib.md5()
hash.update(claim['event_pageId'].encode('utf-8'))
@phuedx
phuedx / wikigrok.md
Last active August 29, 2015 14:16
Notes from pairing with @MaxSem on getting WikiGrok working on mediawiki-vagrant.

Before enabling the wikidata role and provisioning set refreshonly = false in the wikidata-populate-site-tables in /path/to/mediawiki-vagrant/puppet/modules/role/manifests/wikidata.pp to ensure that SiteMatrix is up to date.

vagrant enable-role wikidata && vagrant provision

Ensure that Wikidata has appeared in the SiteMatrix (http://en.wiki.local.wmftest.net:8080/wiki/Special:SiteMatrix).

vagrant provision doesn't notice schema updates so: vagrant ssh -- foreachwiki update.php --quick

Create a property, e.g. "instance of". Make sure that it has Data type: item.

@phuedx
phuedx / api.php
Created February 4, 2015 14:51
php DocThor.php --sourceDir=php-zmq zmq > api.php
<?php
/**
* zmq-API v@PACKAGE_VERSION@ Docs build by DocThor [2015-02-04]
* @package zmq
*/
/**
* @package zmq
*/
class ZMQ {
@phuedx
phuedx / MyAwesomeFeature.experiment
Last active August 29, 2015 14:10
Can we repurpose the Gherkin syntax to define simple experiments?
Experiment: version
Scenario:
Given the user is logged in
Then they should have a 70% chance of being "A"
And they should have a 30% chance of being "B"