Skip to content

Instantly share code, notes, and snippets.

View mahmoud's full-sized avatar
Back on the grid!

Mahmoud Hashemi mahmoud

Back on the grid!
View GitHub Profile
SELECT rc.rc_title,
rc.rc_cur_id,
rc.rc_namespace,
cl.cl_timestamp
FROM recentchanges as rc
INNER JOIN recentchanges AS rc_talk
ON rc.rc_title = rc_talk.rc_title
AND rc.rc_namespace = (rc_talk.rc_namespace - (rc_talk.rc_namespace % 2))
INNER JOIN categorylinks AS cl
ON rc_talk.rc_cur_id = cl.cl_from
@mahmoud
mahmoud / another.sql
Last active August 29, 2015 14:24 — forked from slaporte/another.sql
SELECT rc.rc_id,
rc.rc_cur_id,
rc.rc_title,
rc.rc_timestamp,
rc.rc_this_oldid,
rc.rc_last_oldid,
rc.rc_user_text,
rc.rc_old_len,
rc.rc_new_len,
rc.rc_comment
Wikipedia+IFTTT traffic as of 8/1/2015: 9,100,671 requests served
* add social search record count
* change hashtag job to run more frequently
* change hashtag job to only pull since the last found hashtag (or 24 hours)
* GeoSearch continuation followup
* GeoSearch trigger strategy
* Daily email update (MZMC)
* Weeklypedia translations
* Weeklypedia stats RSS
@mahmoud
mahmoud / git_changelog.py
Last active August 29, 2015 14:27
Generates CHANGELOG boilerplate off of git tags and commit messages. Output is Markdown and ReST compatible. Unless you're VERY good with commit messages the output is still intended to be manually edited.
#!/usr/bin/python
import shlex
import subprocess
import bisect
from collections import namedtuple
import itertools
import textwrap
from argparse import ArgumentParser
function nextID($id) {
$avail_chars = $this->config->item('link_id_chars'); //a string, no dupe chars plz.
if($id === '') {
return $avail_chars[0];
} else if($id[strlen($id)-1] === $avail_chars[strlen($avail_chars)-1]) {
return $this->nextID(substr($id, 0, -1)).$avail_chars[0];
} else {
return substr($id, 0, -1).$avail_chars[strrpos($avail_chars,$id[strlen($id)-1])+1];
}
}
@mahmoud
mahmoud / remap.py
Last active September 17, 2015 19:39
see iterutils.remap under github.com/mahmoud/boltons
Importer.py
/ftp/public
Traceback (most recent call last):
File "Importer.py", line 65, in <module>
importer.import_path(path)
File "Importer.py", line 56, in import_path
self.import_path(os.path.join(path,entry))
File "Importer.py", line 56, in import_path
self.import_path(os.path.join(path,entry))
File "Importer.py", line 56, in import_path
@mahmoud
mahmoud / gist:1044311
Created June 24, 2011 06:11
python dict destruction
import random
PyDict_MINSIZE = 8 # from dictobject.h
class DictDestroyer(object):
def __init__(self):
self.hash = 1
def __hash__(self):
self.hash = random.randint(0, 2**31)
return self.hash
@mahmoud
mahmoud / vbscript_list_min.vbs
Created July 18, 2011 06:44
VBScript List creation and Min findin'
(for fixed sized inputs, so not terribly useful. It's VBScript, so also not terribly useful. Also, haven't run this.)
Dim myArray(4)
myArray(0) = A
myArray(1) = B
myArray(2) = C
myArray(3) = D
myArray(4) = E
Function MinN( vals )