#!/usr/bin/env python
# coding=utf-8
# <a class="btn btn-default pull-right" href=""><i class="fa fa-git"></i> Download the gist here!</a>
# Py2Md started as a little project to do the magical "self documenting code". After thinking about it, I realized self documenting code is great, but it's really not the point.
# Commenting code properly, if only better, is the point.
# This script evolved from me wanting to code better. I often look at other peoples code, or even old code I've written, and it takes me a few minutes to even figure out what each section is doing.
# This will hopefully solve that, not only by forcing me to comment code better, but to publish my code with decent comments.
# This script reads in a python file (either itself, or anything it's
# imported into) and converts the python file into a markdown file. It
View output
$ py3.3
default implementation:
my implementation:
$ py3.3
default implementation:
my implementation:
from collections import OrderedDict
from inspect import Parameter, signature
from itertools import chain, starmap
from operator import itemgetter
__all__ = ['namedtuple']
dict_property = property(lambda self: OrderedDict(zip(self._fields, self)),
doc='dictionary for instance variables (if defined)')

Keybase proof

I hereby claim:

  • I am gvx on github.
  • I am robinwell ( on keybase.
  • I have a public key whose fingerprint is 43E3 C73A 188A 844E 39F1 EEBA E429 16EB 3793 DA2D

To claim this, I am signing this object:

View classes.lua
return function(name)
local class = require(name)
local classmt = getmetatable(class)
if getmetatable(class) == nil then
local props = {unpack(class)}
for i = #class, 1, -1 do
class[i] = nil
local classmt = {}
local instancemt = {__index = class}
View Easy output
x x
x xxxx x
x x x x
x x x x
x xxxx x
x x
View gist:9765299
from random import choice
with open('/usr/share/dict/nederlands') as f:
words ='\n')
def get_random_pair():
w1 = choice(words)
w2 = choice(words)
return len(w1) + len(w2), w1, w2
class LinkedList:
next = None
val = None
def __init__(self, val):
self.val = val
def add(self, val):
if is None: = LinkedList(val)
View roundrect.lua
function, x, y, width, height, xround, yround)
local points = {}
local precision = (xround + yround) * .1
local tI, hP = table.insert, .5*math.pi
if xround > width*.5 then xround = width*.5 end
if yround > height*.5 then yround = height*.5 end
local X1, Y1, X2, Y2 = x + xround, y + yround, x + width - xround, y + height - yround
local sin, cos = math.sin, math.cos
for i = 0, precision do
local a = (i/precision-1)*hP
View gist:5696885
last = None
with open('index.txt') as f:
for line in f:
new = int(line.decode('utf-8').split('\t', 1)[0])
if last is not None:
if last - new > 1:
if last - new == 2:
print new + 1