Skip to content

Instantly share code, notes, and snippets.

...
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
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)
# 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():
#!/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())
def decode_google_polyline(encoded):
"""
Decode a google polyline string into a list of coordinates.
See http://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html
"""
raw_numbers = [ord(c) - 63 for c in encoded[::-1]]
current_number = 0
sequence = []
select distinct
<include refid="t_fact_columns_fragment" />
from
t_fact fct,
t_location_fact locf,
t_user_location uloc,
t_location loc
where
fct.fact_pk = locf.fact_pk and
loc.location_id = locf.location_id and
asdf
@axiak
axiak / pybrainmilk.py
Created March 17, 2012 19:24
pybrain milk
# Michael Axiak <mike@axiak.net>
import numpy as np
from milk.supervised.base import supervised_model
def _label_to_map(label, labelMap):
val = np.ndarray(len(labelMap))
val[labelMap[label]] = 1
return val
def _label_from_map(i, labelMap):
@axiak
axiak / http-newline-arc.diff
Created March 18, 2012 15:18
Fixes invalid newline usage for HTTP responses in arc
--- /a/srv.arc 2009-06-29 12:54:11.000000000 -0400
+++ /b/srv.arc 2012-03-18 10:50:17.903238925 -0400
@@ -134,11 +134,11 @@
(if srv-noisy* (pr c))
(-- n)
(push c line))
- (if srv-noisy* (pr "\n\n"))
+ (if srv-noisy* (pr "\r\n\r\n"))
(respond o op (+ (parseargs (string (rev line))) args) cooks ip))))
#!/usr/bin/env python2.7
import remote_webkit_debug
chrome = remote_webkit_debug.ChromeShell()
tab = chrome.pick_tab([
tab for tab in chrome.get_tabs()
if 'webSocketDebuggerUrl' in tab][0])
tab.send_command('Runtime.evaluate',
expression='window.location = window.location;',