Skip to content

Instantly share code, notes, and snippets.

View legoktm's full-sized avatar

Kunal Mehta legoktm

View GitHub Profile
$ cat ~/.config/beets/config.yaml
# Automatically migrated from legacy .beetsconfig.
directory: ~/Music
plugins: lyrics embedart fetchart ftInTitle mbcollection web
import:
move: true
acoustid:
import pywikibot
import sys
template = """{{catmore|Wikipedia:Authority control}}
{{Wikipedia category}}
"""
main_cat = """[[Category:Pages with authority control information|{0}]]"""
hidden = """{{catmore|Wikipedia:Authority control}}
@legoktm
legoktm / BLANK_ALL_THE_MESSAGES.py
Last active December 30, 2015 05:19
This will probably work.
#!/usr/bin/python
# Public domain
import wikitools
username = 'Legoktm'
password = 'hunter2'
messages = ['Signupstart', 'Signupend']
reason = '...'
def matrix(wiki):
#!/usr/bin/env python
# Authors: Legoktm, Betacommand
# License: MIT License
import datetime
import functools
import logging
import mwparserfromhell
import pywikibot
@legoktm
legoktm / dal.py
Created September 29, 2013 06:37
import requests
import re
regex=re.compile('<em>(\d*?) members total,')
with open('dalpass') as f:
adminpass = f.read()
s = requests.Session()
d = {'adminpw': adminpass, 'admlogin': 'Let me in...'}
s.post('https://lists.wikimedia.org/mailman/admin/daily-article-l/', data=d)
#!/usr/bin/env python
"""
Copyright (C) 2013 Legoktm
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
@legoktm
legoktm / sj_test.py
Created June 25, 2013 22:03
Simple script testing simplejson vs json.
import time
def test(mod):
t= time.time()
d = {}
c = 0
while c < 10000:
d[c+1] = c
f= mod.dumps(d)
mod.loads(f)
@legoktm
legoktm / setup.py
Created June 21, 2013 01:53
A fake setup.py for pywikibot
from setuptools import setup, find_packages
setup(name='Pywikipediabot',
version='2.0alpha',
description='Python Wikipedia Bot Framework',
license='MIT',
packages=find_packages(),
install_requires=['httplib2>=0.6.0'],
test_suite="tests",
)
@legoktm
legoktm / user-config.py
Created June 21, 2013 01:49
A sample user-config.py that can be used when running unittests and such.
lang = "en"
family = "wikipedia"
usernames['wikipedia']['en'] = u'Legobot'
@legoktm
legoktm / fix_hazardbot.py
Created June 2, 2013 06:44
An example mass-rollback script used to fix errors caused by Hazard-Bot
#!/usr/bin/env python
"""
Released into the public domain by Legoktm, 2013
"""
import pywikibot
from pywikibot import config
config.usernames['wikipedia']['en'] = 'Legoktm'
from pywikibot.data import api