This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use CirrusSearch\Connection; | |
| use CirrusSearch\Updater; | |
| use ConfigFactory; | |
| $config = ConfigFactory::getDefaultInstance()->makeConfig( 'CirrusSearch' ); | |
| $connection = Connection::getPool( $config ); | |
| $updater = new Updater( $connection, array() ); | |
| $dbr = wfGetDB( DB_SLAVE ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| Iterate enwiki talk pages which embed Template:WPBannerMeta and extract | |
| article quality assessments. | |
| """ | |
| import re | |
| import requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| appendfilename tools-redis-01-6379.aof | |
| auto-aof-rewrite-min-size 512mb | |
| client-output-buffer-limit slave 512mb 200mb 60 | |
| dbfilename tools-redis-01-6379.rdb | |
| dir /srv/redis | |
| logfile /var/log/redis/redis.log | |
| maxmemory 12GB | |
| maxmemory-policy allkeys-lru | |
| maxmemory-samples 5 | |
| no-appendfsync-on-rewrite yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Buffer( callback ) { | |
| var queue = [], timer = null; | |
| return { | |
| push: function ( item ) { | |
| queue.push( item ); | |
| timer = timer || setTimeout( function () { | |
| timer = null; | |
| callback( queue ); | |
| queue = []; | |
| }, 0 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| return array( | |
| "__global:acronym" => "0 http://www.acronymfinder.com/af-query.asp?String=exact&Acronym=$1", | |
| "__global:advisory" => "1 //advisory.wikimedia.org/wiki/$1", | |
| "__global:advogato" => "0 http://www.advogato.org/$1", | |
| "__global:aew" => "0 http://wiki.arabeyes.org/$1", | |
| "__global:appropedia" => "0 http://www.appropedia.org/$1", | |
| "__global:aquariumwiki" => "0 http://www.theaquariumwiki.com/$1", | |
| "__global:arborwiki" => "0 https://localwiki.org/ann-arbor/$1", | |
| "__global:arxiv" => "0 http://arxiv.org/abs/$1", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import json | |
| cookies = {'GerritAccount': 'xxx'} | |
| headers = {'X-Gerrit-Auth': 'xxx'} | |
| r = requests.get('https://gerrit.wikimedia.org/r/groups/', cookies=cookies, headers=headers) | |
| groups = json.loads(r.text[5:]) | |
| for name, params in groups.items(): | |
| if params.get('owner') == 'Project and Group Creators': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once __DIR__ . '/PSquare.php'; | |
| // words.txt contains "The frequency of occurrence of unique words in the novel | |
| // Moby Dick by Herman Melville." from http://tuvalu.santafe.edu/~aaronc/powerlaws/data.htm | |
| $words = array_map( 'intval', file( 'words.txt' ) ); | |
| $start = microtime( true ); | |
| $ps = new \RunningStat\PSquare( 0.90 ); | |
| foreach ( $words as $freq ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --[[ | |
| ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php. | |
| Example: | |
| ProFi = require 'ProFi' | |
| ProFi:start() | |
| some_function() | |
| another_function() | |
| coroutine.resume( some_coroutine ) | |
| ProFi:stop() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import print_function | |
| """ | |
| Utilities for 256 color support in terminals. | |
| Adapted from: | |
| http://stackoverflow.com/questions/1403353/256-color-terminal-library-for-ruby | |
| The color palette is indexed as follows: | |
| 0-15: System colors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This one doesn't work | |
| # | |
| # | |
| # 2015/10/13 18:23:41 [I] Ldap User Info: (*login.ldapUserInfo)(0xc2080470a0)({ | |
| # DN: (string) (len=37) "uid=ori,ou=people,dc=wikimedia,dc=org", | |
| # FirstName: (string) "", | |
| # LastName: (string) (len=10) "Ori.livneh", | |
| # Username: (string) (len=10) "Ori.livneh", | |
| # Email: (string) (len=20) "ori.livneh@gmail.com", | |
| # MemberOf: ([]string) { |