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
def runInThread(fn, *args, **kw): | |
"""Execute fn(*args, **kw) in a new thread context and return the result. | |
The execution is synchronous, i.e. blocking. | |
Typical use cases for runInThread will be the inspection of side effects | |
that are normally invisible to other threads until you commit a transaction | |
or something like that. | |
""" | |
# Aargh! Why can't threading.Thread(target=fn).join() return the result of |
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 signal | |
import sys | |
from functools import contextmanager | |
@contextmanager | |
def timeout(p, seconds): | |
"""Kill subprocess ``p`` if the with block times out. | |
Usage example :: |
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
# check for screen sessions | |
if [ -d /var/run/screen/S-$USER/ ]; then | |
n=$(find /var/run/screen/S-$USER/ -type p|wc -l) | |
if [ $n -gt 0 ]; then | |
test x"$TERM" = xscreen && test -n "$WINDOW" \ | |
&& echo "You have $n active screen sessions (and this is one of them)." \ | |
|| echo "You have $n active screen sessions." | |
fi | |
fi |
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
--- bitten/notify.py.orig 2010-10-21 00:00:00.000000000 -0400 | |
+++ bitten/notify.py 2012-05-22 12:41:56.088838001 -0400 | |
@@ -27,6 +27,10 @@ | |
'notify_on_successful_build', 'false', | |
"""Notify if bitten build succeeds.""") | |
+ notify_on_success_after_failure = BoolOption('notification', | |
+ 'notify_on_successful_build_after_failure', 'false', | |
+ '''Notify if bitten build succeeds after a build failed.''') | |
+ |
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/sh | |
# Check out one of Zope 3 subversion projects | |
USAGE="Usage: $0 [--git] [-b branchname] [-n|--dry-run] projectname [directory]" | |
BASEURL=svn+ssh://svn.zope.org/repos/main | |
project= | |
branch=trunk | |
dir= | |
git=0 | |
dry_run= | |
while true; do |
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 | |
""" | |
Produce a disk inventory for fridge: | |
- how many hard disks and how large | |
- how are they partitioned | |
- how are the RAID devices defined | |
- where are they mounted | |
- how much space is used and how much is free |
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
Ctrl+Shift+PageUp/Down reorder tabs (try #3, this one works and seems to be in the right place) | |
https://bugzilla.mozilla.org/show_bug.cgi?id=702960 | |
diff -r d2fbc67f69f5 browser/base/content/tabbrowser.xml | |
--- a/browser/base/content/tabbrowser.xml Fri Nov 30 13:51:45 2012 +0000 | |
+++ b/browser/base/content/tabbrowser.xml Mon Dec 03 14:35:29 2012 +0200 | |
@@ -2504,6 +2504,25 @@ | |
return; | |
} |
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 linecache | |
import traceback | |
import sys | |
import mako.template | |
def mako_error_handler(context, error): | |
"""Decorate tracebacks when Mako errors happen. | |
Evil hack: walk the traceback frames, find compiled Mako templates, | |
stuff their (transformed) source into linecache.cache. |
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
$ virtualenv /tmp/sandbox | |
... | |
$ /tmp/sandbox/bin/pip install mako | |
... | |
$ /tmp/sandbox/bin/python mako_tb.py | |
= Default traceback = |
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 | |
"""Check the MANIFEST.in file in a Python source package for completeness. | |
Here's the plan: | |
This script works by building a source distribution archive (by running | |
setup.py sdist), then checking the file list in the archive against the | |
file list in version control (Subversion, Git, Mercurial, Bazaar are | |
supported). | |
Since the first check can fail to catch missing MANIFEST.in entries when |