Skip to content

Instantly share code, notes, and snippets.

void function() {//closure
var global = this
, _initKeyboardEvent_type = (function( e ) {
try {
e.initKeyboardEvent(
"keyup" // in DOMString typeArg
, false // in boolean canBubbleArg
, false // in boolean cancelableArg
, global // in views::AbstractView viewArg
void function() {//closure
var global = this
, _initKeyboardEvent_type = (function( e ) {
try {
e.initKeyboardEvent(
"keyup" // in DOMString typeArg
, false // in boolean canBubbleArg
, false // in boolean cancelableArg
, global // in views::AbstractView viewArg
# Unlike Twisted, Tulip and Tornado, gevent can use existing Python libraries:
# Django, Flask, requests, redis-py, SQLAlchemy to name a few
from gevent import monkey; monkey.patch_all()
import gevent
import requests
from flask import Flask
app = Flask(__name__)
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import ClientFactory
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor
import sys
@denik
denik / README.md
Created November 12, 2013 14:41 — forked from evandrix/README.md

Here are a list of headless browsers that I know about:

  • [HtmlUnit][1] - Java. Custom browser engine. JavaScript support/DOM emulated. Open source.
  • [Ghost][2] - Python only. WebKit-based. Full JavaScript support. Open source.
  • [Twill][3] - Python/command line. Custom browser engine. No JavaScript. Open source.
  • [PhantomJS][4] - Command line/all platforms. WebKit-based. Full JavaScript support. Open source.
  • [Awesomium][5] - C++/.Net/all platforms. Chromium-based. Full JavaScript support. Commercial/free.
  • [SimpleBrowser][6] - .Net 4/C#. Custom browser engine. No JavaScript support. Open source.
  • [ZombieJS][7] - Node.js. Custom browser engine. JavaScript support/emulated DOM. Open source.
  • [EnvJS][8] - JavaScript via Java/Rhino. Custom browser engine. JavaScript support/emulated DOM. Open source.
@denik
denik / raw_request.py
Created May 21, 2013 16:14
gevent.wsgi extension that adds RAW_REQUEST variable to environ which contains original HTTP request as passed by the client.
from gevent.wsgi import WSGIHandler as _WSGIHandler, WSGIServer as _WSGIServer
class WSGIHandler(_WSGIHandler):
format_request = format_request
def get_environ(self):
environ = _WSGIHandler.get_environ(self)
environ['RAW_REQUEST'] = self.path
return environ
@denik
denik / travis-last-build.py
Created February 19, 2013 14:00
prints a number: last travis build for current branch
#!/usr/bin/python
import sys
import re
import subprocess
popen = subprocess.Popen("travis history --branch `git rev-parse --abbrev-ref HEAD` --limit 1", stderr=subprocess.PIPE,
stdout=subprocess.PIPE, shell=True)
out, err = popen.communicate()
try:
@denik
denik / test_channel_stackless.py
Last active December 10, 2015 09:08
Unexpectedly bad performance of stackless and greenlet on PyPy
# according to this benchmark stackless.channel is 100x slower on PyPy compared to Stackless
"""
Stackless result:
$ stackless2.7-static test_channel_stackless.py
1000000 send took 0.397s
Stackless version:
$ stackless2.7-static
@denik
denik / gist:3168594
Created July 24, 2012 07:29
testsigchld5
/* gcc -DEV_STANDALONE=1 testsigchld5.c -o testsigchld5
*
* Expected output: infinite sequence of "*."
*
* Actual output:
* denis@denis-laptop:~/work/libev-cvs$ ./testsigchld4
* Alarm clock
* (and the subprocess exits 60 seconds later).
*
* */
@denik
denik / testsigchld4.c
Created May 30, 2012 20:28
bug in libev child watcher after fork
/* gcc -DEV_STANDALONE=1 testsigchld4.c -o testsigchld4
*
* Expected output: infinite sequence of "*."
*
* Actual output:
* denis@denis-laptop:~/work/libev-cvs$ ./testsigchld4
* Alarm clock
* (and the subprocess exits 60 seconds later).
*
* */