Skip to content

Instantly share code, notes, and snippets.

View he7d3r's full-sized avatar

Helder Geovane Gomes de Lima he7d3r

View GitHub Profile
@he7d3r
he7d3r / WordsMatchingSalebotRules.py
Last active August 29, 2015 14:07
Prints out words (found in a dump.xml) which corresponds to some rule in a file.
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright © 2014 He7d3r
# License: http://he7d3r.mit-license.org/
"""
Prints out words (found in a dump.xml) which corresponds to some rule in a file.
Example:
python WordsMatchingSalebotRules.py salebot.txt words.txt dump1.xml dump2.xml
"""
@he7d3r
he7d3r / StemsToWords.py
Last active August 29, 2015 14:07
Prints out the frequency of the words (found in a dump.xml) which corresponds to each stem in a file
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright © 2014 He7d3r
# License: http://he7d3r.mit-license.org/
"""
Prints out words (found in a dump.xml) which corresponds to each stem in a file.
Example:
python StemsToWords.py stems.txt words.txt dump1.xml dump2.xml
"""
@he7d3r
he7d3r / BadWordsCounter.py
Last active August 29, 2015 14:07
Prints out badword stems found in a list of XML dumps (by number of removals)
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright © 2014 He7d3r
# License: http://he7d3r.mit-license.org/
"""
Prints out badword stems (by number of removals) in a dump.xml.
Example:
python BadWordsCounter.py bad.txt bad-stats.txt dump1.xml dump2.xml
"""
@he7d3r
he7d3r / SALEBOT-STATS.TXT
Last active August 29, 2015 14:07
Bad words from Salebot config on ptwiki (4 files: SALEBOT-STATS.TXT, SALEBOT-STEMS.TXT, SALEBOT-WORDS.TXT, SALEBOT.TXT)
# This list was generated like this:
# 1. Replace each regex by a list of words it matches (and its stems), limiting
# "infinite modifiers" such as "+", "*" and "{n,}" to just a few matches, using
# https://gist.github.com/he7d3r/34f332d0c0523a1bd438/f3805975fec2513f821f4286429998128171c6b2
#
# python invertSalebotRegexes.py SALEBOT.TXT SALEBOT-WORDS.TXT SALEBOT-STEMS.TXT
#
# 2. Remove stems which users never had to remove from pages. Detected by
# https://gist.github.com/he7d3r/f99482f4f54f97895ccb/9205f3271fe8daa2f694f4ce3ba9b29213dbad6c
#
@he7d3r
he7d3r / LanguageConverter.test.js
Created September 15, 2014 13:20
LanguageConverter tests
/**
* MediaWiki JavaScript library test suite
*
* Available on Special:BlankPage?action=lctest&debug=true
* @source Adapted from
* https://www.mediawiki.org/wiki/Special:Code/MediaWiki/87360
*/
/*jslint browser: true, white: true, evil: true, plusplus: true, vars: true, forin: true */
/*global jQuery, mediaWiki */
( function( mw, $ ) {
@he7d3r
he7d3r / DisableCodeEditorAutoPairing.js
Created September 15, 2014 13:07
Disable CodeEditor auto pairing
/*global jQuery, mediaWiki */
( function ( mw, $ ) {
'use strict';
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) === -1 ) {
return;
}
mw.hook( "codeEditor.configure" ).add( function( editorSession ) {
editorSession.setBehavioursEnabled( false );
@he7d3r
he7d3r / TemplateScript.test.js
Created September 15, 2014 13:06
QUnit tests for TemplateScript
/**
* QUnit tests for TemplateScript.js
*/
/*jslint browser: true, white: true*/
/*global jQuery, mediaWiki, QUnit */
( function ( $, mw /* , undefined */ ) {
'use strict';
function myTests(){
@he7d3r
he7d3r / conj-pt-er.js
Created September 4, 2014 14:19
JSON para "conj.pt.er"
// https://pt.wiktionary.org/wiki/Template:conj.pt
// https://pt.wiktionary.org/wiki/Template:conj.pt.er
// https://pt.wiktionary.org/wiki/Special:WhatLinksHere/Template:conj.pt?limit=500&namespace=10
/*var text = $('#wpTextbox1').val();
jsMsg( text.replace( /<noinclude>[\s\S]+?<\/noinclude>/g, '' ) );
$('#wpTextbox1').val().replace(/<noinclude>[\s\S]+?<\/noinclude>/g, '').match( /\{\{\s*conj\.pt\s*\|\s*título\s*=\s*([\s\S]+?)\s*\|\s*\{\{\{1\|?\}\}\}(.+?)\s*\|/ );