Skip to content

Instantly share code, notes, and snippets.

#! /usr/bin/env ruby
require 'open-uri'
require 'uri'
require 'readline'
require 'simpleidn'
require 'addressable/uri'
require 'mechanize'
def to_ascii_uri(uri)
u = Addressable::URI.parse(uri)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am whym on github.
  • I am whym (https://keybase.io/whym) on keybase.
  • I have a public key whose fingerprint is 71ED 8B72 5D74 1728 CEEE 9039 4EAE 5013 CC61 F931

To claim this, I am signing this object:

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
import oursql
import os
sys.path.append(os.environ['PWB'])
from scripts import interwiki
import pywikibot
@whym
whym / .description
Last active August 29, 2015 14:03
whoisa gateway
Whois gateway https://gist.github.com/whym/3f8ea6fdf345fc457449
def format_isodate(x):
from datetime import datetime
return datetime.strftime(x, '%Y-%m-%dT%H:%M:%SZ')
def parse_wikidate(x):
from datetime import datetime
return datetime.strptime(x, '%Y%m%d%H%M%S')
def connect(db):
diff --git a/includes/specials/SpecialAllpages.php b/includes/specials/SpecialAllpages.php
index 0f8b255..42dd40e 100644
--- a/includes/specials/SpecialAllpages.php
+++ b/includes/specials/SpecialAllpages.php
@@ -84,6 +84,7 @@ class SpecialAllpages extends IncludableSpecialPage {
$to = $request->getVal( 'to', null );
$namespace = $request->getInt( 'namespace' );
$hideredirects = $request->getBool( 'hideredirects', false );
+ $usesortkey = $request->getBool( 'usesortkey', false );
@whym
whym / chart_parser.py
Created April 21, 2012 13:03
Full parsing with chart parser: Given a tokenized input sentence and a set of grammar rules, parse() generates all possible trees.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Full parsing with chart parser:
# Given a tokenized input sentence and a set of grammar rules,
# parse() generates all possible trees.
from collections import defaultdict
from Queue import Queue
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# extract shortest pages (for MediaWiki/Wikimedia)
import oursql
import os
import argparse
import sys
import csv
@whym
whym / format.py
Created March 12, 2012 11:46
extract shortest pages (for MediaWiki/Wikimedia)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import fileinput
import sys
import json
import urllib2
import argparse
from datetime import datetime