Skip to content

Instantly share code, notes, and snippets.

@konstantint
konstantint / paul_and_simon_sort.py
Created July 25, 2017 13:58
Paul and Simon Sort
# "Paul-and-Simon sort"
# http://fouryears.eu/2017/07/25/sorting-in-linear-time/
# http://www-wjp.cs.uni-saarland.de/publikationen/PS80.pdf
#
# Copyright 2017, Konstantin Tretyakov
# License: MIT
from math import log2, ceil
def paul_and_simon_sort(a):
# Recreational computational human bananology.
# Copyright (c) 2015, Konstantin Tretyakov
# http://fouryears.eu/2015/04/12/two-bananas-make-a-human/
# ------------------------ Imports and utility functions ---------------- #
import gzip
import csv
import urllib
from ucscgenome import Genome
from Bio import SeqIO
@konstantint
konstantint / gist:3952876
Created October 25, 2012 14:31
Python: UTF-8 encoding specifier
# -*- coding: utf-8 -*-
@konstantint
konstantint / gist:3914476
Created October 18, 2012 20:08
Buildout: Boilerplate buildout.cfg
[buildout]
# Egg names
project-eggs =
# my-module
# Egg directories
#develop =
# my-module
# Build parts (add develop eggs if needed)
@konstantint
konstantint / gist:3911953
Created October 18, 2012 13:50
Python: Namespace package __init__.py
# Namespace package
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
function LiveWatcher(watch_posts, watch_users) {
var self = this;
var _oldListener;
function newListener(d) {
var el = document.createElement('div');
el.innerHTML = JSON.parse(d.data).data;
var post_id = parseInt(el.childNodes[0].getAttribute("data-post_id"));
var user_login = el.childNodes[0].getAttribute("data-user_login");