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 difflib | |
def diff(old, new, limit=False): | |
matcher = difflib.SequenceMatcher(None, old, new) | |
actions = [] | |
size = 0 | |
for tag, old_from, old_to, new_from, new_to in matcher.get_opcodes(): | |
if tag == "insert": | |
new_line = new[new_from:new_to] | |
actions.append(("+", new_line)) |
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 diff(old, new): | |
# via https://github.com/paulgb/simplediff/blob/master/python/LICENSE by Paul Butler | |
# Create a map from old values to their indices | |
old_index_map = dict() | |
for i, val in enumerate(old): | |
old_index_map.setdefault(val,list()).append(i) | |
# Find the largest substring common to old and new. | |
# We use a dynamic programming approach here. | |
# |
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 re, time | |
data = open("all2.js").read() | |
translate = { | |
"Please, choose your account before creating a topic.": "TRANS1", | |
"Please, choose your account before upvoting.": "TRANS2", | |
"Comments requires at least ZeroNet 0.3.0 Please upgade!": "TRANS3", | |
"Every new user has limited space to store comments, topics and votes.\\n": "TRAN4", | |
"This indicator shows your used/total allowed KBytes.\\n": "TRANS5", |
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
fdb = [] | |
for i in xrange(10000): | |
try: | |
fdb.append(open('test_max.py', 'r')) | |
except Exception, err: | |
print "Max open files without changing settings: %s" % i | |
break | |
fdb = [] | |
import sys |
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 urllib2, re, json, os, time, sys, HTMLParser | |
html_parser = HTMLParser.HTMLParser() | |
auth_address = "1KbV1e1u6P6AsY8XNBydgtbtN8iSB5WMyG" | |
auth_privatekey = "xxxx" | |
site = "1TaLkFrMwvbNsooF4ioKAY9EuxTBTjipT" | |
zeronet_dir = ".." | |
os.chdir(zeronet_dir) |
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 time | |
import urllib | |
import urllib2 | |
import hashlib | |
import struct | |
import socket | |
import bencode | |
import gevent | |
import os | |
import re |
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 sublime, sublime_plugin, re | |
class ExampleCommand(sublime_plugin.EventListener): | |
def on_activated(self, view): | |
self.on_load(view) | |
def on_load(self, view): |
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 msgpack | |
import cStringIO as StringIO | |
print "Msgpack Version", msgpack.version | |
print "Testing simple data" | |
data = "A"*10 | |
for i in range(1,20): | |
print "- %skb..." % len(data), | |
print "Packing", |
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
Program received signal SIGSEGV, Segmentation fault. | |
0x00007ffff62452eb in BN_bin2bn () from /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 | |
#0 0x00007ffff62452eb in BN_bin2bn () from /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 | |
#1 0x00007ffff484e834 in ffi_call_unix64 () from /usr/lib/python2.7/lib-dynload/_ctypes.so | |
#2 0x00007ffff484e2af in ffi_call () from /usr/lib/python2.7/lib-dynload/_ctypes.so | |
#3 0x00007ffff483bfd1 in _call_function_pointer (argcount=3, resmem=0x7fffffffa8e0, restype=<optimized out>, atypes=<optimized out>, avalues=0x7fffffffa8b0, | |
pProc=0x7ffff62452a0 <BN_bin2bn>, flags=4353) at /home/jmm/py/python2.7-2.7.3/Modules/_ctypes/callproc.c:827 | |
#4 _ctypes_callproc (pProc=pProc@entry=0x7ffff62452a0 <BN_bin2bn>, argtuple=argtuple@entry= | |
("TC\xdb\xc6_(8\x0ct\xdf\xc3i\xb5\xb9e\x03\x9f\x1c'\x07\xc2kg\xb5\x89\x99\xc8\xee\x10\xdc\x15\x1e", 32, -334573824), flags=4353, argtypes=< at remote 0x8d30a0>, |
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
# via http://pastebin.com/H1XikJFd | |
# -*- Mode: Python -*- | |
# This is a combination of http://pastebin.com/bQtdDzHx and | |
# https://github.com/Bitmessage/PyBitmessage/blob/master/src/pyelliptic/openssl.py | |
# that doesn't crash on OSX. | |
import ctypes | |
import ctypes.util | |
import hashlib |