Skip to content

Instantly share code, notes, and snippets.

Sam Smith phuedx

  • Bournemouth, United Kingdom
Block or report user

Report or block phuedx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@phuedx
phuedx / main.js
Created Feb 12, 2019
Toy MediaWiki EventLogging catter
View main.js
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 Aug 11, 2017
MediaWiki experiment session generator!!1
View boogy.js
(function () {
// ---
// EXPERIMENT DEFINITION
// ---
const experiment = {
enabled: true,
name: 'ext.Popups.instrumentation.eventLogging',
buckets: {
@phuedx
phuedx / InitialiseSettings.php
Last active May 3, 2017
Go Go Gadget Gadgets
View InitialiseSettings.php
<?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 Dec 23, 2015
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.
View Barack_Obama.js
// $ 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 Jan 11, 2020
Feature life cycle
View Feature-life-cycle.md

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 Aug 29, 2015
Dumb WikiGrok claim aggregation script
View wikigrok-aggregation-test.py
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 Aug 29, 2015
Notes from pairing with @MaxSem on getting WikiGrok working on mediawiki-vagrant.
View wikigrok.md

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 Feb 4, 2015
php DocThor.php --sourceDir=php-zmq zmq > api.php
View 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 Aug 29, 2015
Can we repurpose the Gherkin syntax to define simple experiments?
View MyAwesomeFeature.experiment
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"
@phuedx
phuedx / effective_tld_names.dat
Created Nov 5, 2014
Find the highest level part of the host that isn't a public suffix as listed at https://publicsuffix.org
View effective_tld_names.dat
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// ===BEGIN ICANN DOMAINS===
// ac : http://en.wikipedia.org/wiki/.ac
ac
com.ac
edu.ac
You can’t perform that action at this time.