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 csv | |
import sys | |
import urllib | |
import BeautifulSoup | |
def main(): | |
reader = csv.reader(sys.stdin) | |
writer = csv.writer(sys.stdout) | |
writer.writerow(reader.next()) |
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
# How it would work in strict python/ Java's HTTPClient | |
import urllib2 | |
import cookielib | |
import urllib | |
import re | |
csrf_token_re = re.compile(r"csrfmiddlewaretoken.*?value=['\"?](\w+)") | |
def main(): |
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/p2pool/bitcoin/data.py b/p2pool/bitcoin/data.py | |
index e520c19..9368014 100644 | |
--- a/p2pool/bitcoin/data.py | |
+++ b/p2pool/bitcoin/data.py | |
@@ -317,11 +317,17 @@ class FloatingInteger(object): | |
return cls(bits) | |
def __init__(self, bits): | |
+ if isinstance(bits, basestring): | |
+ bits = int(bits, 16) |
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
... | |
14:52:21.265738 Unhandled Error | |
14:52:21.265785 Traceback (most recent call last): | |
14:52:21.265807 File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 542, in _runCallbacks | |
14:52:21.265828 current.result = callback(current.result, *args, **kw) | |
14:52:21.265848 File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1076, in gotResult | |
14:52:21.265868 _inlineCallbacks(r, g, deferred) | |
14:52:21.265888 File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1018, in _inlineCallbacks | |
14:52:21.265907 result = result.throwExceptionIntoGenerator(g) | |
14:52:21.265926 File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 350, in throwExceptionIntoGenerator |
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
new Iterator[DayRecord] { | |
var numRecords = 0 | |
var nextRecord = actualNext() | |
def next() = nextRecord match { | |
case Some(x) => { | |
nextRecord = actualNext() | |
x | |
} | |
case _ => throw new NoSuchElementException() |
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
[info] Set current project to default-5f8541 (in build file:/home/axiak/.sbt/plugins/) | |
[info] Compiling 2 Scala sources to /home/axiak/.../project/target/scala_2.8.1/classes... | |
[error] /home/axiak/.../project/Build.scala:13: not found: value ShellPrompt | |
[error] shellPrompt := ShellPrompt.buildShellPrompt | |
[error] ^ | |
[error] /home/axiak/.../project/Simulator.scala:26: not found: type App | |
[error] object Simulator extends App { | |
[error] ^ | |
[error] /home/axiak/.../Simulator.scala:27: not found: value args | |
[error] if (args.isEmpty) { |
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
./project | |
./project/Simulator.scala | |
./.idea_modules | |
./.idea_modules/default-309e8b.iml | |
./.idea_modules/project.iml | |
./run.sh | |
./.history | |
./.idea | |
./build.sbt |
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
name := "MyProject" | |
version := "0.1" | |
scalaVersion := "2.9.1" | |
scalaHome := Some(file("/opt/scala")) | |
scalaSource in Compile <<= baseDirectory(_ / "project") |
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
requireLogin = (method) -> | |
(req, res) -> | |
if loggedIn | |
method(req, res) | |
else | |
# blargh! | |
class MyHandler | |
getUser: requireLogin (req, res) -> |
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
sub js_encode { | |
my $text = shift; | |
my @js_entities = ("\\", "\\\\", '&', '\&', '"', '\"', '<', '\<', '>', '\>', "'", "\'"); | |
# This was what was there before: | |
#my @js_entities = ('&', '\&', '"', '\"', '<', '\<', '>', '\>', "'", "\'"); | |
my ($char, $js_char); | |
for (my $i = 0; $i < scalar @js_entities; $i = $i + 2) { | |
$text =~ s/$js_entities[$i]/$js_entities[$i+1]/g; | |
} | |
return $text; |