This file contains 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 -ur napkin-0.0/lib/hypnodata.cc napkin-patched/lib/hypnodata.cc | |
--- napkin-0.0/lib/hypnodata.cc 2008-04-04 15:10:03.000000000 -0700 | |
+++ napkin-patched/lib/hypnodata.cc 2009-11-11 10:52:46.000000000 -0800 | |
@@ -1,3 +1,6 @@ | |
+#include <cstdlib> | |
+#include <cstdio> | |
+#include <cstring> | |
#include <napkin/exception.h> | |
#include <napkin/util.h> | |
#include <napkin/types.h> |
This file contains 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
"""Toy code for | |
http://stackoverflow.com/questions/2150108/efficient-way-to-shift-a-list-in-python | |
Example results of timeAll on my system with Python 2.6.4: | |
{'shiftCopy': 50.579999999999984, | |
'shiftExtend': 3.4200000000000017, | |
'shiftInPlace': 3.4099999999999966, | |
'shifted': 95.409999999999997} |
This file contains 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/env python | |
"""Make an OpenID Assocition request against an endpoint | |
and print the results.""" | |
from datetime import datetime | |
import sys | |
from openid.store.memstore import MemoryStore | |
from openid.consumer import consumer | |
from openid.consumer.discover import OpenIDServiceEndpoint |
This file contains 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
/* This was one of my attempts to figure out deferred responses. | |
It crashes the whole server with a message like this: | |
[object Object].emitSuccess (node.js:283:15) | |
[object Object].<anonymous> (node.js:695:21) | |
[object Object].emitSuccess (node.js:283:15) | |
node.js:552:29 | |
node.js:1027:1 | |
node.js:1031:1 |
This file contains 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
== curl --trace multipart-fail.log -F "source={}" http://127.0.0.1:3003/jslint | |
== Info: About to connect() to proxy 127.0.0.1 port 3128 (#0) | |
== Info: Trying 127.0.0.1... == Info: connected | |
== Info: Connected to 127.0.0.1 (127.0.0.1) port 3128 (#0) | |
=> Send header, 342 bytes (0x156) | |
0000: 50 4f 53 54 20 68 74 74 70 3a 2f 2f 31 32 37 2e POST http://127. | |
0010: 30 2e 30 2e 31 3a 33 30 30 33 2f 6a 73 6c 69 6e 0.0.1:3003/jslin | |
0020: 74 20 48 54 54 50 2f 31 2e 31 0d 0a 55 73 65 72 t HTTP/1.1..User | |
0030: 2d 41 67 65 6e 74 3a 20 63 75 72 6c 2f 37 2e 31 -Agent: curl/7.1 | |
0040: 39 2e 35 20 28 78 38 36 5f 36 34 2d 70 63 2d 6c 9.5 (x86_64-pc-l |
This file contains 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
at http://openidenabled.com/python-openid/trunk/examples/consumer/finish/: | |
openid <http://specs.openid.net/auth/2.0> | |
mode = id_res | |
identity = http://keturn.myopenid.com/ | |
claimed_id = http://keturn.net/ | |
assoc_handle = {HMAC-SHA1}{4b9852bd}{CDlRdQ==} | |
op_endpoint = http://www.myopenid.com/server | |
response_nonce = 2010-03-11T02:32:02ZUpcemj | |
return_to = http://openidenabled.com/python-openid/trunk/examples/consumer/finish/?janrain_nonce=2010-03-11T02%3A27%3A41ZbQoFal | |
sig = dJMjI3wsbpnhvgfCIl2J2dBCaNY= |
This file contains 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
from django.db import models | |
class Top(models.Model): | |
_counter = 0 | |
def __init__(self, arg): | |
Top._counter += 1 | |
print "Top(%s)#__init__(<%x>, %s) called %d times" % ( | |
self.__class__.__name__, id(self), arg, Top._counter) | |
This file contains 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 A(object): | |
# method | |
def foo(self, x): | |
print self, x | |
# function -- defined after A is closed. | |
def bar(self, y): | |
print self, y | |
A.bar = bar |
This file contains 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/env python | |
"""Make the X cursor wrap-around. | |
Adapted from http://appdb.winehq.org/objectManager.php?sClass=version&iId=12599 | |
to work around lack of relative mouse movement http://wiki.winehq.org/Bug6971 | |
for Thief: Dark Shadows (and possibly others) | |
This version is a little kinder to your CPU than the shell script with | |
the busy-loop that starts a new process for every pointer query. | |
""" |
This file contains 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 getAjaxResult(self, func, *args): | |
sel = self.selenium | |
self.js('''\ | |
ajaxSeleniumResult = (function (func, args) { | |
var result = [], funcArgs; | |
function storeSeleniumResult() { | |
result.push(window.jQuery.makeArray(arguments)); | |
} | |
// assume function's last argument is a callback | |
args.push(storeSeleniumResult); |
OlderNewer