Skip to content

Instantly share code, notes, and snippets.

@ieure
ieure / tiling
Created March 17, 2009 16:52
Code to handle centering and tiling of Emacs frames
;; Functions to work with frames
(provide 'ime-frame)
(defun screen-usable-height (&optional display)
"Return the usable height of the display.
Some window-systems have portions of the screen which Emacs
cannot address. This function should return the height of the
screen, minus anything which is not usable."
ieure!neutron:~/Projects/Cassandra$ nosetests
EEEEEEEEFEFEFEFEFEFEFEFEEFEFEFEFEFEFE
======================================================================
ERROR: system.test_server.TestMutations.test_bad_calls
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/local/lib/python2.5/site-packages/nose/case.py", line 366, in tearDown
try_run(self.inst, ('teardown', 'tearDown'))
File "/opt/local/lib/python2.5/site-packages/nose/util.py", line 453, in try_run
return func()
ieure!neutron:~/Projects/Cassandra$ sh -x bin/cassandra -p cassandra.pid
+ '[' x = x ']'
++ dirname bin/cassandra
+ for include in /usr/share/cassandra/cassandra.in.sh /usr/local/share/cassandra/cassandra.in.sh /opt/cassandra/cassandra.in.sh '`dirname $0`/cassandra.in.sh'
+ '[' -r /usr/share/cassandra/cassandra.in.sh ']'
+ for include in /usr/share/cassandra/cassandra.in.sh /usr/local/share/cassandra/cassandra.in.sh /opt/cassandra/cassandra.in.sh '`dirname $0`/cassandra.in.sh'
+ '[' -r /usr/local/share/cassandra/cassandra.in.sh ']'
+ for include in /usr/share/cassandra/cassandra.in.sh /usr/local/share/cassandra/cassandra.in.sh /opt/cassandra/cassandra.in.sh '`dirname $0`/cassandra.in.sh'
+ '[' -r /opt/cassandra/cassandra.in.sh ']'
+ for include in /usr/share/cassandra/cassandra.in.sh /usr/local/share/cassandra/cassandra.in.sh /opt/cassandra/cassandra.in.sh '`dirname $0`/cassandra.in.sh'
.EEEEEEEEFEEEFEEEEEE.EEEEEEEEEEE
======================================================================
ERROR: system.test_server.TestMutations.test_batch_insert
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/local/lib/python2.5/site-packages/nose/case.py", line 182, in runTest
self.test(*self.arg)
File "/Users/ieure/Projects/cassandra-trunk/test/system/test_server.py", line 126, in test_batch_insert
_verify_batch()
File "/Users/ieure/Projects/cassandra-trunk/test/system/test_server.py", line 45, in _verify_batch
#! /usr/bin/env clj
(ns foo)
(prn "Hello")
neutron!ieure:~/Projects/clojure/foo/src$ ./foo.clj
"Hello"
Exception in thread "main" java.io.FileNotFoundException: --./foo.clj (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at clojure.lang.Compiler.loadFile(Compiler.java:4821)
at clojure.main$load_script__5833.invoke(main.clj:206)
at clojure.main$init_opt__5836.invoke(main.clj:211)
at clojure.main$initialize__5846.invoke(main.clj:239)
(defun php-lint ()
"Performs a PHP lint-check on the current file."
(interactive)
(require 'compile)
(let* ((compilation-error-regexp-alist '(php))
(compilation-error-regexp-alist-alist ())
(tramp (tramp-tramp-file-p (buffer-file-name)))
(file (or (and tramp
(aref (tramp-dissect-file-name (buffer-file-name)) 3))
(buffer-file-name))))
@ieure
ieure / star.py
Created September 14, 2009 20:23
Functional version of the Python */** operators
# -*- coding: utf-8 -*-
#
# Author: Ian Eure <ian@digg.com>
#
"""Star function."""
from functools import partial
import unittest
@ieure
ieure / error_debug.py
Created September 25, 2009 03:40
Context manager to enter the Python debugger when an exception is raised
# -*- coding: utf-8 -*-
#
# Author: Ian Eure <http://github.com/ieure>, <http://atomized.org>
#
"""Enter the debugger on exceptions.
example:
from __future__ import with_statement
@ieure
ieure / retry.py
Created September 29, 2009 23:49
from functools import partial
from itertools import imap
from operator import or_
def retry(ntimes=3, ignore=None, trap=None):
"""Retry an operation some number of times.
The ignore and trap arguments may be a sequence (or a single)
exception class. If the decorated function raises an exception
matching ignore, it will be raised.