Skip to content

Instantly share code, notes, and snippets.

ntamas / urwid-trio-nursery.patch
Created Jan 7, 2020
Patch for urwid.TrioEventLoop to allow running it in an existing Trio event loop
View urwid-trio-nursery.patch
diff --git a/urwid/ b/urwid/
index cc7728f..f7c3f0a 100644
--- a/urwid/
+++ b/urwid/
@@ -30,15 +30,8 @@ class TrioEventLoop(EventLoop):
``trio`` is an async library for Python 3.5 and later.
- def __init__(self, nursery=None):
- """Constructor.

Keybase proof

I hereby claim:

  • I am ntamas on github.
  • I am ntamas ( on keybase.
  • I have a public key ASClM5botlxl4Q__0JMBdMM0fFqQAIxFMLAH00CCU0hffwo

To claim this, I am signing this object:

ntamas / underflow.txt
Created Sep 6, 2016
sample data that causes an underflow in plfit
View underflow.txt
ntamas /
Created Nov 19, 2013
Hierarchical link clustering algorithm of Ahn et al (see, implemented using Python and igraph for fun.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Hierarchical link clustering
:Author: Tamás Nepusz
This is an implementation of the hierarchical link clustering algorithm of Ahn
et al. The results provided by this implementation match those of the original
ntamas /
Last active Apr 15, 2020
Weighted sampling with replacement using Walker's alias method - NumPy version
#!/usr/bin/env python
from numpy import arange, array, bincount, ndarray, ones, where
from numpy.random import seed, random, randint
__author__ = "Tamas Nepusz, Denis Bzowy"
__version__ = "27jul2011"
class WalkerRandomSampling(object):
"""Walker's alias method for random objects with different probablities.
ntamas /
Created Feb 16, 2011
complementerset object for Python
class complementerset(object):
"""This object behaves more or less like a set, with one exception,
the membership checking. For a `complementerset` object, you can
define the elements which are *not* in the set, everything else is
contained in it. The semantics of the operators are the same as for
Usage example::
>>> s = complementerset()
ntamas / drop
Created Sep 22, 2010
Simple shell script to copy a file to a Dropbox public folder and get its URL. Needs socat and xclip.
View drop
# Simple shell script to copy a file to the Dropbox
# public folder and get its URL.
# The URL of the last file copied also stays on the
# X clipboard.
# Symlink the script as dropmv to move the file to the
# public folder instead of copying it.
ntamas /
Created Sep 13, 2010
Animation add-on for the Python interface of igraph
#!/usr/bin/env python
"""Classes to produce videos from igraph plots.
from __future__ import with_statement
from contextlib import contextmanager
from igraph.drawing import BoundingBox, Plot
from shutil import rmtree
```` adds the glorious sound of the vuvuzela to any
Python program.
Based on the excellent idea of Chris Williams. See also:
>>> import vuvuzela