This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
makeSearchCommand({ | |
name: "urban-dictionary", | |
author: {name: "Martijn Pieters", email: "[email protected]"}, | |
description: "Looks up definition in the Urban Dictionary", | |
icon: "http://www.urbandictionary.com/favicon.ico", | |
url:"http://www.urbandictionary.com/define.php?term={QUERY}", | |
preview: function(pblock, search) { | |
if (search.text.length < 1) { | |
$(pblock).html("Definition from the <b>Urban Dictionary</b>"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_decoratedFunctions = {} | |
class _AsyncSomething(object): | |
"""Async job decorator | |
Tracks decorated function via a global mapping instead of storing | |
the function directly to remain pickleable. | |
""" | |
_name = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bencode | |
import os | |
def toolong(torrent, max_, host=None): | |
decoded = bencode.bdecode(torrent) | |
if host is not None: | |
for url in decoded.get('announce-list', [decoded['announce']]): | |
if host in url: break | |
else: return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import operator | |
def mergeiter(*iterables): | |
"""Given a set of sorted iterables, yield the next value in merged order""" | |
iterables = [iter(it) for it in iterables] | |
iterables = {i: [next(it), i, it] for i, it in enumerate(iterables)} | |
while True: | |
value, i, it = min(iterables.values(), key=operator.itemgetter(0)) | |
yield value | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGZCAMAAACQbpc2AAADAFBMVEWEBz6FAD6FAD6GAD+MAEGOAEOKAEGOAEOGAD+IAECOAEOOAUOOAEOOAEOOAEOOAEOOAEOOAEOCACyOAEQAAACKAEJpoJ2KADqu0eSKAD2BAD+KAD6AxCNqwoX1Ziawo9LYnGuwhL7aiwaIyYudst6DlrnhcWvCcVvlbE9PvsL2u3uYmdCZum9Rns7clUYsreOYp2nuj37kiZLUfqhvxafqfmrNWEjA22uz1Vu6lsiRAArWhLfgdoONnF36rWrzpz/ajy/LbqR8pdWDVXx8faN6m0+6hE3+1pmHP2mTy1b4k1p/ueFlj7vMfzyBs1v/2GfLpFL5rQD+7teQABj4n0/rpCz6r1Z8apP+4rrfw1iV0JyLUkqQACTDnah5AACtaEt9zcGNhleJbU5lsOFRvE5FuOPS4WLSt7+8ajvXcJpcyNvhztSwUkTGgZz9uDSxRnPZwsnTkqy7jpsPt/AxyvnAeJMAxPnMiqPJYIyzf4/KqrPedaK5bIsQwfTo2t72hUepPWvn6mO8VoXrgbDRaJXle6r75FzZm7S2TnyTNUXv5eiDAA6j0WmKyWv51liRAACjP0OZNVuwa4L+uQAcw/SiNGH57mIxxPKmU3DgpL2sX3rutc3/vh9gu1D3tNEAtvOSKVAmxfagRmbnrcWZJVaTJET2qsv84eyk04PzcEb71OX0u9OUzHD1nsR+1PhtwFUBvfQ5x/RizvdQy/VZzPWaz3b8uST+wFWDABqKAC6m03uGx2X+xGKBxmL2iWDQjb777/Nt0Pf+xmlCyPT+v032hVv+yXD3lGx2wlr99/hJyvX1gFV20vf1e1DCaqr6xdz+wlzJe7T2jmWFACT3i7v+0IP9u0R8xF7Oh7r+zHn/+WLHc7CQGUP3vtePEUT0i7qHADORIUyEAC2BAACf0Hr3j73zhLX7x96RGkrMgbePFEiRDUeOA0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> a = [1, 2] | |
>>> a_multiply = [a] * 5 | |
>>> a_comp = [a for _ in range(5)] | |
>>> all(i is a for i in a_multiply) | |
True | |
>>> all(i is a for i in a_comp) | |
True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2014.02.01 19:20:29 GMT | |
# Embedded file name: /root/scsl.py | |
import socket | |
import threading | |
import select | |
import random | |
import sys | |
import time | |
import base64 | |
import subprocess |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User scores for the top 100 tags sorted on average per-answer score (users with 1000 or more answers only) | |
NAME TAG SCORE COUNT AVERAGE NORM WEIGHTED | |
1 CMS javascript 24985 1215 20.56 0.0314 38.1401 | |
2 Eric Lippert c# 44175 2571 17.18 0.0581 149.2803 | |
3 polygenelubricants java 12396 1024 12.11 0.0154 15.7527 | |
4 Mehrdad Afshari c# 11975 1018 11.76 0.0157 16.0231 | |
5 Johannes Schaub - litb c++ 21543 2002 10.76 0.0614 122.9951 | |
6 Dave DeLong objective-c 12198 1254 9.73 0.0555 69.6445 | |
7 Jon Skeet .net 47874 5065 9.45 0.2338 1184.0163 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bin/python test.py 4 1 | |
------------------------- | |
Configuration: | |
Number of elements to check against: 4 | |
Number of if statements: 1 | |
------------------------- | |
Concatenated boolean operators | |
0.1044412124203518 | |
List | |
0.06876948488876224 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: from random import randint | |
In [2]: lines = [randint(0, 42) for _ in range(10000)] | |
In [3]: %%timeit | |
...: for _ in lines[::-1]: pass | |
...: | |
10000 loops, best of 3: 149 µs per loop | |
In [4]: %%timeit |
OlderNewer