Skip to content

Instantly share code, notes, and snippets.

@itkach
itkach / reconnect.py
Created October 18, 2010 16:58
Create asyncore connection with SimpleReconnectionStrategy
import sys
from pika import ConnectionParameters, AsyncoreConnection, asyncore_loop
from pika.connection import SimpleReconnectionStrategy
if __name__ == '__main__':
args = sys.argv[1:]
host = args[0]
params = ConnectionParameters(host, heartbeat=0)
reconnect = SimpleReconnectionStrategy()
@itkach
itkach / reconnect.py.log
Created October 18, 2010 17:12
Log of reconnection attempts
RESET
ATTEMPT ConnectionParameters(host = '192.168.122.19')
CONNECTED ConnectionParameters(host = '192.168.122.19')
RESET
RETRYING ConnectionParameters(host = '192.168.122.19') IN 1.043623993042309 SECONDS (0 attempts)
TXDISCONNECTED ConnectionParameters(host = '192.168.122.19') 0
ATTEMPT ConnectionParameters(host = '192.168.122.19')
RETRYING ConnectionParameters(host = '192.168.122.19') IN 2.7387564120438985 SECONDS (1 attempts)
TXDISCONNECTED ConnectionParameters(host = '192.168.122.19') 1
ATTEMPT ConnectionParameters(host = '192.168.122.19')
@itkach
itkach / rabbit.log
Created October 18, 2010 17:18
RabbitMQ reconnect log
=INFO REPORT==== 18-Oct-2010::12:52:27 ===
Rolling persister log to "/var/lib/rabbitmq/mnesia/rabbit/rabbit_persister.LOG.previous"
=INFO REPORT==== 18-Oct-2010::12:52:27 ===
started TCP Listener on 0.0.0.0:5672
=INFO REPORT==== 18-Oct-2010::12:52:58 ===
accepted TCP connection on 0.0.0.0:5672 from 192.168.122.1:49487
=INFO REPORT==== 18-Oct-2010::12:52:58 ===
@itkach
itkach / test_data_scheme.py
Created November 7, 2010 20:58
Tiny Qt app demonstrating loading images with data URI scheme in QWebView
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
html1 = """
<html>
<body>
@itkach
itkach / poke-php.sh
Created December 13, 2012 21:06
Script to poke PHP from command line via php-cgi
#! /bin/bash -x
export SCRIPT_FILENAME=$1
export SCRIPT_NAME="$2"
export PATH_INFO="$3"
export DOCUMENT_ROOT='/'
export REQUEST_URI="${SCRIPT_NAME}/${PATH_INFO}"
export GATEWAY_INTERFACE='CGI/1.1'
export REDIRECT_STATUS="-"
php-cgi
@itkach
itkach / asciify.py
Last active December 14, 2015 09:29
Strip diacritics
# -*- coding: utf-8 -*-
def asciify(us):
"""
>>> us = "Ňóƫė".decode('utf-8')
>>> asciify(us)
u'Note'
"""
result = []
@itkach
itkach / caller_class_name.py
Created March 14, 2013 22:27
find caller's class name
import inspect
class A(object):
def __call__(self):
stack = inspect.stack()
frame = stack[1][0]
caller = frame.f_locals.get('self', None)
print type(caller).__name__ if caller else None
diff --git a/client/xhr.js b/client/xhr.js
index 223358d..b53143e 100644
--- a/client/xhr.js
+++ b/client/xhr.js
@@ -113,6 +113,12 @@
response.headers = parseHeaders(client.getAllResponseHeaders());
response.entity = client.responseText;
+ if (response.status.code === 0) {
+ if (/^file:\/\//i.test(url)) {
simplewiki-20140209.aar
-----------------------
lxml:
Finished adding content in 619.53s
Finalizing...
Sorting... sorted in 11.27s
Resolving aliases...
Sorting... sorted in 17.90s
Resolved aliases in 322.40s

MathJax 2.5

Absolutely integrable

desktop

[MATHJAX] SVG: done in 5822 [MATHJAX] SVG with preview: done in 8537 [MATHJAX] HTML-CSS: done in 13121 [MATHJAX] HTML-CSS with preview: done in 13042