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
| $ time ~/bin/jgit.sh log -M -p v1.5.0 >/dev/null | |
| 0m12.505s | |
| 0m12.528s | |
| 0m12.734s | |
| $ time ../git/git log -M -p v1.5.0 >/dev/null | |
| 0m7.252s | |
| 0m7.229s | |
| 0m7.268s |
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
| jgit repo | |
| $ time jgit.sh log -M -p v0.99 >/dev/null | |
| 0m3.873s | |
| 0m3.801s | |
| 0m3.919s | |
| $ time ../git/git log -M -p >/dev/null | |
| 0m3.032s | |
| 0m2.940s |
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
| # | |
| # why not used sed -i? It seems the implementation I'm using runs into | |
| # problems with permissions: | |
| # | |
| # sed: preserving permissions for `django/contrib/auth/migrations/sed072496': Permission denied | |
| # | |
| # huh?? I'm using this stupid copying-around trick to silence this | |
| # errors and prevent the file from being marked as read-only. | |
| # | |
| strip() { cat "$1" | sed 's/[ \t]*$//g' > /tmp/foo && cp /tmp/foo "$1"; } |
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
| package net.rctay.testing; | |
| import java.lang.annotation.ElementType; | |
| import java.lang.annotation.Retention; | |
| import java.lang.annotation.RetentionPolicy; | |
| import java.lang.annotation.Target; | |
| @Retention(RetentionPolicy.RUNTIME) | |
| @Target(ElementType.METHOD) | |
| public @interface IOTest { |
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 decorates(dec): | |
| def handler(*args, **kwargs): | |
| if len(args) == 1 and callable(args[0]): | |
| func = args[0] | |
| return dec(func) | |
| else: | |
| def wrapper(func): | |
| return dec(func, *args, **kwargs) | |
| return wrapper | |
| return handler |
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 integers(): | |
| i = 1 | |
| while True: | |
| yield i | |
| i += 1 | |
| def head(iter, n): | |
| return [iter.next() for i in xrange(n)] |
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 static org.junit.Assert.*; | |
| import static org.junit.matchers.JUnitMatchers.*; // for non-hamcrest core matchers | |
| import static org.mockito.Mockito.*; | |
| import java.io.IOException; | |
| import java.io.PrintWriter; | |
| import java.io.StringWriter; | |
| import java.util.HashMap; | |
| import java.util.Map; |
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
| class Float; orig_round = self.instance_method(:round); define_method(:round) do |*args| prec = args[0] || 1; if prec == 1 then return orig_round.bind(self).call() else a = 10**prec; return orig_round.bind(self*a).call().to_f / a end end end |
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
| class BaseMatrixException(Exception): | |
| """Base class for all exceptions from matrix operations.""" | |
| class InconsistentRowSizeException(BaseMatrixException): | |
| def __init__(self, size1, size2): | |
| self.size1 = size1 | |
| self.size2 = size2 | |
| def __str__(self): |
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
| [submodule "iostream_callback"] | |
| path = iostream_callback | |
| url = git://gist.github.com/753987.git |