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
$ gcc --version | |
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) | |
$ pypy --version | |
Python 2.7.2 (341e1e3821ff, Jun 07 2012, 15:42:54) | |
[PyPy 1.9.0 with GCC 4.2.1] | |
$ hg log -b stm-thread-2 -l 2 |
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
{ | |
"metadata": { | |
"name": "nose experiment" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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
#!/usr/bin/env python | |
import os | |
import sys | |
from time import sleep | |
usable_files = ( | |
# Customize this as you see fit | |
'.py', | |
'.php', |
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
#!/usr/bin/python | |
import inspect | |
from functools import wraps | |
from collections import defaultdict | |
# This time, we'll avoid using a class to hold the namespace. We'll just use | |
# the class that the functions are being defined in. | |
# AS A BONUS | |
# This means that it works for module-level functions, not just methods! |
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
# Modeled after the idea used in dynamic language runtimes, where "expensive" mutable object transitions are cached, when you can safely assume that there will be a finite number of transitions. | |
# For example, on my iMac: | |
# $ python -m timeit -n 10000 -r 3 -s "from caching_frozenset import CachingFrozenset" "s = CachingFrozenset() | |
# for x in range(100): | |
# s = s.with_value(x)" | |
# 10000 loops, best of 3: 66.1 usec per loop | |
# $ python -m timeit -n 10000 -r 3 "s = frozenset() |
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
diff -r e90378882863 pypy/module/micronumpy/__init__.py | |
--- a/pypy/module/micronumpy/__init__.py Tue Mar 13 11:15:10 2012 -0700 | |
+++ b/pypy/module/micronumpy/__init__.py Tue Mar 13 12:08:16 2012 -0700 | |
@@ -98,6 +98,7 @@ | |
("rad2deg", "degrees"), | |
("reciprocal", "reciprocal"), | |
("sign", "sign"), | |
+ ("signbit", "signbit"), | |
("sin", "sin"), | |
("sinh", "sinh"), |
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
diff --git a/src/kill.c b/src/kill.c | |
index ad09321..b0fe633 100644 | |
--- a/src/kill.c | |
+++ b/src/kill.c | |
@@ -217,12 +217,29 @@ send_signals (int signum, char *const *argv) | |
return status; | |
} | |
+/* Send ALL THE SIGNALS to all the processes or process groups specified | |
+ by ARGV. Return a ridiculous exit status. */ |
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
// This one swaps OUT the tinyMCE editor in favour of the underlying textarea: | |
javascript:(function(){tinymce.editors[0].hide();jQuery('#wysiwygTextarea').show().removeClass('hidden').css({width:'100%',height:parseInt(jQuery('#main').css('height'))-100+"px"});})() | |
// This one puts the tinyMCE editor back in place, before you save: | |
javascript:(function(){jQuery('#wysiwygTextarea').hide().addClass('hidden');tinymce.editors[0].show();})() | |
// They should probably also disable/enable the "Save" button, so you don't accidentally try to save from the wrong view (your changes get backed out!). |
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
INCREMENTED_MAP = {'1': ('2', False), '0': ('1', False), '3': ('4', False), '2': ('3', False), '5': ('6', False), '4': ('5', False), '7': ('8', False), '6': ('7', False), '9': ('0', True), '8': ('9', False)} | |
# Can extend INCREMENTED_MAP with 'a': ('b', False), ... 'z': ('a', True) to get lowercase alphabetics, etc | |
def incremented(number): | |
return ''.join( | |
reversed( | |
reduce( | |
lambda (so_far, carry_in), (old_digit, (new_digit, carry_out)): | |
( | |
so_far + (new_digit if carry_in else old_digit,), |
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
#!/usr/bin/env python | |
import sys | |
import re | |
r = re.compile("(?P<subject>" + sys.argv[1] + ")") | |
for line in sys.stdin: | |
print r.sub("\x1B[1;32m\g<subject>\x1B[0m", line) |