Skip to content

Instantly share code, notes, and snippets.

View jdlrobson's full-sized avatar

Jon Robson jdlrobson

View GitHub Profile
@jdlrobson
jdlrobson / pixies.py
Last active February 20, 2019 19:35
#!/usr/bin/env python
'''
Copyright [2017] [Jon Robson]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@jdlrobson
jdlrobson / anythingtrending.js
Last active December 13, 2016 19:48
anythingtrending.js
var fetch = require('node-fetch');
function trending() {
console.log('Q:Anything trending?');
fetch('https://en.wikipedia.org/api/rest_v1/feed/trending/edits' )
.then( (d) => d.json() )
.then( (j) => {
var nope = true;
j.pages.forEach((p) => {
if ( p.trendiness > 0 ) {
@jdlrobson
jdlrobson / reading-web-trending-simulator.js
Last active February 1, 2017 22:28
Simulate events for the reading web trending service
[[File:Flag of Iceland.svg]]
Images are nichhe!!!sssssssddzzsssxhs
[[Foo]] [[Yuk]]
hjhhsaasa
[[Bar]] [[f]]
== Yo ==
[[File:Bolungarvik 02.jpg|thumb|left|''Ósvör'', a replica of an old fishing outpost outside [[Bolungarvík]]]]
@jdlrobson
jdlrobson / BROWSER_TESTS.md
Last active November 10, 2016 11:31
Explanation of how to run the

You can easily set up an instance of Weekipedia for this purpose on heroku.

Configure your instance of Weekipedia like so:

export DEV_DUMMY_USER=
export HOST_SUFFIX=.beta.wmflabs.org
export SERVER_SIDE_RENDERING=1
export SITE_PRIVACY_URL=//wikimediafoundation.org/wiki/Privacy_policy
export SITE_EXPAND_ARTICLE=1
export SITE_EXPAND_SECTIONS=0
@jdlrobson
jdlrobson / README.txt
Created June 22, 2016 23:58
Query all main pages belonging to a Wikimedia project to see if they are special casing the main page
Usage:
> node index.js 'meta.wikimedia.org' 1
> node index.js 'wikipedia.org'
{
"ResourceModules": {
"joaquin.js": {
"scripts": "joaquin.js"
},
"jon.js": {
"scripts": "jon.js"
},
"baha.js": {
"scripts": "baha.js"
@jdlrobson
jdlrobson / analyseThis.py
Last active February 16, 2019 14:14
Analyse SQL dumps of raw EventLogging NavigationTiming data for median and p95 percentile
import numpy as np
import csv
import json
import sys
import datetime
def get_data( filename, from_ts, to_ts, metric, wiki=None, http2=None, anon=None, lazy = None ):
sample = []
f = open( filename )
delim = '\t'
@jdlrobson
jdlrobson / profile_getText.php
Created March 10, 2016 22:52
profile_getText.php
<?php
require_once( '../../includes/libs/ReplacementArray.php' );
require_once( '../../includes/HtmlFormatter.php' );
function wfIsWindows () { return false; };
require_once( 'includes/MobileFormatter.php' );
const NUMBER_RUNS = 100;
$filenames = array(
var fetch = require('node-fetch');
var io = require( 'socket.io-client' );
var titles = {};
var pageImages = {};
var alternativePageImageAvailable = {};
var interval;
var socket = io.connect('stream.wikimedia.org/rc');
var param = require('node-jquery-param');
var args = process.argv.slice(2);
var fs = require('fs');