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 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 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
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 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
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 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
# Modified: Werkzeug Debugger workaround in run_websocket(self): | |
import base64 | |
import hashlib | |
import warnings | |
from gevent.pywsgi import WSGIHandler | |
from .websocket import WebSocket, Stream | |
from .logging import create_logger |
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 json | |
import os | |
import sys | |
import re | |
import socket | |
from subprocess import call | |
from bitcoinrpc.authproxy import AuthServiceProxy |
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 zipfile, time | |
import cStringIO as StringIO | |
data = StringIO.StringIO() | |
req = open("archive.zip@ref=master", "rb") | |
while True: | |
buff = req.read(1024) | |
if not buff: | |
break | |
data.write(buff) |